Swish with more than two conditions. Add support for contrasts?
1
0
Entering edit mode
@4174dc58
Last seen 6 weeks ago
United States

Just followed the vignette to run Swish for the first time using inferential replicates computed by salmon, on data from an F1 cross of two non-B6 mouse strains. It seemingly worked great (including the import via tximeta) and was rather easy, so thanks for that!

One thing I noticed is how it's seemingly designed for only two experimental conditions (treatment vs reference) to be handled at a time. The code in the vignette implies that if you have more than two conditions, you can subset your se object and test separately like so:

y <- se[,se$condition %in% c("control1","treated1")] y$condition <- factor(y$condition, levels=c("control1","treated1")) y <- scaleInfReps(y) y <- labelKeep(y) y <- swish(y, x="condition")  z <- se[,se$condition %in% c("control2","treated2")]
z$condition <- factor(z$condition, levels=c("control2","treated2"))
z <- scaleInfReps(z)
z <- labelKeep(z)
z <- swish(z, x="condition")


It could be a nice improvement to enable the use of contrasts a la DESeq2, something equivalent to:

res1 <- lfcShrink(dds, contrast=c("condition","treated1","control1"), type="ashr")
res2 <- lfcShrink(dds, contrast=c("condition","treated2","control2"), type="ashr")


Given the statistical benefit on the DESeq2 side of including all samples together in the same normalization framework, I assume the same is not true for Swish's underlying method, both in terms of detection of differential expression and in reporting normalized/scaled counts?

Thanks again!

tximeta DESeq2 swish fishpond • 168 views
1
Entering edit mode
@mikelove
Last seen 1 day ago
United States

Thanks for posting -- good to clarify here. We have a few other designs/tests in swish but you are right that it's mostly focused around comparison of two groups, but in various contexts.

Just to think of the various contexts where we might compare two groups but still share information:

• two group but with batches
• two group but with sample pairing (e.g. within sample before / after)
• correlation of expression (or LFC for paired data) with a continuous covariate
• interaction test: whether the LFC across condition is different across a second grouping variable (say a covariate)
• interaction test: whether the LFC defined by sample pairing is different across a grouping variable (say a condition)

Except for the correlation of expression level, these are all focused on an LFC of two groups.

Unlike in DESeq2, where we benefit in the multi-group context from sharing information about parameters across those multiple groups of samples, Swish does not have any parameters of this type, within-group variability. I think there is in some ways an advantage here, as it will be more robust to mis-specification of the equal variance or equal dispersion assumption of parametric models. But if the groups did have equal variance or dispersion there may be some loss of power.

So then the recommendation would just be to do the subsetting as you have above. You can perform the scaling at the top of the script across all groups -- this is very similar to DESeq2-style calculation of size factors.

However, it is probably better to separate the labelKeep step to each contrast -- just to keep as many features as possible.