Search
Question: DESeq2 estimateSizeFactors controlGenes return an error
0
gravatar for veljokisand
11 months ago by
veljokisand0 wrote:

Hi,

I tried to find in web first but apparently no right answer:

I run:

dds <- estimateSizeFactors(dds, controlGenes = contGenes)

contGenes is a vector but an error message is "Error in counts[controlGenes, , drop = FALSE] : subscript out of bounds"

contGenes int values are quite high, and since example dds <- estimateSizeFactors(dds, controlGenes = 1:200) works fine I tried

dds <- estimateSizeFactors(dds, controlGenes = contGenes/1000)

and then it is fully OK. Why it is so, I understand this should be abundance of spiked in internal standard, should be this in the same range as real data? Or it is just Ok to put array of percent of spiked reads from the total?

Cheers,

Veljo

 

ADD COMMENTlink modified 11 months ago by Michael Love20k • written 11 months ago by veljokisand0
0
gravatar for Michael Love
11 months ago by
Michael Love20k
United States
Michael Love20k wrote:

"this should be abundance of spiked in internal standard"

controlGenes should specify either names or the numeric or logical indices of the rows of dds (genes) that you want to use for normalization.

If you're not sure about what you should provide as an argument to a function in R, you should always first check the associated help file:

?estimateSizeFactors
ADD COMMENTlink modified 11 months ago • written 11 months ago by Michael Love20k

ThanksMichael!

ok I understood it completely wrong, somehow did not understand that it means matrix index. Just to double check, in genes, matrix my spike in gene is at column 20, I need to specify it as following:

dds <- estimateSizeFactors(dds, controlGenes = 20)

Veljo

 

ADD REPLYlink written 11 months ago by veljokisand0

Yes. Having just one spike in is pretty bad though. You'd typically want many, throwing out a number off the top of my head, like 20 or more.

ADD REPLYlink written 11 months ago by Michael Love20k

Sure, we have 4 for our environmental metatranscriptomes, a bit hard to work with 20 or more in this case, they have to be synthetic.

Still the final question, I did manage to figure out how to use gene names:

dds <- estimateSizeFactors(dds, controlGenes = "spike_gene1") nor

dds <- estimateSizeFactors(dds, controlGenes = spike_gene1) 

and similar do not work...

According to manual, it should logical vector  i.e. c(FALSE, TRUE, FALSE, TRUE, FALSE)?

 

 

 

ADD REPLYlink written 11 months ago by veljokisand0

Can you confirm that "spike_gene1" is in the rownames(dds)? It needs to be or else this syntax won't work.

You can use any kind of index: by name, by number or a logical vector of length nrow(dds).

ADD REPLYlink modified 11 months ago • written 11 months ago by Michael Love20k

Yes, rownames(dds) lists all gene names including "spike_gene1" without any problems...

ADD REPLYlink written 11 months ago by veljokisand0

I'm sorry, I wasn't correct, controlGenes can be either a numeric or a logical. So you can use:

dds <- estimateSizeFactors(dds,
  controlGenes=rownames(dds) %in% c("spike_gene1", ... ))

Where you can put in the rest of the spike in genes where I put "..."

ADD REPLYlink written 11 months ago by Michael Love20k
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 2.2.0
Traffic: 241 users visited in the last hour