phyloseq icon indicating copy to clipboard operation
phyloseq copied to clipboard

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘tax_table’ for signature ‘"matrix"’

Open Gowri1994 opened this issue 2 years ago • 6 comments

HI, I have been trying to create "physeq" and encountered the following error while loading the TAX table.

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘tax_table’ for signature ‘matrix'

The code I used is

setwd("/Users/gowri/Desktop/taxonomizr") prepareDatabase('accessionTaxa.sql')

#Test system taxaId<-getId(c('Homo sapiens','Bos taurus','Homo','Alces alces'),'accessionTaxa.sql') print(taxaId)

#TaxiD_table or OTU_table

TaxID=read.table("/Users/gowri/Desktop/rafied_reads.txt", header= T) TaxID1=data.matrix(TaxID)

#Taxonomy_table taxaId2=row.names.data.frame(TaxID) TaxIDtoTaxonomy=getTaxonomy(taxaId2,'accessionTaxa.sql') head(TaxIDtoTaxonomy) write.table(TaxIDtoTaxonomy,"TaxIDtoTaxonomy.txt",sep="\t")

#Sample_table

sample_data=read.table("/Users/gowri/Desktop/grouppp.txt", header= T)

#combine_OTU_data, TAX_data and sample_data OTU = otu_table(TaxID1, taxa_are_rows = TRUE) TAX = tax_table(TaxIDtoTaxonomy)

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘tax_table’ for signature ‘matrix'

Can anyone please help me to resolve this problem?

Gowri1994 avatar Jun 04 '22 06:06 Gowri1994

Hi @Gowri1994

Can you paste what you get when you try str(TaxIDtoTaxonomy) and head(TaxIDtoTaxonomy)

ycl6 avatar Jun 09 '22 17:06 ycl6

Any idea why this is happening? I am having the same issue and I am not sure why because it has always worked so far, using the same script and the same data. It stopped working. Thanks

valentinavan avatar Aug 19 '22 05:08 valentinavan

Hi @valentinavan It's hard to tell without seeing your input data. I can have a look at it if you don't mind sharing the data (or part of the data).

ycl6 avatar Aug 19 '22 20:08 ycl6

i met the same question and i solved it as following: use tax_table as phyloseq::tax_table rather than only tax_table. because in my situation, it seems there exists some conflicts concerning the tax_table function between phyloseq package and microbiotaprocess package. hope this may have some help for your issue.

siriusorignblack avatar Sep 09 '22 11:09 siriusorignblack

phyloseq::tax_table

Worked for me. Thanks

julipeale2001 avatar Aug 28 '23 10:08 julipeale2001

I had the same problem and i solved it by unticking Microbiodataprocess package and microbiome package or not loading them before running the code. They seem to conflict with the tax_table function of phyloseq. Got this hint from siriusorignblack.

SafiyaYakubu avatar Jul 03 '24 11:07 SafiyaYakubu