MicrobiotaProcess
MicrobiotaProcess copied to clipboard
fc.method = "compare_mean" can run but fc.method = "compare_median" can't run
mpse1 %>% mp_cal_abundance(.abundance=Abundance, force=TRUE, relative=FALSE) %>% mp_diff_analysis(.abundance=Abundance, force=TRUE, relative=FALSE, .group=group, filter.p="pvalue",p.adjust = "BH",fc.method = "compare_median")
can't run . mpse1 %>%
- mp_cal_abundance(.abundance=Abundance, force=TRUE, relative=FALSE) %>%
- mp_diff_analysis(.abundance=Abundance, force=TRUE, relative=FALSE, .group=group, filter.p="pvalue",p.adjust = "BH",fc.method = "compare_mean") can . Thanks,But I don't konw Why
and why
is 1000%?
mp_diff_analysis(.abundance=Abundance, force=TRUE, relative=FALSE
means the Abundance
(may be count
in your data) not relative abundance
will be test.
mp_diff_analysis(.abundance=Abundance, force=TRUE, relative=FALSE
means theAbundance
(may becount
in your data) notrelative abundance
will be test.
My data is metaphlan3 data .The Abundance is relative abundance,So I don;t think it is the reason why "fc.method = "compare_median" " can't make sense. Thank you, xiangpin. Could you tell me why? Thanks
Please provide more information, I can not debug for you because you do not provide the reproducible analysis codes and data set. But, first please check the Abundance
of mpse1
is relative abundance. You can just use compare_mean
to identify which abundance of group
is more. The compare_median
will be deprecated in the next version.
mpse1 %>% mp_extract_assays(.abundance=Abundance) %>% colSums() %>% head()
Please provide more information, I can not debug for you because you do not provide the reproducible analysis codes and data set. But, first please check the
Abundance
ofmpse1
is relative abundance. You can just usecompare_mean
to identify which abundance ofgroup
is more. Thecompare_median
will be deprecated in the next version.mpse1 %>% mp_extract_assays(.abundance=Abundance) %>% colSums() %>% head()
C8-7d_remove_host_profile C8-77d_remove_host_profile C8-26d_remove_host_profile C8-175d_remove_host_profile
100.00001 100.00000 100.00001 99.93213
C8-140d_remove_host_profile C8-11d_remove_host_profile
99.91116 100.00000
Thank you! If The compare_median will be deprecated in the next version , I will use the deafult method. How I use the ggdiffbox() function in MPSE object? or how can i use other function to plot the similar plot such as ggdiffbox()? Thanks!
or how can i use other function to plot the similar plot such as ggdiffbox()?
You can use the mp_plot_diff_boxplot
of github
version (remotes::install_github('YuLab-SMU/MicrobiotaProcess')
) to do it
refer to the following codes
library(MicrobiotaProcess)
data(mouse.time.mpse)
mouse.time.mpse %<>%
mp_rrarefy()
mouse.time.mpse
mouse.time.mpse %<>%
mp_diff_analysis(.abundance=RareAbundance,
.group=time,
first.test.alpha=0.01,
action="add")
library(ggplot2)
p1 <- mouse.time.mpse %>%
mp_plot_diff_boxplot(.group = time) %>%
set_diff_boxplot_color(
values = c("deepskyblue", "orange"),
guide = guide_legend(title=NULL)
)
p2 <- mouse.time.mpse %>%
mp_plot_diff_boxplot(
taxa.class = c(Genus, OTU),
group.abun = TRUE,
removeUnknown = TRUE,
) %>%
set_diff_boxplot_color(
values = c("deepskyblue", "orange"),
guide = guide_legend(title=NULL)
)
aplot::plot_list(p1, p2)
or how can i use other function to plot the similar plot such as ggdiffbox()?
You can use the
mp_plot_diff_boxplot
ofgithub
version (remotes::install_github('YuLab-SMU/MicrobiotaProcess')
) to do itrefer to the following codes
library(MicrobiotaProcess) data(mouse.time.mpse) mouse.time.mpse %<>% mp_rrarefy() mouse.time.mpse mouse.time.mpse %<>% mp_diff_analysis(.abundance=RareAbundance, .group=time, first.test.alpha=0.01, action="add") library(ggplot2) p1 <- mouse.time.mpse %>% mp_plot_diff_boxplot(.group = time) %>% set_diff_boxplot_color( values = c("deepskyblue", "orange"), guide = guide_legend(title=NULL) ) p2 <- mouse.time.mpse %>% mp_plot_diff_boxplot( taxa.class = c(Genus, OTU), group.abun = TRUE, removeUnknown = TRUE, ) %>% set_diff_boxplot_color( values = c("deepskyblue", "orange"), guide = guide_legend(title=NULL) ) aplot::plot_list(p1, p2)
Thanks! It works,But How can I get the raw data of mp_plot_diff_boxplot()?