ChiLiubio / microeco

An R package for data analysis in microbial community ecology
GNU General Public License v3.0
181 stars 55 forks source link

question in barplot and data_taxanames #324

Closed CQMUyan closed 4 months ago

CQMUyan commented 4 months ago
          Hello, I have multiple cohorts for which I want to create bar charts. However, I noticed that the top 10 phyla in each cohort are not exactly the same. Therefore, I looked into customizing the order of plotting as you mentioned. But when I specify the phyla for plotting using data_taxanames, the resulting chart only shows "others". This is the erroneous code I used:

t1 <- trans_abund$new(dataset = dataset, taxrank = "Phylum", groupmean = "Group") t1$data_taxanames <- c("Firmicutes", "Proteobacteria", "Actinobacteriota", "Bacteroidota", "Patescibacteria","Fusobacteriota") t1$plot_bar() Could I consult you on this issue? image

Originally posted by @CQMUyan in https://github.com/ChiLiubio/microeco/issues/153#issuecomment-1955824185

ChiLiubio commented 4 months ago

Hi. Please check the names format by the screen output.

t1 <- trans_abund$new(dataset = dataset, taxrank = "Phylum", groupmean = "Group")
t1$data_taxanames

If it is still there, please attach your data so that I can reproduce your issue. To save the dataset object, please follow the steps in the tutorial (https://chiliubio.github.io/microeco_tutorial/notes.html#save-function) and attach the compressed object.

CQMUyan commented 4 months ago

Thank you for your guidance. I have identified the issue; I did not realize that t1$data_taxanames would automatically generate order. I am immensely grateful.