getBaselineDivergence | R Documentation |
Calculates sample dissimilarity between the given baseline and other time points, optionally within a group (subject, reaction chamber, or similar). The corresponding time difference is returned as well.
getBaselineDivergence(x, ...)
addBaselineDivergence(x, ...)
## S4 method for signature 'SummarizedExperiment'
getBaselineDivergence(
x,
time.col,
assay.type = "counts",
reference = NULL,
group = NULL,
method = "bray",
...
)
## S4 method for signature 'SummarizedExperiment'
addBaselineDivergence(x, name = "divergence", name.time = "time_diff", ...)
x |
A
|
... |
Optional arguments passed into
|
time.col |
|
assay.type |
|
reference |
|
group |
|
method |
|
name |
|
name.time |
|
The group argument allows calculating divergence per group. If given, the divergence is calculated per group. e.g. subject, chamber, group etc. Otherwise, this is done across all samples at once.
The baseline sample(s) always need to belong to the data object i.e. they can be merged into it before applying this function. The reason is that they need to have comparable sample data, at least some time point information for calculating time differences w.r.t. baseline sample.
The baseline time point is by default defined as the smallest time point (per group). Alternatively, the user can provide the baseline vector, or a list of baseline vectors per group (named list per group).
getBaselineDivergence
returns DataFrame
object
containing the sample dissimilarity and corresponding time difference between
samples. addBaselineDivergence
, on the other hand, returns a
SummarizedExperiment
object with these results in its colData
.
mia::addDivergence()
library(miaTime)
library(mia)
data(hitchip1006)
tse <- transformAssay(hitchip1006, method = "relabundance")
# By default, reference samples are the samples from the first timepoint
tse <- addBaselineDivergence(
tse,
group = "subject",
time.col = "time",
assay.type = "relabundance",
method = "bray")
# Add reference samples to colData, if you want to specify reference
# samples manually
colData(tse)[["reference"]] <- "Sample-875"
tse <- addBaselineDivergence(
tse,
reference = "reference",
group = "subject",
time.col = "time",
name = "divergence_from_baseline",
name.time = "time_from_baseline",
assay.type = "relabundance",
method = "bray")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.