Search
Question: Filtering DESeq2 result export along multiple lines
0
9 months ago by
rbronste60
rbronste60 wrote:

Wondering if there is a way to filter the following output:

resOrdered <- res[(res$padj < 0.01),] write.csv(as.data.frame(resOrdered$padj < 0.01),file="test.csv")

so as to get as an output .csv only (something below a padj, with a fold-change cutoff, as well as a minimum baseMean) simultaneously without subsetting? Some internal function within DESeq2?

Thanks!

modified 9 months ago by Michael Love19k • written 9 months ago by rbronste60
2
9 months ago by
Michael Love19k
United States
Michael Love19k wrote:

This is simply done with basic R code, adding an “&” and additional logical vectors in your code above. Instead of filtering on fold change though, we recommend testing against a threshold, see lfcThreshold in ?results or in the vignette.

So something along these lines:

resLFC <- results(dds, lfcThreshold = 2, altHypothesis = "greaterAbs")

However one question I have, maybe Im missing something but this is from the vignette:

Two arguments to the results function allow for threshold-based Wald tests: lfcThreshold, which takes a numeric of a non-negative threshold value, and altHypothesis, which specifies the kind of test.

So does this mean that the following is not amenable to this lfc adjustment?

resLFC <- results(dds, lfcThreshold = -2, altHypothesis = lessAbs")

Thanks again!

1

Are you interested in finding genes with large LFC (in absolute value)? If so, you should use the default value for altHypothesis. See the DESeq2 paper or vignette for more details.

So I am actually doing this with converted ChIP-seq counts representing a vehicle or treatment condition, so thought there may be a more nuanced method of approaching those with:

lfcThreshold

Let's go from the other direction: what kind of LFC are you interested in finding when you compare treatment to vehicle?

So I am just trying to compile a list of DE peaks where for instance LFC < -2 would be considered treatment enhanced and LFC > 2 would be vehicle enhanced. With those between the two LFC values being considered as shared.

1

Usually we do treated / vehicle, which you can obtain by setting the reference level of the condition variable before you run DESeq(), see this section:

https://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#note-on-factor-levels

You can get beta > 2, beta < -2 or |beta| > 2 using these settings:

https://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#tests-of-log2-fold-change-above-or-below-a-threshold