calQval: Calculate q-value of differential abundance of metabolic...

View source: R/calQval.R

calQvalR Documentation

Calculate q-value of differential abundance of metabolic features.

Description

This function uses the MaAsLin2 package for estimating q-value of differential abundance. Multiple fixed and random effects can be specified for fitting the multiple regression model. Default analysis method is "LM". Can be run on multiple cores. metadata_variable and ref (reference group) should be the same as the one specified for effect size calculation.

Usage

calQval(
  se,
  mod.assn,
  metadata_variable = 1,
  fixed_effects = NULL,
  random_effects = NULL,
  reference = NULL,
  output_folder = NULL,
  cores = 1,
  plot_heatmap = TRUE,
  plot_scatter = FALSE,
  heatmap_first_n = 50
)

Arguments

se

SummarizedExperiment object created using Macarron::prepInput().

mod.assn

the output of Macarron::findMacMod().

metadata_variable

name or index of metadata column identifying phenotypes/conditions to be used for differential abundance testing. Default: Column 1 of metadata dataframe Note: metadata_variable must be consistent across ava, q-value and effect-size calculations.

fixed_effects

fixed effects, comma delimited e.g. c("metadata1","metadata2"). Default: all columns in metadata.

random_effects

random effects, comma delimited. Default: NULL.

reference

a reference level/group in each metadata column with more than 3 levels, semi-colon delimited for multiple variables e.g. c("metadata1,ref1";"metadata2,ref2"). Default: alphabetically first phenotype/condition will be used as reference. Note: Reference must be specified for metadata with more than 2 levels.

output_folder

the name of the output folder where all MaAsLin2 results will be written. Default: maaslin2_output

cores

the number of R processes to run in parallel.

plot_heatmap

Maaslin2 option-Generate a heatmap for the significant associations. Default: TRUE

plot_scatter

Maaslin2 option-Generate scatter plots for the significant associations. Default: FALSE

heatmap_first_n

Maaslin2 option-Generate heatmap for top n significant associations. Default: 50

Value

mac.qval q-value of metabolic features in phenotypes of interest.

Examples

prism_abundances = system.file("extdata", "demo_abundances.csv", package="Macarron")
abundances_df = read.csv(file = prism_abundances, row.names = 1)
prism_annotations = system.file("extdata", "demo_annotations.csv", package="Macarron")
annotations_df = read.csv(file = prism_annotations, row.names = 1)
prism_metadata = system.file("extdata", "demo_metadata.csv", package="Macarron")
metadata_df = read.csv(file = prism_metadata, row.names = 1)
met_taxonomy = system.file("extdata", "demo_taxonomy.csv", package="Macarron")
taxonomy_df = read.csv(file = met_taxonomy)
mbx <- Macarron::prepInput(input_abundances = abundances_df,
                            input_annotations = annotations_df,
                            input_metadata = metadata_df)
w <- Macarron::makeDisMat(se = mbx)
modules.assn <- Macarron::findMacMod(se = mbx, 
                                     w = w,
                                     input_taxonomy = taxonomy_df)
mets.qval <- Macarron::calQval(se = mbx,
                               mod.assn = modules.assn)


biobakery/Macarron documentation built on June 29, 2024, 7:58 a.m.