joey711 / phyloseq

phyloseq is a set of classes, wrappers, and tools (in R) to make it easier to import, store, and analyze phylogenetic sequencing data; and to reproducibly share that data and analysis with others. See the phyloseq front page:
http://joey711.github.io/phyloseq/
579 stars 188 forks source link

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

Open Gowri1994 opened 2 years ago

Gowri1994 commented 2 years ago

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?

ycl6 commented 2 years ago

Hi @Gowri1994

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

valentinavan commented 2 years ago

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

ycl6 commented 2 years ago

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).

siriusorignblack commented 2 years ago

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.

julipeale2001 commented 1 year ago

phyloseq::tax_table

Worked for me. Thanks

SafiyaYakubu commented 2 months ago

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.