Closed slambrechts closed 3 months ago
Hey @slambrechts thanks for the detailed situation sketch of the bug!
We usually also mainly use the standard Phylum / Class / Order / Family / Genus / Species taxonomic structure, which is what the function refers to as 'standard list'.
At that part of the code, the aggregate_taxa
function is normally checking if the rank_names variable of the tidytacos object, which contains a list of the taxonomic structure can be found in the taxa table. I see you've set that manually (which should do the trick).
Could you perchance have a look at those two to confirm that these are as we expect them to be?
tidy_physeq %>%
remove_empty_samples() %>%
tidytacos::set_rank_names(
rank_names = phyloseq::rank_names(physeq_18SP_no_singletons)
) -> tidy_physeq_test
# check that these are the same (ie both lowercase) and contain "class"
rank_names(tidy_physeq_test)
colnames(tidy_physeq_test$taxa)
If there's no misalignment of the taxonomy labels there, could you provide me with a minimum reproducible example so I can look around and find out what goes wrong here? E.g a very small subset of this data, or generated data in the same structure.
Hi @TheOafidian thank you for your response!
I get:
> rank_names(tidy_physeq)
[1] "Domain" "Supergroup" "Division" "Subdivision" "Class"
[6] "Order" "Family" "Genus" "Species"
> colnames(tidy_physeq$taxa)
[1] "taxon" "taxon_id" "domain" "supergroup" "division"
[6] "subdivision" "class" "order" "family" "genus"
[11] "species"
Changing the code to the following seems to solve it:
tidytacos::set_rank_names(
rank_names = tolower(phyloseq::rank_names(physeq_18SP_no_singletons)
))
Hey Sam, glad to hear you've been able to find how to get around the issue using set_rank_names! The from_phyloseq function in tidytacos should also convert the phyloseq rank names to lowercase when you're adapting a phyloseq object to a tidytacos object!
When I run:
I get:
I think this might be related to the fact that we used the PR2 database for taxonomic assignment, which has an unusual taxonomic structure with 9 levels:
Domain / Supergroup / Division / Subdivision / Class / Order / Family / Genus / Species
Because when I use the above chunk of code for other primersets that were classified using a database with traditional taxonomic structure:
Phylum / Class / Order / Family / Genus / Species
I don't have this problem
In the help file of
tidytacos::aggregate_taxa
I read:But I'm not sure what you mean with the standard list?