Question: How to get DESeq2 sizefactors from data imported using tximport
0
gravatar for stan
2.3 years ago by
stan0
South Africa/Pretoria
stan0 wrote:

Hi,

How can i get sizeFactors from sailfish output imported into DESeq2 using tximport. I got NULL after doing the following:

> txi <- tximport(files, type="sailfish", tx2gene=tx2gene, dropInfReps=TRUE)
> ddsTxi <- DESeqDataSetFromTximport(txi, colData = samples, design = ~ condition)
> estimateSizeFactors(ddsTxi)
using 'avgTxLength' from assays(dds), correcting for library size
class: DESeqDataSet
dim: 39045 5
metadata(1): version
assays(3): counts avgTxLength normalizationFactors
rownames(39045): ENSG00000000003 ENSG00000000419 ... ENSG00000283698 ENSG00000283699
rowData names(0):
colnames(5): sample1 sample2 sample3 sample4 sample5
colData names(1): condition
> sizeFactors(ddsTxi)
NULL

Thanks for the help.

Stan

deseq2 sailfish tximport • 1.2k views
ADD COMMENTlink modified 2.3 years ago by Michael Love25k • written 2.3 years ago by stan0
Answer: How to get DESeq2 sizefactors from data imported using tximport
4
gravatar for Michael Love
2.3 years ago by
Michael Love25k
United States
Michael Love25k wrote:

hi,

DESeq2 uses normalizationFactors when avgTxLength offset is imported with DESeqDataSetFromTximport. This combines size factor normalization with average transcript length normalization. So it's a matrix accessible via:

normalizationFactors(dds)

if you want to see the size factors that were calculated and incorporated with the average transcript lengths, they are these :

nm <- assays(dds)[["avgTxLength"]]
sf <- estimateSizeFactorsForMatrix(counts(dds), normMatrix=nm)
ADD COMMENTlink written 2.3 years ago by Michael Love25k

Thanks a lot Michael, 

I noticed normMatrix argument is not used for the estimateSizeFactorsForMatrix function, so instead would it make sense to calculate the geometric mean of each sample (column) from normalizationFactors(dds), and use that as the size factor for each sample? 

Or should I just get size factors using:

sf <- estimateSizeFactorsForMatrix(counts(dds)) # without the normMatrix argument

Alternatively does it make sense to get size factors using this:

sf  <- estimateSizeFactorsForMatrix(normalizationFactors(dds)) 
# since normalizationFactors(dds) "combines size factor normalization with average transcript length normalization" quoting from you above
ADD REPLYlink modified 2.3 years ago • written 2.3 years ago by stan0

Sorry, you are correct. I have a separate function estimateNormFactors(). The code inside this function is:

sf <- estimateSizeFactorsForMatrix(counts(dds) / nm)
ADD REPLYlink written 2.3 years ago by Michael Love25k

Thanks again Michael, it's working fine now.

ADD REPLYlink written 2.3 years ago by stan0

Hi, Michael,

  I'm confused...as in my case, 

sf1 <- estimateSizeFactorsForMatrix(counts(dds))
sf2  <- estimateSizeFactorsForMatrix(normalizationFactors(dds)) 
sf3 <- estimateSizeFactorsForMatrix(counts(dds) / nm)

Gives me three different results... If I only want to check the size factor, which one should I choose?

ADD REPLYlink written 24 months ago by Raymond0

The last one, this is the one I indicated above. The others are not correct for finding the size factors that were calculated and incorporated into normalization factors. The second has no interpretation. The first is the size factors that would be calculated if we ignored the extra information from tximport.

ADD REPLYlink written 24 months ago by Michael Love25k

Thanks very much!

ADD REPLYlink written 24 months ago by Raymond0
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: 251 users visited in the last hour