I am looking for some codes for Qiime2R package in R to do:
-Isolate bacteria and archaea domains from each other.
-draw a taxonomy barplot only for phylum rank.
-draw a taxonomy barplot only for family rank.
-keep only major taxa in phylum level.
-keep only major taxa in family level.
Anybody can share the codes with me?
I did not find them by googling and here.
By the way, could you please tell me what is the treatment argument in this page? Or what can I use instead of treatment from my data files?
I believe what you are looking for is described in the github readme as below:
taxonomy<-read_qza("taxonomy.qza")$data %>% parse_taxonomy()
taxa_barplot(taxasums, metadata, "body-site")
ggsave("barplot.pdf", height=4, width=8, device="pdf") # save a PDF 4 inches by 8 inches
The summarize_taxa() function will aggregate the counts based on your taxonomy table and returns a list at each phylogenetic level so you would switch $Phylum for $Genus on the 8th line if that is what you want. If you read the documentation for the barplot (?taxa_barplot), you will see that the category and ntoplot functions allow you to control the grouping (ie the variable to separate the bars by) and the number of major taxons to include in the plot (the rest go into the remainder grouping) respectively.
Thanks, sir. I followed the steps as you mentioned and are in the documentation but I got the error bekwo. I shared the codes plus the error with $Phylum rank. The last code makes an error sadly. I was unable to solve this and I do not know what is the origin of it.
You have made an error on the 4th line when you rewrote the code. Remember that that read_qza() reads the entire artifact including its associated provenance. If you want to extract the ASV table from it you need to add $data like the code in the example.