Question: Add avgTxLength to DESeqDataSet
0
gravatar for rhart
20 months ago by
rhart0
rhart0 wrote:

I'd like to manually add a vector of transcript sizes to my DDS object.  I tried setting:

dds@assays$data$avgTxLength=data.frame(row.names=txOrder,"avgTxLength"=tlen[txOrder,])

Where txOrder is the row names from the dds data and tlen is the (out of order) transcript list for those row names.  The error I get when I try using fpkm() is "invalid 'dimnames' given for data frame".

How do I add this vector so I can output fpkm?

 

deseq2 fpkm • 1.0k views
ADD COMMENTlink modified 20 months ago • written 20 months ago by rhart0
Answer: Add avgTxLength to DESeqDataSet
1
gravatar for Michael Love
20 months ago by
Michael Love22k
United States
Michael Love22k wrote:

hi,

You say vector, which sounds like you just have a single number per gene. Is that correct? In that case, if you take a look at ?fpkm, the thing to do is just:

mcols(dds)$basepairs <- x

Where x is your vector of gene lengths, lined up with rows of dds.

ADD COMMENTlink written 20 months ago by Michael Love22k

Nope, neither worked. 

I'm working at the transcript level and I have the length for each transcript (calculated with a simple script from the gtf).  So tlen is a data frame with transcript_id's as row names and one column of data labeled "Len".  txOrder is a character array with the transcript_id values used in my dds object (after filtering) in the correct order. 

Replacing "xxx" or "x" in the above examples with tlen[txOrder,] (which produces a numeric vector) still gives the "dimnames" error when I try fpkm().

 

ADD REPLYlink written 20 months ago by rhart0

Can you make a small reproducible example, so I can take a look? Ideally with just simulated data, e.g. makeExampleDESeqDataSet.

ADD REPLYlink written 20 months ago by Michael Love22k

In creating a subset example object, I can now get the mcols(dds)$basepairs<-x method to work.  So now I'll go back and re-create my original dds object--perhaps I screwed it up with my other trial methods.  But thanks--this seems to have solved my problem!

 

ADD REPLYlink written 20 months ago by rhart0
Answer: Add avgTxLength to DESeqDataSet
0
gravatar for Steve Lianoglou
20 months ago by
Denali
Steve Lianoglou12k wrote:

Your DDS is a subclass of a summarizedexperiment. rowData(DDS) Should return you a DataFrame of gene info. So, you should be able to do something like rowData(DDS)$txlength <- xxx

Where xxx is a properly ordered vector of gene lengths

ADD COMMENTlink written 20 months ago by Steve Lianoglou12k
Answer: Add avgTxLength to DESeqDataSet
0
gravatar for rhart
20 months ago by
rhart0
rhart0 wrote:

(deleted)

 

ADD COMMENTlink modified 20 months ago • written 20 months ago by rhart0
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 16.09
Traffic: 111 users visited in the last hour