Hello! I am trying to figure out how I can make an MA plot from the following my data frame dar
I am currently using DESeq2 but I extracted the information from data frame dr
which is the results (dds
) I saved this as a csv.
Opened another R session and loaded dr
where I can have the column with gene name. I changed the header of that column to "gene" then merged dr
by "gene" it to my list of genes of interest to make my data frame dim.
So dim at the moment isnt seen as a DESeq2 object data frame.
dim(dar)
[1] 13348 6
head(dar)
baseMean log2FoldChange lfcSE stat
A1BG 7.278775e-02 0.140265235 1.6670434 0.084140124
A1CF 4.130988e-02 -1.102589688 1.6676373 -0.661168755
AAAS 1.657182e+01 1.173655704 0.5986687 1.960442661
AACS 6.373922e+00 -0.653331952 0.8046976 -0.811897466
AADAC 3.251195e+00 0.736454731 0.7014096 1.049963935
pvalue padj
A1BG 9.329450e-01 NA
A1CF 5.085041e-01 NA
AAAS 4.994407e-02 1.377416e-01
AACS 4.168505e-01 6.001605e-01
AADAC 2.937347e-01 4.793114e-01
I want to make an MA plot with the plotMA function where x axis is mean expression("baseMean") and y axis is log2FoldChange
plotMA(Merged_H3K27me3_not_inforMAplot_nocols, ylim=c(-5,5))
How can I get this data frame back into DESeq2 format? and make my MA plot?
Hi Steven
I am using DESeq2 but I extracted the information from "dr" which is the results (dds) I saved this as a csv.
Opened another R session and loaded "dr" where I can have the column with gene name. I changed the header of that column to "gene"
then merged "dr" by "gene" it to my list of genes of interest to make my data frame dim.
So dim at the moment isn't seen as a DESeq2 object data frame.
To use the DESeq plotMA, you need to maintain the original architecture of the dds result object. Try the following in the same R environment as your processed dds object:
Keep in mind your gene names should be your row names, and row names is just another column you can manipulate using
rownames()
.My
genesofInterest
list looks like this:Is there a way to use this instead of the vector your describe?
Yep, assuming row 1 is also in the data and "gene" is the column name, this should work:
If row 1 is not needed, then this should work:
OK so I did
and the problem is that dar
This is odd because there are genes that match in both lists.
Try recopying the second block of code, where I explicitly converted it to character. Sometimes these column types can be tricky and convert to factors.
no still not working well
That is strange. It worked for me on a test dataset from DESeq2 vignette. Did you make sure to recall the
results(dds)
from your analyzeddds
object?What is the output of:
Actually yes it worked. It was my mistake that when I loaded the rdata file that had my list of genes of interest it had a res2 object derived from a .csv file that overwrote over the res2 I needed.
Thanks!