Hi Will,
I am running MaAsLin3 using the following code:
set.seed(1)
fit_out <- maaslin3(input_data = seqtab.nochim,
input_metadata = sample_data,
output = "Ox_vs_time",
formula = "~ time_point + (1|replicate)",
normalization = "TSS",
transform = "LOG",
augment = TRUE,
standardize = TRUE,
small_random_effects = TRUE,
reference = ("time_point,T1"),
max_significance = 0.1,
median_comparison_abundance = TRUE,
median_comparison_prevalence = FALSE,
max_pngs = 25)
and I got the following summary plot:
I would like to know if it is possible to replot the summary figure so the scatter plot shows first time point 2 and later time point 5? Same with the heatmap, I would like to plot time point 2 first then time point 3, time point 4 and finally time point 5, so I can see the results in a chronological way. Is it possible?
Thanks for your help!
Daniel
Yes - if you use coef_plot_vars and heatmap_vars, the order should appear as the vectors you provide to those parameters. Let me know if that doesn’t work like you’re expecting.
Will
Hi Will,
Thanks for your prompt reply. Yes, it worked. The code that I ran was:
# Set coef_plot_vars and heatmap_vars
coef_vars <- c('time_point T2', 'time_point T5')
heat_vars <- c('time_point T2', 'time_point T3','time_point T4', 'time_point T5')
# Running MaAsLin3 for Amended samples only
set.seed(1)
fit_out <- maaslin3(input_data = seqtab.nochim,
input_metadata = sample_data,
output = "Anox_vs_time",
formula = "~ time_point + (1|replicate)",
normalization = "TSS",
transform = "LOG",
augment = TRUE,
standardize = TRUE,
small_random_effects = TRUE,
reference = ("time_point,T1"),
max_significance = 0.1,
median_comparison_abundance = TRUE,
median_comparison_prevalence = FALSE,
max_pngs = 25,
coef_plot_vars = coef_vars,
heatmap_vars = heat_vars)
and it was able to generate the desired figure:
Thanks a lot!
Daniel
Hi again Will,
I just noticed that when generating the summary plots for two conditions (Ox and Hypox), the range of BOTH the Abundance and Prevalence P_FDR differs between them (PLOT 1:Prevalence 0.1-1 Abundance 0.1 -1; Figure 2: Prevalence: 1e-3 - 1, Abundance 1e-3 - 1 )but the colour gradient is the same. Is there a way to set Figure 1 scale from 1e-3 to 1?
I have attached both summary plots for your reference.
Thanks!
Daniel
If you’re referring to the fact that the two scales are different across two different plotting runs, there’s not a direct way to harmonize these in MaAsLin. The plotting output should produce ggplot objects though, and I bet if you give those to Claude/Chat they could write some code to synchronize the scales.
Will
Will is right that MaAsLin doesn’t expose a single shared scale. Since the outputs are ggplot objects, add the same continuous fill/colour scale to both before saving, e.g. scale_fill_continuous(limits = c(1e-3, 1), oob = scales::squish) and scale_colour_continuous(limits = c(1e-3, 1), oob = scales::squish). If the P_FDR colours are log-scaled, add trans = "log10" to both scales. That will put both plots on the same 1e-3–1 range.