Search
Question: Filtering DESeq2 result export along multiple lines
0
gravatar for rbronste
12 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!

ADD COMMENTlink modified 12 months ago by Michael Love20k • written 12 months ago by rbronste60
2
gravatar for Michael Love
12 months ago by
Michael Love20k
United States
Michael Love20k 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.

ADD COMMENTlink written 12 months ago by Michael Love20k

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 REPLYlink written 12 months ago by rbronste60
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.

ADD REPLYlink written 12 months ago by Michael Love20k

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 REPLYlink written 12 months ago by rbronste60

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

ADD REPLYlink written 12 months ago by Michael Love20k

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 REPLYlink written 12 months ago by rbronste60
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

ADD REPLYlink written 12 months ago by Michael Love20k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 361 users visited in the last hour