Thanks for your interest in using Swish.
So here is a typical run of swish
:
library(SummarizedExperiment)
library(fishpond)
y <- makeSimSwishData()
y <- scaleInfReps(y)
## Progress: 20 on 20
y <- labelKeep(y)
set.seed(1)
y <- swish(y, x="condition")
## Generating test statistics over permutations
## Progress: 100 on 100
Then we can look at a particular feature (say a gene):
plotInfReps(y, which.min(mcols(y)$qvalue), "condition")
This plots the distribution of the Gibbs samples (or bootstraps) for each sample.
The values that are plotted are stored in a series of matrices: the matrices named "infRep..." in assayNames(y)
.
If you want the values for a particular feature you can use the code:
infRepMatrix <- unlist( assays(y[idx,])[ grep("infRep", assayNames(y)) ] )
This matrix is nreps x nsamples. You could then compute the column median (the thick lines in the boxplot) or the column mean of these.
If you want to compute this for all features at once you can use the abind
function to make an array and then use apply
:
infReps <- assays(y)[ grep("infRep", assayNames(y)) ]
infArray <- abind::abind( as.list(infReps), along=3 )
infArray
is nfeature x nsamples x nreps. You can compute summaries like so:
infMed <- apply(infArray, 1:2, median)
infMean <- apply(infArray, 1:2, mean)
Hello Michael.
Thank you for taking your time and answering the question in such a quick manner. The code you've supplied looks great, I will run the analysis in Swish and give it a go!
Thanks!
Regards Fredrik
Hi again Michael.
I tried the package and it looks great! I have one last question or request, if one would like to use the inbuilt plots (for portraying the inferential replicates) is it possible to change the name of the x-axis from sample number to sample name?
Thanks!
Best Regards, Fredrik
Sure, we went with numbers just because they are short, so work regardless of whether there are few or many replicates.
You can customize the x-axis by specifying:
xaxis=FALSE, xlab=""
in the call toplotInfReps()
.Then you can add any labels you like, e.g.:
Hi Michael.
Thank you for the quick reply.
Best Regards, Fredrik