ChiLiubio / microeco

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

trans_diff$new with two variables #339

Closed milyzhou closed 3 months ago

milyzhou commented 3 months ago

hi Chi, I have two variables, I want to differential abundance test by two variables, someting like[t1 <- trans_alpha$new(dataset = test, group = "time", by_group = "group")"] I try to use this script, but it didn't work. dataset <- mpa2meco("buglist_clean.tsv", sample_table =metadata1) dataset$tax_table%<>%subset(Kingdom == "kArchaea" | Kingdom == "kBacteria") dataset$tidy_dataset() print(dataset) dataset$sample_sums()%>% range dataset$rarefy_samples(sample.size = 1785861) test <- dataset$merge_taxa(taxa = "Genus") test$tax_table%<>%subset(Genus == "g__Bifidobacterium") test$cal_abund( rel = FALSE) t1 <- trans_diff$new(dataset = dataset, method = "KW_dunn", group = "group",by_group = "time" ,taxa_level = "Genus", filter_thres = 0.001,p_adjust_method = "none") test_data.zip

ChiLiubio commented 3 months ago

Hi. I find the group column is NA. Maybe something goes wrong.

library(microeco)
load("dataset1.RData")
View(dataset$sample_table)
milyzhou commented 3 months ago

oh sorry. I update the data. test_data.zip

ChiLiubio commented 3 months ago

Hi. I find out the reason is all the values in some groups are same. For example, the abundance of g__Colibacter in T12 is 0, leading to the error of kw dunn test. I have fixed it in github. Please reinstall the package from github and try again. Thanks.