error with metagenomeSeq newMRexperiment
1
0
Entering edit mode
noelle.noyes ▴ 30
@noellenoyes-7241
Last seen 8.2 years ago
United States

I am receiving an error message with metagenomeSeq that I simply can't figure out:

Error in validObject(.Object) : 

  invalid class “MRexperiment” object: featureNames differ between assayData and featureData

I believe this refers to the features not matching between the count matrix and the taxonomy.  However, I have triple-checked the files, and they do have the same features names, in the same order.  I did some googling, and perhaps came up with a clue, but I am not a savvy R user at all.  The user forum I found indicated that this error message has something to do with using make.names for assayData, but not feature data:

https://stat.ethz.ch/pipermail/bioconductor/2013-November/056100.html

 Here is the code I am using (adapted from the user manual), and I have attached all relevant files:

counts = load_meta("counts.txt", sep = "\t")

pheno = load_phenoData("pheno.txt", sep = "\t", tran=TRUE)

ord = match(colnames(counts$counts), rownames(pheno))

pheno = pheno[ord, ]

head(phono)

taxa = read.delim("taxa.txt", sep = "\t", stringsAsFactors=FALSE)

phenotypeData = AnnotatedDataFrame(pheno)

taxaData = AnnotatedDataFrame(taxa)

AMR = newMRexperiment(counts$counts,phenoData=phenotypeData, featureData=taxaData)

Data from counts.txt:

  Samp1 Samp2 Samp3 Samp4 Samp5 Samp6 Samp7 Samp8 Samp9
(AGly)Aac)-IVa:X01385:244-1029:786 0 0 0 0 0 0 0 0 0
(AGly)AadA1-pm:JQ690540:7968-8798:831 0 0 0 0 0 70 70 0 0
(AGly)AadA1:M95287:3320-4111:792 0 0 0 0 0 0 27 0 0
(AGly)AadA11:AJ567827:1-792:792 0 0 0 0 0 0 0 0 0

 

Data from taxa.txt:

Gene Class Mechanism
(AGly)Aac)-IVa:X01385:244-1029:786 Aminoglycosides Aminoglycoside acetyltransferases
(AGly)AadA1-pm:JQ690540:7968-8798:831 Aminoglycosides Aminoglycoside nucleotidyltransferases
(AGly)AadA1:M95287:3320-4111:792 Aminoglycosides Aminoglycoside nucleotidyltransferases

Hopefully I am not making a very obvious mistake and thus wasting anyone's time with this error! Thank you in advance for your time.

metagenomeSeq error • 2.3k views
ADD COMMENT
1
Entering edit mode
@joseph-nathaniel-paulson-6442
Last seen 7.1 years ago
United States

Hi Noelle,

Thank you for the informative post! Looking at the line reading in the taxa, your taxa data rownames will be 1,2,3,4,..., etc.

Unfortunately, that's not how the count table row names are encoded. If you change reading your taxa in to:

taxa = read.delim("taxa.txt", sep = "\t", stringsAsFactors=FALSE,row.names=1)

it should work. Also, I should mention we support biom-format.

ADD COMMENT

Login before adding your answer.

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