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.