Enter the body of text here
Code should be placed in three backticks as shown below
# include your problematic code here with any corresponding output
# please also include the results of running the following in an R session
sessionInfo( )
Hello,
I have a tentative grasp on DESEQ2 I am trying to generate a heatmap (and other DEG visualization tools) using my output from DESEQ2. I followed the tutorial (http://bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#why-un-normalized-counts) starting with salmon files and then using tximeta to create a summarized experiment. I performed DESEQ2 on my summarized experiment:
se <- tximeta(coldata)
library(DESeq2)
ddsTxi <- DESeqDataSet(se, design = ~ Condition)
ddsTxi
The object ddsTxi looks something like this:
Sample1 Sample2 Sample3 Sample4 Sample5
ENST00000456328.2 1.850 1.333 3.845 0.000 6.181
ENST00000450305.2 0.000 0.000 0.000 0.000 0.000
ENST00000488147.1 84.946 140.966 117.379 142.208 71.022
And then DESEQ2:
dds <- DESeq(dds)
res <- results(dds)
res
mcols(res, use.names = TRUE)
Which looks something like this:
baseMean log2FoldChange lfcSE stat pvalue
<numeric> <numeric> <numeric> <numeric> <numeric>
ENST00000456328.2 13.750573 -0.2570229 1.268077 -0.20268715 0.839380
ENST00000488147.1 119.249079 0.2125775 0.305591 0.69562687 0.486663
ENST00000473358.1 0.287952 -0.0662034 7.678081 -0.00862239 0.993120
And I know that from there I can perform comparisons between any of my variables/conditions. My first issue is that I would really like the transcript IDs to be replaced by the Gene names. I've used Biomart before to convert the transcript ID to ensmbl gene names in the past. But when I do this, I end up with multiple transcripts for the same gene. I will look at the fold changes for Gene A, only to find that there are three different entries. Is there any way to generate results tables that take this into account and only have one entry per gene? I need to generate heatmaps for the different experimental comparisons, but for that I would also need a gene counts table with one entry per gene. I will take any advice on how to do the conversion, download a gene counts table, or any good packages for generating heatmaps with DESEQ2 data.
Thank you!
I just looked through the vignette and that helped! I was able to follow it through to create the "gse" object to use as input for DESEQ2. My question now is if there is a way to save that object, (which I'm presuming are the gene-level counts for each sample), as a data frame, matrix, or anything I can use outside of R? I tried the write.csv command and got an error message saying, "Error in as.vector(x) : no method for coercing this S4 class to a vector".
The object you wish to save acts like a
data.frame
in order to shield end users from the complications of trying to consistently manipulate several different things at once. The 'dds' (gse?) object is actually comprised of multiple objects; one or more matrices of the underlying count (and possible modifications of the counts) data, aDataFrame
that describes the samples, and aGRanges
object that describes the rows. Theshow
method gives you a peek at all the data in an object.And you can inspect each underlying object using the relevant accessor methods.
And after running
DESeq
on that object, there are even more things in the resultingDESeqDataSet
object. So 'writing to csv' isn't such a simple thing, and I would argue is unnecessary. To what end? All these objects are intended to be very complex, but simple to use, and there are any number of accessors that you can use to make plots or whatever. I can't figure out what you could do outside of R that wouldn't be easier to do from within R.But anyway, you can extract anything you like from the object and then use
write.csv
orwrite.table
directly.