This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Calculating significant variance of gene expression across multiple samples

Hello,

For my experiments, I want to calculate if a gene is significantly variable expressed across 40 biological similar samples in R. Until know, I assigned two random groups of the size of 20 and followed the DSEQ2 protocol for differential expression. However, 99.9% of the genes were asigned with an adjusted p-value of 0.9987168, which does not allow further differenciation. Maybe just looking at the variance of the normalized gene expression could be an alternative solution. So my question is, how would you check for the most variable expressed genes across 40 samples and would you use the DESEQ2 package for that purpose?

rna-seq dge dseq2 r

1 answer

You can start by transforming your raw counts with either vst or rlog, followed by using the rowVars function to select the most variable genes:

## be dds your DESeq2 object:
vsd <- vst(dds)

rv <- rowVars(assay(vsd))

## say you want the top 500 (ntop=500)
ntop <- 500
select <- order(rv, decreasing = TRUE)[seq_len(min(ntop, length(rv)))]

## get the DESeqTransform object with the top 500 most variable genes
vsd500 <- vsd[select,]

This is pretty much copied from getMethod("plotPCA", "DESeqTransform"), the PCA function of DESeq2 that by default performs the PCA with the 500 most variable genes.

Thank you, I will try that!

Log in to answer this question.