swish {fishpond} | R Documentation |
swish: SAMseq With Inferential Samples Helps
swish(y, x, cov = NULL, pair = NULL, interaction = FALSE, nperms = 30, estPi0 = FALSE, qvaluePkg = "qvalue", pc = 5, nRandomPairs = 30, quiet = FALSE)
y |
a SummarizedExperiment containing the inferential replicate matrices of median-ratio-scaled TPM as assays 'infRep1', 'infRep2', etc. |
x |
the name of the condition variable. A factor with two levels for a two group analysis (possible to adjust for covariate or matched samples, see next two arguments) |
cov |
the name of the covariate for adjustment.
If provided a stratified Wilcoxon in performed.
Cannot be used with |
pair |
the name of the pair variable, which should be the
number of the pair. Can be an integer or factor.
If specified, a signed rank test is used
to build the statistic. All samples across |
interaction |
logical, whether to perform a test of an interaction
between |
nperms |
the number of permutations |
estPi0 |
logical, whether to estimate pi0 |
qvaluePkg |
character, which package to use for q-value estimation,
|
pc |
pseudocount for finite estimation of |
nRandomPairs |
the number of random pseudo-pairs (only used with
|
quiet |
display no messages |
a SummarizedExperiment with metadata columns added:
the statistic (either a centered Wilcoxon Mann-Whitney
or a signed rank statistic, aggregated over inferential replicates),
a log2 fold change (the median over inferential replicates,
and averaged over pairs or groups (if groups, weighted by sample size),
the local FDR and q-value, as estimated by the samr
package.
swish
is described in the following reference:
Anqi Zhu, Avi Srivastava, Joseph G Ibrahim, Rob Patro, Michael I Love "Nonparametric expression analysis using inferential replicate counts" Nucleic Acids Research (2019).
The swish
method builds upon the SAMseq
method,
and extends it by incorporating inferential uncertainty.
swish
internally calls functions from the samr
package, for example, the calculation of local FDR and q-value.
The citation for SAMseq
is:
Jun Li and Robert Tibshirani "Finding consistent patterns: A nonparametric approach for identifying differential expression in RNA-Seq data" Stat Methods Med Res (2013).
library(SummarizedExperiment) set.seed(1) y <- makeSimSwishData() y <- scaleInfReps(y) y <- labelKeep(y) y <- swish(y, x="condition") # histogram of the swish statistics hist(mcols(y)$stat, breaks=40, col="grey") cols = rep(c("blue","purple","red"),each=2) for (i in 1:6) { arrows(mcols(y)$stat[i], 20, mcols(y)$stat[i], 10, col=cols[i], length=.1, lwd=2) } # plot inferential replicates plotInfReps(y, 1, "condition") plotInfReps(y, 3, "condition") plotInfReps(y, 5, "condition")