How to get DESeq2 sizefactors from data imported using tximport
1
0
Entering edit mode
stan • 0
@stan-7634
Last seen 22 months ago
South Africa/Pretoria

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 • 2.2k views
ADD COMMENT
4
Entering edit mode
@mikelove
Last seen 3 days ago
United States

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 COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode

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

sf <- estimateSizeFactorsForMatrix(counts(dds) / nm)
ADD REPLY
0
Entering edit mode

Thanks again Michael, it's working fine now.

ADD REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

Thanks very much!

ADD REPLY

Login before adding your answer.

Traffic: 344 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6