Maaslin2 handling of covariates

Hi @fquerdasi - one easy way to do that is as follows:

  1. Let’s say you have saved the MaAsLin 2 results in R as follows:
fit_data<-Maaslin2(input_data, input_metadata,...) # Your MaAsLin 2 run
maaslin2_all_results<-fit_data$results # Save results table
  1. Assuming that your primary predictor of interest is named MAIN, you can simply subset the results table as:
library(tidyverse)
maaslin2_results<-maaslin2_all_results %>% filter(metadata == 'MAIN') # Discard covariate associations
  1. Once you have done that, you can simply re-calculate the q-values as follows:
maaslin2_results$qval<-p.adjust(maaslin2_results$pval, method = 'BH') # FDR correction using 'BH'

Hope this helps. Let me know if anything is unclear.

5 Likes