Error with filter_taxa

21 views
Skip to first unread message

Neelam Redekar

unread,
May 30, 2018, 4:54:11 PM5/30/18
to metacoder
I am trying to plot heat trees using metacoder package. Being new to this package, I referred to your '2017_09_29--joany--parsing' post on this forum about how to import OTU tables in metacoder. This is what I did,

raw_dataSol = read.table("filtered_otu_table_mc.txt", header = TRUE, fill = TRUE)

dataSol = parse_tax_data(raw_dataSol, class_cols = c("Root", "Class", "Family", "Genus", "Species"))

dataSol$data$taxon_counts <- calc_taxon_abund(dataSol, "tax_data", cols = c("GTF.S1DELTA", "GTF.S2DELTA", "GTF.S3DELTA", "GTF.S4DELTA"))

dataBac <- filter_taxa(dataSol, "Bacteria" , subtaxa = TRUE, supertaxa = FALSE) 

I am getting following error message with the last step

Error: The following taxon IDs do not exist:
 NA

I don't understand why I am getting this error. Am I parsing file right? 


Zachary Foster

unread,
May 30, 2018, 5:29:48 PM5/30/18
to metacoder
Hi Neelam,

I think you want:

dataBac <- filter_taxa(dataSol, taxon_names == "Bacteria" , subtaxa = TRUE, supertaxa = FALSE)

The `filter_taxa` command expects a TRUE/FALSE vector, taxon IDs, or taxon indexes, so it did not know what to do with "Bacteria". Sorry for the unhelpful error message. I will look into making that more understandable. `filter_taxa` is now in the `taxa` package, which you can read about here:


Let me know if you have more questions/problems!

Best,

Zach

Zachary Foster

unread,
May 30, 2018, 5:34:26 PM5/30/18
to metacoder
Interesting, when I try to replicate your error message, I get:

> library(taxa)
> filter_taxa(ex_taxmap, "Bacteria", subtaxa = TRUE, supertaxa = TRUE)


 Error: The following taxon IDs do not exist:
 Bacteria

Do you have the most recent version of `metacoder` and `taxa` installed (0.2.1 for both)?

Zach
Reply all
Reply to author
Forward
0 new messages