Filtering DESeq2 result export along multiple lines
1
0
Entering edit mode
rbronste ▴ 60
@rbronste-12189
Last seen 4.5 years ago

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!

deseq2 differential binding analysis deseq • 1.4k views
ADD COMMENT
2
Entering edit mode
@mikelove
Last seen 11 hours ago
United States

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.

ADD COMMENT
0
Entering edit mode

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!

ADD REPLY
1
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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
ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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. 

ADD REPLY
1
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 437 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6