metagenomeSeq cumNorm issue with NAs in real data
3
0
Entering edit mode
carr0603 • 0
@carr0603-7614
Last seen 9.0 years ago
United States

Hi I am trying to run the command cumNorm(). 

When I go through the tutorial I get an output and when I run the command on simulated data it works as well. However, when I try to run the command on my real data the output is a bunch of NAs. 

Any suggestions? 

> obj<-newMRexperiment(otu_table_final)
> cumNorm(obj)
MRexperiment (storageMode: environment)
assayData: 57394 features, 255 samples 
  element names: counts 
protocolData: none
phenoData: none
featureData: none
experimentData: use 'experimentData(object)'
Annotation:  
Warning message:
In cumNormStatFast(obj) : Low quantile estimate. Default value being used.
> head(normFactors(obj))
X02.HA.Forehead.375338    X02.HA.Stool.374811 
                    NA                     NA 
X02.HB.Forehead.374920    X02.HB.Stool.375396 
                    NA                     NA 
X02.HC.Forehead.375061    X02.HC.Stool.374906 
                    NA                     NA 

metagenomeseq • 1.9k views
ADD COMMENT
0
Entering edit mode
@joseph-nathaniel-paulson-6442
Last seen 7.0 years ago
United States

Hi there,

The issue you're having is that you need to re-assign the normalized object to itself or another object. If you run the following your code will work.

obj<-newMRexperiment(otu_table_final)
obj = cumNorm(obj)
head(normFactors(obj))

 

ADD COMMENT
0
Entering edit mode
carr0603 • 0
@carr0603-7614
Last seen 9.0 years ago
United States

Thanks for the reply Joseph! I followed your instructions but I am still getting the NA error. The code works when I run it on the lung data or the mouse data and even in a simulated dataset I made. But my dataset has many more 0's. Could this be the issue?

 

> obj<-newMRexperiment(data)

> obj
MRexperiment (storageMode: environment)
assayData: 57393 features, 255 samples 
  element names: counts 
protocolData: none
phenoData: none
featureData: none
experimentData: use 'experimentData(object)'
Annotation:  
> obj = cumNorm(obj)
Warning message:
In cumNormStatFast(obj) : Low quantile estimate. Default value being used.
> head(normFactors(obj))
X02.HA.Forehead.375338    X02.HA.Stool.374811 X02.HB.Forehead.374920 
                    NA                     NA                     NA 
   X02.HB.Stool.375396 X02.HC.Forehead.375061    X02.HC.Stool.374906 
                    NA                     NA                     NA 

ADD COMMENT
0
Entering edit mode

That shouldn't be a problem,

Feel free to send me a MRE (minimally reproducible example) or your dataset privately and I'll take a look at the specific issue for you

ADD REPLY
0
Entering edit mode

Thank you!!

ADD REPLY
0
Entering edit mode

Work for you?

ADD REPLY
0
Entering edit mode
@joseph-nathaniel-paulson-6442
Last seen 7.0 years ago
United States

Hi @carr0603,

Your dataset looks like it was improperly formatted. The matrix you made available to download does have 57393 rows, but a good number of them are all empty (no zeros even) and the rownames are duplicates. I'd take a look at how you generated the count matrix and fix that. In either case, here are the steps to fix this particular dataset. Additionally, it looks like you generated this from a biom file. You can import biom vs1 files using the load_biom function.

y=read.csv("otu_table_final.csv",stringsAsFactors=FALSE)
# Find which ones are NA in your matrix
unique(sapply(1:ncol(y),function(i){which(is.na(y[,i]))[1]}))
y=y[1:8241,]
rownames(y) = y[,1]
y = y[,-1]
obj = newMRexperiment(y)
obj = cumNorm(obj)

> head(normFactors(obj))

X02.HA.Forehead.375338    X02.HA.Stool.374811 X02.HB.Forehead.374920 

                   150                    157                    130 

   X02.HB.Stool.375396 X02.HC.Forehead.375061    X02.HC.Stool.374906 

                   254                    416                    285 

 

You should have ~8k OTUs and 255 samples. 

ADD COMMENT

Login before adding your answer.

Traffic: 807 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