computeSCR {scp} | R Documentation |
Compute the sample over carrier ratio (SCR)
Description
The function computes the ratio of the intensities of sample
channels over the intentisty of the carrier channel for each
feature. The ratios are averaged within the assay.
Usage
computeSCR(
object,
i,
colvar,
samplePattern,
sampleFUN = "mean",
carrierPattern,
carrierFUN = sampleFUN,
rowDataName = "SCR"
)
Arguments
object |
A QFeatures object.
|
i |
A character() or integer() indicating for which
assay(s) the SCR needs to be computed.
|
colvar |
A character(1) indicating the variable to take
from colData(object) that gives the sample annotation.
|
samplePattern |
A character(1) pattern that matches the
sample encoding in colvar .
|
sampleFUN |
A character(1) or function that provides the
summarization function to use (eg mean, sum, media, max, ...).
Only used when the pattern matches multiple samples. Default
is mean . Note for custom function, na.rm = TRUE is passed
to sampleFUN to ignore missing values, make sure to provide
a function that accepts this argument.
|
carrierPattern |
A character(1) pattern that matches the
carrier encoding in colvar . Only one match per assay is
allowed, otherwise only the first match is taken
|
carrierFUN |
A character(1) or function that provides the
summarization function to use (eg mean, sum, media, max, ...).
Only used when the pattern matches multiple carriers. Default
is the same function as sampleFUN . Note for custom function,
na.rm = TRUE is passed to carrierFUN to ignore missing
values, make sure to provide a function that accepts this
argument.
|
rowDataName |
A character(1) giving the name of the new
variable in the rowData where the computed SCR will be
stored. The name cannot already exist in any of the assay
rowData .
|
Value
A QFeatures
object for which the rowData
of the given
assay(s) is augmented with the mean SCR.
Examples
data("scp1")
scp1 <- computeSCR(scp1,
i = 1,
colvar = "SampleType",
carrierPattern = "Carrier",
samplePattern = "Blank|Macrophage|Monocyte",
sampleFUN = "mean",
rowDataName = "MeanSCR")
## Check results
rowData(scp1)[[1]][, "MeanSCR"]
[Package
scp version 1.4.0
Index]