Open raw937 opened 6 years ago
Hello @raw937, thanks for the report! I am traveling right now, so it might be a few days before I can look into this.
Hello @raw937, I am sorry for the delay.
I think the problem is that filter_taxa
is the name of a function in phyloseq
as well as the name of a function in taxa
, so you have to specify that you want the taxa
function using taxa::filter_taxa(...)
.
We are trying to find a solution to this inconvenience.
These warning messages are normal I think:
Warning messages:
1: There is no "taxon_id" column in the data set "3", so there are no taxon IDs.
2: The data set "4" is named, but not named by taxon ids.
because not all the data in a phyloseq object is associated with taxa.
No worries mate. So huh?
x <- parse_phyloseq(GlobalPatterns)
Warning messages:
1: The following 17865 of 19216 input indexes have NA
in their classifications:
1, 2, 4, 5, 6, 7, 8, 9, 10, 11 ... 19207, 19208, 19210, 19211, 19212, 19213, 19214, 19215, 19216
2: There is no "taxon_id" column in the data set "3", so there are no taxon IDs.
3: The data set "4" is named, but not named by taxon ids.
y <- parse_phyloseq(fil_nifH) Warning messages: 1: There is no "taxon_id" column in the data set "3", so there are no taxon IDs. 2: The data set "4" is named, but not named by taxon ids.
heat_tree(y, node_size = n_obs, edge_color = k__archaea, node_label = taxon_names, node_color = n_obs, node_color_range = c("cyan", "magenta", "green"), edge_color_range = c("#555555", "#EEEEEE"), initial_layout = "reingold-tilford", layout = "davidson-harel", overlap_avoidance = 0.5)
Error in eval(x$expr, data, x$env) : object 'k__archaea' not found
heat_tree(filter_taxa(y, name == "k__archaea", subtaxa = TRUE), node_size = n_obs, node_label = name, node_color = n_obs, layout = "fruchterman-reingold")
Error in filter_taxa(y, name == "k__archaea", subtaxa = TRUE) : unused argument (subtaxa = TRUE)
subsetted <- filter_taxa(y, n_supertaxa > 1) Error in access(physeq, "otu_table", TRUE) : otu_table slot is empty.
I can send input data if you would like?
You need to replace filter_taxa
with taxa::filter_taxa
, or load metacoder after phyloseq. You are calling the phyloseq function filter_taxa
on a taxmap
object, which is causing the error . You need the filter_taxa
from the taxa
package, which is loaded when you load metacoder
.
Also, name
needs to be taxon_names
try:
heat_tree(taxa::filter_taxa(y, taxon_names == "k__archaea", subtaxa = TRUE),
node_size = n_obs,
node_label = taxon_names,
node_color = n_obs,
layout = "fruchterman-reingold")
The ::
specifies which package a function comes from. It is only needed when there are multiple functions with the same name from different packages or you want to call a function without loading the package it is in.
Thank you! That produced a tree = neat.
Warning messages: 1: There is no "taxon_id" column in the data set "3", so there are no taxon IDs. 2: The data set "4" is named, but not named by taxon ids. 3: In GA::ga(type = "real-valued", fitness = function(x) optimality_stat(x[1], : 'min' arg is deprecated. Use 'lower' instead. 4: In GA::ga(type = "real-valued", fitness = function(x) optimality_stat(x[1], : 'max' arg is deprecated. Use 'upper' instead.
How would I subset and build trees by sample type or a category in the metadata? Then plot the data in the same plot? I can subselect in phyloseq.
No problem!
All those warnings can be ignored. First two are from the function that parse_phyloseq
uses. I think I will suppress those in a future release, since they are expected most the time. Normally you dont need to put data in a taxmap
object that is not classified by a taxonomy and that is what the warnings are complaining about, but I do it in this case to preserve all the info in phyloseq objects. The second two dont cause a problem and will go away in the next release. They are because a dependency changed recently.
How would I subset and build trees by sample type or a category in the metadata?
There are a few ways. It depends on what you want to plot. Read abundance? Number of OTUs? Number of samples with reads? Comparisons between groups of samples? Using the group
option of functions like calc_taxon_abund
and calc_n_samples
is probably the easiest method. Look through this and let me know if you still have questions:
https://grunwaldlab.github.io/analysis_of_microbiome_community_data_in_r/04--manipulating.html https://grunwaldlab.github.io/analysis_of_microbiome_community_data_in_r/05--plotting.html
Also the examples in the help docs for the functions are useful. type ?calc_taxon_abund
and run the examples at the bottom
Then plot the data in the same plot?
I am not sure what you mean. Multiple trees in the same plot or multiple statistics with the same tree?
Again thank you! I will start here then if I get stuck I will message back.
Closing for now. Let me know if you have other issues
New error -
heat_tree(taxa::filter_taxa(y, taxon_names == "k__archaea", subtaxa = TRUE),
- node_size = n_obs,
- node_label = taxon_names,
- node_color = n_obs,
- layout = "fruchterman-reingold") NULL Warning messages: 1: There is no "taxon_id" column in the data set "3", so there are no taxon IDs. 2: The data set "4" is named, but not named by taxon ids. 3: In heat_tree.default(taxon_id = character(0), supertaxon_id = character(0), : 'taxon_id' and 'supertaxon_id' are empty. Returning NULL.
heat_tree(taxa::filter_taxa(y, taxon_names == "k__archaea", subtaxa = TRUE), node_size = n_obs, node_label = taxon_names, node_color = n_obs, layout = "fruchterman-reingold")
What does taxa::filter_taxa(y, taxon_names == "k__archaea", subtaxa = TRUE)
return? I have a feeling there are no taxa left for some reason.
Ah, your right nothing there! sorry :-(
Hello i created a phyloseq object using qiime2R and used parse_phyloseq command to use metacoder. When i try to create a heatmap i get a similar error
x <- parse_phyloseq(phy)
heat_tree(x, node_size = n_obs, node_color = n_obs, node_label = taxon_ids, tree_label = taxon_ids)
Error: The data set "data" is named, but not named by taxon ids.
Any help will be highly appreciated.
Hi,
Can you send me the phyloseq object with saveRDS
so I can see what is going on?
Thanks!
It was a bug that only happens when you have an object with a table that has columns named by numbers. I fixed it, but you will have to reinstall the taxa
package from Github:
devtools::install_github("ropensci/taxa")
After install, rerun your code and let me know if it is still a problem. Thanks
It worked! Thank you very much for your help.I am very grateful.
On Fri, 17 Apr 2020 at 10:09, Zachary Foster notifications@github.com wrote:
Thanks!
It was a bug that only happens when you have an object with a table that has columns named by numbers. I fixed it, but you will have to reinstall the taxa package from Github:
devtools::install_github("ropensci/taxa")
After install, rerun your code and let me know if it is still a problem. Thanks
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/grunwaldlab/metacoder/issues/243#issuecomment-614978347, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALC5ZNKKDFFXYWEG74456EDRM6T3BANCNFSM4FM3ZJNA .
y <- parse_phyloseq(fil_nifH) Warning messages: 1: There is no "taxon_id" column in the data set "3", so there are no taxon IDs. 2: The data set "4" is named, but not named by taxon ids.
y