Hello,
I’m using MaasLin3, but I can’t seem to adjust my x-axis in the summary plot. Do you think the settings would be similar to those for ggplot? Any help you could offer would be much appreciated. Thanks!
Hi Rafaela,
The functions maaslin_plot_results
and maaslin_plot_results_from_output
(run on your outputs) will return lists of patchwork
objects which themselves contain the ggplot2
objects. If you overwrite the old objects with the edited objects (e.g., by adding + scale_x_continuous(breaks = c(-1, 0, 1))
), the plots will display your modifications.
Will
Hi Will,
When I tried replotting the results, only the individual association plots are stored as a list. The summary plot just gets replotted to the output folder instead of being stored in the list. Am I missing something?
Thanks in advance!
Best wishes,
Gonçalo
replotting code:
scatter_plots <- maaslin_plot_results_from_output(
output = 'output_directory_rv',
metadata = samples_rv_maaslin,
normalization = "NONE",
transform = "LOG",
median_comparison_abundance = F,
max_significance = 0.1,
plot_summary_plot = TRUE,
summary_plot_first_n = 10)
Hmm, I’m not sure just by looking at it. This works for me; do you get the summary plot when you do this?
# Read abundance table
taxa_table_name <- system.file("extdata", "HMP2_taxonomy.tsv", package = "maaslin3")
taxa_table <- read.csv(taxa_table_name, sep = '\t', row.names = 1)
# Read metadata table
metadata_name <- system.file("extdata", "HMP2_metadata.tsv", package = "maaslin3")
metadata <- read.csv(metadata_name, sep = '\t', row.names = 1)
# Factor the categorical variables to test IBD against healthy controls
metadata$diagnosis <-
factor(metadata$diagnosis, levels = c('nonIBD', 'UC', 'CD'))
metadata$dysbiosis_state <-
factor(metadata$dysbiosis_state, levels = c('none', 'dysbiosis_UC', 'dysbiosis_CD'))
metadata$antibiotics <-
factor(metadata$antibiotics, levels = c('No', 'Yes'))
set.seed(1)
fit_out <- maaslin3(input_data = taxa_table,
input_metadata = metadata,
output = 'hmp2_output',
formula = '~ diagnosis + dysbiosis_state +
antibiotics + age + reads',
normalization = 'TSS',
transform = 'LOG',
augment = TRUE,
standardize = TRUE,
max_significance = 0.1,
median_comparison_abundance = TRUE,
median_comparison_prevalence = FALSE,
max_pngs = 250,
cores = 1)
outputs <- maaslin_plot_results_from_output('hmp2_output', metadata = metadata,
normalization = 'TSS', transform = 'LOG')
outputs$summary_plot$final