normFactors when aggregating in metagenomeSeq
2
0
Entering edit mode
noelle.noyes ▴ 30
@noellenoyes-7241
Last seen 6.8 years ago
United States

Hello.  I am using metagenomeSeq for a metagenomic dataset.  We are assessing relative abundance of specific genes.  These genes belong to different classes and mechanisms, and therefore we want to conduct this analysis at multiple levels to compare results (much like one would do analysis at species, genus, family levels).  I am using metagenomeSeq's function "aggTax" to aggregate:

AggObj = aggTax(MRcounts(obj, norm=TRUE, log=FALSE),norm=TRUE, log=FALSE, lvl = Class, out = "MRexperiment")

As you can see, I am using the normalized counts for aggregation, as I believe it is standard procedure to normalize at the lowest level.  After I've done this, I need to re-populate the normFactors slot, but I'm not sure what I should re-populate it with, as the libSize values are now the aggregated, normalized counts.  I realize that the normFactors slot is necessary to run fitZig (as a related aside, I am running it with option useCSSoffset=FALSE).  I tried setting p=0 and running cumNorm, but this still resulted in small values populating the normFactors slot, which I don't understand -- does this have something to do with accounting for different processes for creating 0 counts?

I'm not sure where to go from here, and any help would be greatly appreciated!

metagenomeSeq microbiome • 1.6k views
1
Entering edit mode
@joseph-nathaniel-paulson-6442
Last seen 5.7 years ago
United States

Hi Noelle,

Thanks for the message,

So instead of what you posted above to aggregate by normalized counts, you can simply pass the MRexperiment object directly to the aggTax/aggregateByTaxonomy function and with norm=TRUE it will aggregate the values.

AggObj = aggTax(obj,norm=TRUE,lvl=Class)

If you're running useCSSoffset = FALSE then you already have defined your normalization factor within the model matrix, or you wish to input normalized counts, in which case any values in the normFactors slot will work, i.e. just run:

obj = cumNorm(obj,p=1):

However, if you want to force your normFactors to 1, the following will work temporarily - I will modify this post once I fix the aggTax function or create an alternative:

pData(obj@expSummary$expSummary)$normFactors = rep(1,ncol(obj))
1
Entering edit mode
noelle.noyes ▴ 30
@noellenoyes-7241
Last seen 6.8 years ago
United States

Thanks very much for the quick response.  So when I set useCSSoffset = FALSE, is the normFactors slot basically ignored?  This is what I want to do, since I've aggregated the normalized counts anyway.  Thanks again!

0
Entering edit mode

Yes, exactly.