Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stability calculation #105

Merged
merged 8 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: miaTime
Type: Package
Title: Microbiome Time Series Analysis
Version: 0.99.4
Version: 0.99.5
Authors@R:
c(person(given = "Leo", family = "Lahti", role = c("aut"),
email = "[email protected]",
Expand Down Expand Up @@ -29,6 +29,7 @@ Imports:
methods,
S4Vectors,
SingleCellExperiment,
stats,
SummarizedExperiment,
tidyr,
TreeSummarizedExperiment
Expand Down
15 changes: 15 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@
export(addBaselineDivergence)
export(addBimodality)
export(addShortTermChange)
export(addStability)
export(addStepwiseDivergence)
export(getBaselineDivergence)
export(getBimodality)
export(getShortTermChange)
export(getStability)
export(getStepwiseDivergence)
exportMethods(addBaselineDivergence)
exportMethods(addBimodality)
exportMethods(addShortTermChange)
exportMethods(addStability)
exportMethods(addStepwiseDivergence)
exportMethods(getBaselineDivergence)
exportMethods(getBimodality)
exportMethods(getShortTermChange)
exportMethods(getStability)
exportMethods(getStepwiseDivergence)
import(S4Vectors)
import(SingleCellExperiment)
Expand All @@ -24,14 +28,25 @@ import(methods)
import(mia)
importFrom(dplyr,across)
importFrom(dplyr,all_of)
importFrom(dplyr,all_vars)
importFrom(dplyr,any_of)
importFrom(dplyr,arrange)
importFrom(dplyr,distinct)
importFrom(dplyr,filter_at)
importFrom(dplyr,group_by)
importFrom(dplyr,if_else)
importFrom(dplyr,lag)
importFrom(dplyr,mutate)
importFrom(dplyr,rename_with)
importFrom(dplyr,select)
importFrom(dplyr,summarise)
importFrom(dplyr,summarize)
importFrom(dplyr,sym)
importFrom(dplyr,ungroup)
importFrom(dplyr,vars)
importFrom(stats,coef)
importFrom(stats,lm)
importFrom(stats,median)
importFrom(stats,setNames)
importFrom(tidyr,pivot_wider)
importFrom(tidyr,unnest)
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Changes in version 0.99.5
+ Added functions for estimating stability

Changes in version 0.99.4
+ Added functions for calculating short term change metrics

Expand Down
10 changes: 10 additions & 0 deletions R/AllGenerics.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,13 @@ setGeneric("addShortTermChange", signature = "x", function(x, ...)
#' @export
setGeneric("getShortTermChange", signature = "x", function(x, ...)
standardGeneric("getShortTermChange"))

#' @rdname getStability
#' @export
setGeneric("getStability", signature = "x", function(x, ...)
standardGeneric("getStability"))

#' @rdname getStability
#' @export
setGeneric("addStability", signature = "x", function(x, ...)
standardGeneric("addStability"))
1 change: 0 additions & 1 deletion R/getBaselineDivergence.R
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ setMethod("addBaselineDivergence", signature = c(x = "SummarizedExperiment"),
}

# This function converts time divergence results to DF object
#' @importFrom dplyr summarize
.convert_divergence_to_df <- function(
x, res, time_res, reference,
name = c("divergence", "time_diff", "ref_samples"), ...){
Expand Down
5 changes: 4 additions & 1 deletion R/getBimodality.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ setMethod("addBimodality", signature = c(x = "SummarizedExperiment"),
function(x, name = "bimodality", ...){
.check_input(name, "character scalar")
x <- .check_and_get_altExp(x, ...)
res <- getBimodality(x, name = name, ...) |> as.list()
args <- c(
list(x = x, name = name),
list(...)[!names(list(...)) %in% c("altexp")])
res <- do.call(getBimodality, args) |> as.list()
x <- .add_values_to_colData(x, unname(res), names(res), MARGIN = 1L)
return(x)
}
Expand Down
Loading
Loading