This QIIME 2 plugin supports methods for compositional data analysis.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -composition - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
Name | Type | Short Description |
---|---|---|
add-pseudocount | method | Add pseudocount to table. |
ancombc | method | Analysis of Composition of Microbiomes with Bias Correction |
ancom | visualizer | Apply ANCOM to identify features that differ in abundance. |
tabulate | visualizer | View tabular output from ANCOM-BC. |
da-barplot | visualizer | Differential abundance bar plots |
Artifact Classes¶
FeatureData[DifferentialAbundance] |
Formats¶
FrictionlessCSVFileFormat |
DataPackageSchemaFileFormat |
DataLoafPackageDirFmt |
composition add-pseudocount¶
Increment all counts in table by pseudocount.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to which pseudocounts should be added.[required]
Parameters¶
- pseudocount:
Int
The value to add to all counts in the feature table.[default:
1
]
Outputs¶
- composition_table:
FeatureTable[Composition]
The resulting feature table.[required]
composition ancombc¶
Apply Analysis of Compositions of Microbiomes with Bias Correction (ANCOM-BC) to identify features that are differentially abundant across groups.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be used for ANCOM-BC computation.[required]
Parameters¶
- metadata:
Metadata
The sample metadata.[required]
- formula:
Str
How the microbial absolute abundances for each taxon depend on the variables within the
metadata
.[required]- p_adj_method:
Str
%
Choices
('holm', 'hochberg', 'hommel', 'bonferroni', 'BH', 'BY', 'fdr', 'none')
Method to adjust p-values.[default:
'holm'
]- prv_cut:
Float
A numerical fraction between 0-1. Taxa with prevalences less than this value will be excluded from the analysis.[default:
0.1
]- lib_cut:
Int
A numerical threshold for filtering samples based on library sizes. Samples with library sizes less than this value will be excluded from the analysis.[default:
0
]- reference_levels:
List
[
Str
]
Define the reference level(s) to be used for categorical columns found in the
formula
. These categorical factors are dummy coded relative to the reference(s) provided. The syntax is as follows: "column_name::column_value"[optional]- tol:
Float
The iteration convergence tolerance for the E-M algorithm.[default:
1e-05
]- max_iter:
Int
The maximum number of iterations for the E-M algorithm.[default:
100
]- conserve:
Bool
Whether to use a conservative variance estimator for the test statistic. It is recommended if the sample size is small and/or the number of differentially abundant taxa is believed to be large.[default:
False
]- alpha:
Float
Level of significance.[default:
0.05
]
Outputs¶
- differentials:
FeatureData[DifferentialAbundance]
The calculated per-feature differentials.[required]
Examples¶
ancombc_single_formula¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
wget -O 'metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
qiime composition ancombc \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-formula bodysite \
--o-differentials dataloaf.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.composition.actions as composition_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
dataloaf, = composition_actions.ancombc(
table=table,
metadata=metadata_md,
formula='bodysite',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /1 /table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /1 /metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 composition ancombc
tool: - Set "table" to
#: table.qza
- For "metadata":
- Perform the following steps.
- Leave as
Metadata from TSV
- Set "Metadata Source" to
metadata.tsv
- Leave as
- Perform the following steps.
- Set "formula" to
bodysite
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 composition ancombc [...] : differentials.qza
dataloaf.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
composition_actions <- import("qiime2.plugins.composition.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
action_results <- composition_actions$ancombc(
table=table,
metadata=metadata_md,
formula='bodysite',
)
dataloaf <- action_results$differentials
from q2_composition._examples import ancombc_single_formula
ancombc_single_formula(use)
ancombc_multi_formula_with_reference_levels¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
wget -O 'metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
qiime composition ancombc \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-formula 'bodysite + animal' \
--p-reference-levels bodysite::tongue animal::dog \
--o-differentials dataloaf.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.composition.actions as composition_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
dataloaf, = composition_actions.ancombc(
table=table,
metadata=metadata_md,
formula='bodysite + animal',
reference_levels=['bodysite::tongue', 'animal::dog'],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /2 /table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /2 /metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 composition ancombc
tool: - Set "table" to
#: table.qza
- For "metadata":
- Perform the following steps.
- Leave as
Metadata from TSV
- Set "Metadata Source" to
metadata.tsv
- Leave as
- Perform the following steps.
- Set "formula" to
bodysite + animal
- Expand the
additional options
section- For "reference_levels", use the
+ reference_levels
button to add the corresponding values:- Add "element" set to
bodysite::tongue
- Add "element" set to
animal::dog
- Add "element" set to
- For "reference_levels", use the
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 composition ancombc [...] : differentials.qza
dataloaf.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
composition_actions <- import("qiime2.plugins.composition.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
action_results <- composition_actions$ancombc(
table=table,
metadata=metadata_md,
formula='bodysite + animal',
reference_levels=list('bodysite::tongue', 'animal::dog'),
)
dataloaf <- action_results$differentials
from q2_composition._examples import ancombc_multi_formula_with_reference_levels
ancombc_multi_formula_with_reference_levels(use)
composition ancom¶
Apply Analysis of Composition of Microbiomes (ANCOM) to identify features that are differentially abundant across groups.
Citations¶
Inputs¶
- table:
FeatureTable[Composition]
The feature table to be used for ANCOM computation.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
The categorical sample metadata column to test for differential abundance across.[required]
- transform_function:
Str
%
Choices
('sqrt', 'log', 'clr')
The method applied to transform feature values before generating volcano plots.[default:
'clr'
]- difference_function:
Str
%
Choices
('mean_difference', 'f_statistic')
The method applied to visualize fold difference in feature abundances across groups for volcano plots.[optional]
- filter_missing:
Bool
If True, samples with missing metadata values will be filtered from the table prior to analysis. If False, an error will be raised if there are any missing metadata values.[default:
False
]
Outputs¶
- visualization:
Visualization
<no description>[required]
composition tabulate¶
Generate tabular view of ANCOM-BC output, which includes per-page views for the log-fold change (lfc), standard error (se), P values, Q values, and W scores.
Inputs¶
- data:
FeatureData[DifferentialAbundance]
The ANCOM-BC output to be tabulated.[required]
Outputs¶
- visualization:
Visualization
<no description>[required]
composition da-barplot¶
Generate bar plot views of ANCOM-BC output. One plot will be present per column in the ANCOM-BC output. The significance_threshold
, effect_size_threshold
and feature_ids
filter results are intersected, such that only features that remain after all three filters have been applied will be present in the output.
Inputs¶
- data:
FeatureData[DifferentialAbundance]
The ANCOM-BC output to be plotted.[required]
Parameters¶
- effect_size_label:
Str
Label for effect sizes in
data
.[default:'lfc'
]- feature_id_label:
Str
Label for feature ids in
data
.[default:'id'
]- error_label:
Str
Label for effect size errors in
data
.[default:'se'
]- significance_label:
Str
Label for statistical significance level in
data
.[default:'q_val'
]- significance_threshold:
Float
%
Range
(0.0, 1.0, inclusive_end=True)
Exclude features with statistical significance level greater (i.e., less significant) than this threshold.[default:
1.0
]- effect_size_threshold:
Float
%
Range
(0.0, None)
Exclude features with an absolute value of effect size less than this threshold.[default:
0.0
]- feature_ids:
Metadata
Exclude features if their ids are not included in this index.[optional]
- level_delimiter:
Str
If feature ids encode hierarchical information, split the levels when generating feature labels in the visualization using this delimiter.[optional]
- label_limit:
Int
Set the maximum length that will be viewable for axis labels. You can set this parameter if your axis labels are being cut off.[optional]
Outputs¶
- visualization:
Visualization
<no description>[required]
This QIIME 2 plugin supports methods for compositional data analysis.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -composition - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
Name | Type | Short Description |
---|---|---|
add-pseudocount | method | Add pseudocount to table. |
ancombc | method | Analysis of Composition of Microbiomes with Bias Correction |
ancom | visualizer | Apply ANCOM to identify features that differ in abundance. |
tabulate | visualizer | View tabular output from ANCOM-BC. |
da-barplot | visualizer | Differential abundance bar plots |
Artifact Classes¶
FeatureData[DifferentialAbundance] |
Formats¶
FrictionlessCSVFileFormat |
DataPackageSchemaFileFormat |
DataLoafPackageDirFmt |
composition add-pseudocount¶
Increment all counts in table by pseudocount.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to which pseudocounts should be added.[required]
Parameters¶
- pseudocount:
Int
The value to add to all counts in the feature table.[default:
1
]
Outputs¶
- composition_table:
FeatureTable[Composition]
The resulting feature table.[required]
composition ancombc¶
Apply Analysis of Compositions of Microbiomes with Bias Correction (ANCOM-BC) to identify features that are differentially abundant across groups.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be used for ANCOM-BC computation.[required]
Parameters¶
- metadata:
Metadata
The sample metadata.[required]
- formula:
Str
How the microbial absolute abundances for each taxon depend on the variables within the
metadata
.[required]- p_adj_method:
Str
%
Choices
('holm', 'hochberg', 'hommel', 'bonferroni', 'BH', 'BY', 'fdr', 'none')
Method to adjust p-values.[default:
'holm'
]- prv_cut:
Float
A numerical fraction between 0-1. Taxa with prevalences less than this value will be excluded from the analysis.[default:
0.1
]- lib_cut:
Int
A numerical threshold for filtering samples based on library sizes. Samples with library sizes less than this value will be excluded from the analysis.[default:
0
]- reference_levels:
List
[
Str
]
Define the reference level(s) to be used for categorical columns found in the
formula
. These categorical factors are dummy coded relative to the reference(s) provided. The syntax is as follows: "column_name::column_value"[optional]- tol:
Float
The iteration convergence tolerance for the E-M algorithm.[default:
1e-05
]- max_iter:
Int
The maximum number of iterations for the E-M algorithm.[default:
100
]- conserve:
Bool
Whether to use a conservative variance estimator for the test statistic. It is recommended if the sample size is small and/or the number of differentially abundant taxa is believed to be large.[default:
False
]- alpha:
Float
Level of significance.[default:
0.05
]
Outputs¶
- differentials:
FeatureData[DifferentialAbundance]
The calculated per-feature differentials.[required]
Examples¶
ancombc_single_formula¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
wget -O 'metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
qiime composition ancombc \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-formula bodysite \
--o-differentials dataloaf.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.composition.actions as composition_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
dataloaf, = composition_actions.ancombc(
table=table,
metadata=metadata_md,
formula='bodysite',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /1 /table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /1 /metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 composition ancombc
tool: - Set "table" to
#: table.qza
- For "metadata":
- Perform the following steps.
- Leave as
Metadata from TSV
- Set "Metadata Source" to
metadata.tsv
- Leave as
- Perform the following steps.
- Set "formula" to
bodysite
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 composition ancombc [...] : differentials.qza
dataloaf.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
composition_actions <- import("qiime2.plugins.composition.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
action_results <- composition_actions$ancombc(
table=table,
metadata=metadata_md,
formula='bodysite',
)
dataloaf <- action_results$differentials
from q2_composition._examples import ancombc_single_formula
ancombc_single_formula(use)
ancombc_multi_formula_with_reference_levels¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
wget -O 'metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
qiime composition ancombc \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-formula 'bodysite + animal' \
--p-reference-levels bodysite::tongue animal::dog \
--o-differentials dataloaf.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.composition.actions as composition_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
dataloaf, = composition_actions.ancombc(
table=table,
metadata=metadata_md,
formula='bodysite + animal',
reference_levels=['bodysite::tongue', 'animal::dog'],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /2 /table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /2 /metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 composition ancombc
tool: - Set "table" to
#: table.qza
- For "metadata":
- Perform the following steps.
- Leave as
Metadata from TSV
- Set "Metadata Source" to
metadata.tsv
- Leave as
- Perform the following steps.
- Set "formula" to
bodysite + animal
- Expand the
additional options
section- For "reference_levels", use the
+ reference_levels
button to add the corresponding values:- Add "element" set to
bodysite::tongue
- Add "element" set to
animal::dog
- Add "element" set to
- For "reference_levels", use the
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 composition ancombc [...] : differentials.qza
dataloaf.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
composition_actions <- import("qiime2.plugins.composition.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
action_results <- composition_actions$ancombc(
table=table,
metadata=metadata_md,
formula='bodysite + animal',
reference_levels=list('bodysite::tongue', 'animal::dog'),
)
dataloaf <- action_results$differentials
from q2_composition._examples import ancombc_multi_formula_with_reference_levels
ancombc_multi_formula_with_reference_levels(use)
composition ancom¶
Apply Analysis of Composition of Microbiomes (ANCOM) to identify features that are differentially abundant across groups.
Citations¶
Inputs¶
- table:
FeatureTable[Composition]
The feature table to be used for ANCOM computation.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
The categorical sample metadata column to test for differential abundance across.[required]
- transform_function:
Str
%
Choices
('sqrt', 'log', 'clr')
The method applied to transform feature values before generating volcano plots.[default:
'clr'
]- difference_function:
Str
%
Choices
('mean_difference', 'f_statistic')
The method applied to visualize fold difference in feature abundances across groups for volcano plots.[optional]
- filter_missing:
Bool
If True, samples with missing metadata values will be filtered from the table prior to analysis. If False, an error will be raised if there are any missing metadata values.[default:
False
]
Outputs¶
- visualization:
Visualization
<no description>[required]
composition tabulate¶
Generate tabular view of ANCOM-BC output, which includes per-page views for the log-fold change (lfc), standard error (se), P values, Q values, and W scores.
Inputs¶
- data:
FeatureData[DifferentialAbundance]
The ANCOM-BC output to be tabulated.[required]
Outputs¶
- visualization:
Visualization
<no description>[required]
composition da-barplot¶
Generate bar plot views of ANCOM-BC output. One plot will be present per column in the ANCOM-BC output. The significance_threshold
, effect_size_threshold
and feature_ids
filter results are intersected, such that only features that remain after all three filters have been applied will be present in the output.
Inputs¶
- data:
FeatureData[DifferentialAbundance]
The ANCOM-BC output to be plotted.[required]
Parameters¶
- effect_size_label:
Str
Label for effect sizes in
data
.[default:'lfc'
]- feature_id_label:
Str
Label for feature ids in
data
.[default:'id'
]- error_label:
Str
Label for effect size errors in
data
.[default:'se'
]- significance_label:
Str
Label for statistical significance level in
data
.[default:'q_val'
]- significance_threshold:
Float
%
Range
(0.0, 1.0, inclusive_end=True)
Exclude features with statistical significance level greater (i.e., less significant) than this threshold.[default:
1.0
]- effect_size_threshold:
Float
%
Range
(0.0, None)
Exclude features with an absolute value of effect size less than this threshold.[default:
0.0
]- feature_ids:
Metadata
Exclude features if their ids are not included in this index.[optional]
- level_delimiter:
Str
If feature ids encode hierarchical information, split the levels when generating feature labels in the visualization using this delimiter.[optional]
- label_limit:
Int
Set the maximum length that will be viewable for axis labels. You can set this parameter if your axis labels are being cut off.[optional]
Outputs¶
- visualization:
Visualization
<no description>[required]
This QIIME 2 plugin supports methods for compositional data analysis.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -composition - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
Name | Type | Short Description |
---|---|---|
add-pseudocount | method | Add pseudocount to table. |
ancombc | method | Analysis of Composition of Microbiomes with Bias Correction |
ancom | visualizer | Apply ANCOM to identify features that differ in abundance. |
tabulate | visualizer | View tabular output from ANCOM-BC. |
da-barplot | visualizer | Differential abundance bar plots |
Artifact Classes¶
FeatureData[DifferentialAbundance] |
Formats¶
FrictionlessCSVFileFormat |
DataPackageSchemaFileFormat |
DataLoafPackageDirFmt |
composition add-pseudocount¶
Increment all counts in table by pseudocount.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to which pseudocounts should be added.[required]
Parameters¶
- pseudocount:
Int
The value to add to all counts in the feature table.[default:
1
]
Outputs¶
- composition_table:
FeatureTable[Composition]
The resulting feature table.[required]
composition ancombc¶
Apply Analysis of Compositions of Microbiomes with Bias Correction (ANCOM-BC) to identify features that are differentially abundant across groups.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be used for ANCOM-BC computation.[required]
Parameters¶
- metadata:
Metadata
The sample metadata.[required]
- formula:
Str
How the microbial absolute abundances for each taxon depend on the variables within the
metadata
.[required]- p_adj_method:
Str
%
Choices
('holm', 'hochberg', 'hommel', 'bonferroni', 'BH', 'BY', 'fdr', 'none')
Method to adjust p-values.[default:
'holm'
]- prv_cut:
Float
A numerical fraction between 0-1. Taxa with prevalences less than this value will be excluded from the analysis.[default:
0.1
]- lib_cut:
Int
A numerical threshold for filtering samples based on library sizes. Samples with library sizes less than this value will be excluded from the analysis.[default:
0
]- reference_levels:
List
[
Str
]
Define the reference level(s) to be used for categorical columns found in the
formula
. These categorical factors are dummy coded relative to the reference(s) provided. The syntax is as follows: "column_name::column_value"[optional]- tol:
Float
The iteration convergence tolerance for the E-M algorithm.[default:
1e-05
]- max_iter:
Int
The maximum number of iterations for the E-M algorithm.[default:
100
]- conserve:
Bool
Whether to use a conservative variance estimator for the test statistic. It is recommended if the sample size is small and/or the number of differentially abundant taxa is believed to be large.[default:
False
]- alpha:
Float
Level of significance.[default:
0.05
]
Outputs¶
- differentials:
FeatureData[DifferentialAbundance]
The calculated per-feature differentials.[required]
Examples¶
ancombc_single_formula¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
wget -O 'metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
qiime composition ancombc \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-formula bodysite \
--o-differentials dataloaf.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.composition.actions as composition_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
dataloaf, = composition_actions.ancombc(
table=table,
metadata=metadata_md,
formula='bodysite',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /1 /table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /1 /metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 composition ancombc
tool: - Set "table" to
#: table.qza
- For "metadata":
- Perform the following steps.
- Leave as
Metadata from TSV
- Set "Metadata Source" to
metadata.tsv
- Leave as
- Perform the following steps.
- Set "formula" to
bodysite
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 composition ancombc [...] : differentials.qza
dataloaf.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
composition_actions <- import("qiime2.plugins.composition.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
action_results <- composition_actions$ancombc(
table=table,
metadata=metadata_md,
formula='bodysite',
)
dataloaf <- action_results$differentials
from q2_composition._examples import ancombc_single_formula
ancombc_single_formula(use)
ancombc_multi_formula_with_reference_levels¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
wget -O 'metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
qiime composition ancombc \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-formula 'bodysite + animal' \
--p-reference-levels bodysite::tongue animal::dog \
--o-differentials dataloaf.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.composition.actions as composition_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
dataloaf, = composition_actions.ancombc(
table=table,
metadata=metadata_md,
formula='bodysite + animal',
reference_levels=['bodysite::tongue', 'animal::dog'],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /2 /table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /2 /metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 composition ancombc
tool: - Set "table" to
#: table.qza
- For "metadata":
- Perform the following steps.
- Leave as
Metadata from TSV
- Set "Metadata Source" to
metadata.tsv
- Leave as
- Perform the following steps.
- Set "formula" to
bodysite + animal
- Expand the
additional options
section- For "reference_levels", use the
+ reference_levels
button to add the corresponding values:- Add "element" set to
bodysite::tongue
- Add "element" set to
animal::dog
- Add "element" set to
- For "reference_levels", use the
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 composition ancombc [...] : differentials.qza
dataloaf.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
composition_actions <- import("qiime2.plugins.composition.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
action_results <- composition_actions$ancombc(
table=table,
metadata=metadata_md,
formula='bodysite + animal',
reference_levels=list('bodysite::tongue', 'animal::dog'),
)
dataloaf <- action_results$differentials
from q2_composition._examples import ancombc_multi_formula_with_reference_levels
ancombc_multi_formula_with_reference_levels(use)
composition ancom¶
Apply Analysis of Composition of Microbiomes (ANCOM) to identify features that are differentially abundant across groups.
Citations¶
Inputs¶
- table:
FeatureTable[Composition]
The feature table to be used for ANCOM computation.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
The categorical sample metadata column to test for differential abundance across.[required]
- transform_function:
Str
%
Choices
('sqrt', 'log', 'clr')
The method applied to transform feature values before generating volcano plots.[default:
'clr'
]- difference_function:
Str
%
Choices
('mean_difference', 'f_statistic')
The method applied to visualize fold difference in feature abundances across groups for volcano plots.[optional]
- filter_missing:
Bool
If True, samples with missing metadata values will be filtered from the table prior to analysis. If False, an error will be raised if there are any missing metadata values.[default:
False
]
Outputs¶
- visualization:
Visualization
<no description>[required]
composition tabulate¶
Generate tabular view of ANCOM-BC output, which includes per-page views for the log-fold change (lfc), standard error (se), P values, Q values, and W scores.
Inputs¶
- data:
FeatureData[DifferentialAbundance]
The ANCOM-BC output to be tabulated.[required]
Outputs¶
- visualization:
Visualization
<no description>[required]
composition da-barplot¶
Generate bar plot views of ANCOM-BC output. One plot will be present per column in the ANCOM-BC output. The significance_threshold
, effect_size_threshold
and feature_ids
filter results are intersected, such that only features that remain after all three filters have been applied will be present in the output.
Inputs¶
- data:
FeatureData[DifferentialAbundance]
The ANCOM-BC output to be plotted.[required]
Parameters¶
- effect_size_label:
Str
Label for effect sizes in
data
.[default:'lfc'
]- feature_id_label:
Str
Label for feature ids in
data
.[default:'id'
]- error_label:
Str
Label for effect size errors in
data
.[default:'se'
]- significance_label:
Str
Label for statistical significance level in
data
.[default:'q_val'
]- significance_threshold:
Float
%
Range
(0.0, 1.0, inclusive_end=True)
Exclude features with statistical significance level greater (i.e., less significant) than this threshold.[default:
1.0
]- effect_size_threshold:
Float
%
Range
(0.0, None)
Exclude features with an absolute value of effect size less than this threshold.[default:
0.0
]- feature_ids:
Metadata
Exclude features if their ids are not included in this index.[optional]
- level_delimiter:
Str
If feature ids encode hierarchical information, split the levels when generating feature labels in the visualization using this delimiter.[optional]
- label_limit:
Int
Set the maximum length that will be viewable for axis labels. You can set this parameter if your axis labels are being cut off.[optional]
Outputs¶
- visualization:
Visualization
<no description>[required]
This QIIME 2 plugin supports methods for compositional data analysis.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -composition - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
Name | Type | Short Description |
---|---|---|
add-pseudocount | method | Add pseudocount to table. |
ancombc | method | Analysis of Composition of Microbiomes with Bias Correction |
ancom | visualizer | Apply ANCOM to identify features that differ in abundance. |
tabulate | visualizer | View tabular output from ANCOM-BC. |
da-barplot | visualizer | Differential abundance bar plots |
Artifact Classes¶
FeatureData[DifferentialAbundance] |
Formats¶
FrictionlessCSVFileFormat |
DataPackageSchemaFileFormat |
DataLoafPackageDirFmt |
composition add-pseudocount¶
Increment all counts in table by pseudocount.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to which pseudocounts should be added.[required]
Parameters¶
- pseudocount:
Int
The value to add to all counts in the feature table.[default:
1
]
Outputs¶
- composition_table:
FeatureTable[Composition]
The resulting feature table.[required]
composition ancombc¶
Apply Analysis of Compositions of Microbiomes with Bias Correction (ANCOM-BC) to identify features that are differentially abundant across groups.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be used for ANCOM-BC computation.[required]
Parameters¶
- metadata:
Metadata
The sample metadata.[required]
- formula:
Str
How the microbial absolute abundances for each taxon depend on the variables within the
metadata
.[required]- p_adj_method:
Str
%
Choices
('holm', 'hochberg', 'hommel', 'bonferroni', 'BH', 'BY', 'fdr', 'none')
Method to adjust p-values.[default:
'holm'
]- prv_cut:
Float
A numerical fraction between 0-1. Taxa with prevalences less than this value will be excluded from the analysis.[default:
0.1
]- lib_cut:
Int
A numerical threshold for filtering samples based on library sizes. Samples with library sizes less than this value will be excluded from the analysis.[default:
0
]- reference_levels:
List
[
Str
]
Define the reference level(s) to be used for categorical columns found in the
formula
. These categorical factors are dummy coded relative to the reference(s) provided. The syntax is as follows: "column_name::column_value"[optional]- tol:
Float
The iteration convergence tolerance for the E-M algorithm.[default:
1e-05
]- max_iter:
Int
The maximum number of iterations for the E-M algorithm.[default:
100
]- conserve:
Bool
Whether to use a conservative variance estimator for the test statistic. It is recommended if the sample size is small and/or the number of differentially abundant taxa is believed to be large.[default:
False
]- alpha:
Float
Level of significance.[default:
0.05
]
Outputs¶
- differentials:
FeatureData[DifferentialAbundance]
The calculated per-feature differentials.[required]
Examples¶
ancombc_single_formula¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
wget -O 'metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
qiime composition ancombc \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-formula bodysite \
--o-differentials dataloaf.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.composition.actions as composition_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
dataloaf, = composition_actions.ancombc(
table=table,
metadata=metadata_md,
formula='bodysite',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /1 /table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /1 /metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 composition ancombc
tool: - Set "table" to
#: table.qza
- For "metadata":
- Perform the following steps.
- Leave as
Metadata from TSV
- Set "Metadata Source" to
metadata.tsv
- Leave as
- Perform the following steps.
- Set "formula" to
bodysite
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 composition ancombc [...] : differentials.qza
dataloaf.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
composition_actions <- import("qiime2.plugins.composition.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
action_results <- composition_actions$ancombc(
table=table,
metadata=metadata_md,
formula='bodysite',
)
dataloaf <- action_results$differentials
from q2_composition._examples import ancombc_single_formula
ancombc_single_formula(use)
ancombc_multi_formula_with_reference_levels¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
wget -O 'metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
qiime composition ancombc \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-formula 'bodysite + animal' \
--p-reference-levels bodysite::tongue animal::dog \
--o-differentials dataloaf.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.composition.actions as composition_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
dataloaf, = composition_actions.ancombc(
table=table,
metadata=metadata_md,
formula='bodysite + animal',
reference_levels=['bodysite::tongue', 'animal::dog'],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /2 /table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /2 /metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 composition ancombc
tool: - Set "table" to
#: table.qza
- For "metadata":
- Perform the following steps.
- Leave as
Metadata from TSV
- Set "Metadata Source" to
metadata.tsv
- Leave as
- Perform the following steps.
- Set "formula" to
bodysite + animal
- Expand the
additional options
section- For "reference_levels", use the
+ reference_levels
button to add the corresponding values:- Add "element" set to
bodysite::tongue
- Add "element" set to
animal::dog
- Add "element" set to
- For "reference_levels", use the
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 composition ancombc [...] : differentials.qza
dataloaf.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
composition_actions <- import("qiime2.plugins.composition.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
action_results <- composition_actions$ancombc(
table=table,
metadata=metadata_md,
formula='bodysite + animal',
reference_levels=list('bodysite::tongue', 'animal::dog'),
)
dataloaf <- action_results$differentials
from q2_composition._examples import ancombc_multi_formula_with_reference_levels
ancombc_multi_formula_with_reference_levels(use)
composition ancom¶
Apply Analysis of Composition of Microbiomes (ANCOM) to identify features that are differentially abundant across groups.
Citations¶
Inputs¶
- table:
FeatureTable[Composition]
The feature table to be used for ANCOM computation.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
The categorical sample metadata column to test for differential abundance across.[required]
- transform_function:
Str
%
Choices
('sqrt', 'log', 'clr')
The method applied to transform feature values before generating volcano plots.[default:
'clr'
]- difference_function:
Str
%
Choices
('mean_difference', 'f_statistic')
The method applied to visualize fold difference in feature abundances across groups for volcano plots.[optional]
- filter_missing:
Bool
If True, samples with missing metadata values will be filtered from the table prior to analysis. If False, an error will be raised if there are any missing metadata values.[default:
False
]
Outputs¶
- visualization:
Visualization
<no description>[required]
composition tabulate¶
Generate tabular view of ANCOM-BC output, which includes per-page views for the log-fold change (lfc), standard error (se), P values, Q values, and W scores.
Inputs¶
- data:
FeatureData[DifferentialAbundance]
The ANCOM-BC output to be tabulated.[required]
Outputs¶
- visualization:
Visualization
<no description>[required]
composition da-barplot¶
Generate bar plot views of ANCOM-BC output. One plot will be present per column in the ANCOM-BC output. The significance_threshold
, effect_size_threshold
and feature_ids
filter results are intersected, such that only features that remain after all three filters have been applied will be present in the output.
Inputs¶
- data:
FeatureData[DifferentialAbundance]
The ANCOM-BC output to be plotted.[required]
Parameters¶
- effect_size_label:
Str
Label for effect sizes in
data
.[default:'lfc'
]- feature_id_label:
Str
Label for feature ids in
data
.[default:'id'
]- error_label:
Str
Label for effect size errors in
data
.[default:'se'
]- significance_label:
Str
Label for statistical significance level in
data
.[default:'q_val'
]- significance_threshold:
Float
%
Range
(0.0, 1.0, inclusive_end=True)
Exclude features with statistical significance level greater (i.e., less significant) than this threshold.[default:
1.0
]- effect_size_threshold:
Float
%
Range
(0.0, None)
Exclude features with an absolute value of effect size less than this threshold.[default:
0.0
]- feature_ids:
Metadata
Exclude features if their ids are not included in this index.[optional]
- level_delimiter:
Str
If feature ids encode hierarchical information, split the levels when generating feature labels in the visualization using this delimiter.[optional]
- label_limit:
Int
Set the maximum length that will be viewable for axis labels. You can set this parameter if your axis labels are being cut off.[optional]
Outputs¶
- visualization:
Visualization
<no description>[required]
This QIIME 2 plugin supports methods for compositional data analysis.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -composition - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
Name | Type | Short Description |
---|---|---|
add-pseudocount | method | Add pseudocount to table. |
ancombc | method | Analysis of Composition of Microbiomes with Bias Correction |
ancom | visualizer | Apply ANCOM to identify features that differ in abundance. |
tabulate | visualizer | View tabular output from ANCOM-BC. |
da-barplot | visualizer | Differential abundance bar plots |
Artifact Classes¶
FeatureData[DifferentialAbundance] |
Formats¶
FrictionlessCSVFileFormat |
DataPackageSchemaFileFormat |
DataLoafPackageDirFmt |
composition add-pseudocount¶
Increment all counts in table by pseudocount.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to which pseudocounts should be added.[required]
Parameters¶
- pseudocount:
Int
The value to add to all counts in the feature table.[default:
1
]
Outputs¶
- composition_table:
FeatureTable[Composition]
The resulting feature table.[required]
composition ancombc¶
Apply Analysis of Compositions of Microbiomes with Bias Correction (ANCOM-BC) to identify features that are differentially abundant across groups.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be used for ANCOM-BC computation.[required]
Parameters¶
- metadata:
Metadata
The sample metadata.[required]
- formula:
Str
How the microbial absolute abundances for each taxon depend on the variables within the
metadata
.[required]- p_adj_method:
Str
%
Choices
('holm', 'hochberg', 'hommel', 'bonferroni', 'BH', 'BY', 'fdr', 'none')
Method to adjust p-values.[default:
'holm'
]- prv_cut:
Float
A numerical fraction between 0-1. Taxa with prevalences less than this value will be excluded from the analysis.[default:
0.1
]- lib_cut:
Int
A numerical threshold for filtering samples based on library sizes. Samples with library sizes less than this value will be excluded from the analysis.[default:
0
]- reference_levels:
List
[
Str
]
Define the reference level(s) to be used for categorical columns found in the
formula
. These categorical factors are dummy coded relative to the reference(s) provided. The syntax is as follows: "column_name::column_value"[optional]- tol:
Float
The iteration convergence tolerance for the E-M algorithm.[default:
1e-05
]- max_iter:
Int
The maximum number of iterations for the E-M algorithm.[default:
100
]- conserve:
Bool
Whether to use a conservative variance estimator for the test statistic. It is recommended if the sample size is small and/or the number of differentially abundant taxa is believed to be large.[default:
False
]- alpha:
Float
Level of significance.[default:
0.05
]
Outputs¶
- differentials:
FeatureData[DifferentialAbundance]
The calculated per-feature differentials.[required]
Examples¶
ancombc_single_formula¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
wget -O 'metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
qiime composition ancombc \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-formula bodysite \
--o-differentials dataloaf.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.composition.actions as composition_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
dataloaf, = composition_actions.ancombc(
table=table,
metadata=metadata_md,
formula='bodysite',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /1 /table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /1 /metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 composition ancombc
tool: - Set "table" to
#: table.qza
- For "metadata":
- Perform the following steps.
- Leave as
Metadata from TSV
- Set "Metadata Source" to
metadata.tsv
- Leave as
- Perform the following steps.
- Set "formula" to
bodysite
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 composition ancombc [...] : differentials.qza
dataloaf.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
composition_actions <- import("qiime2.plugins.composition.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
action_results <- composition_actions$ancombc(
table=table,
metadata=metadata_md,
formula='bodysite',
)
dataloaf <- action_results$differentials
from q2_composition._examples import ancombc_single_formula
ancombc_single_formula(use)
ancombc_multi_formula_with_reference_levels¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
wget -O 'metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
qiime composition ancombc \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-formula 'bodysite + animal' \
--p-reference-levels bodysite::tongue animal::dog \
--o-differentials dataloaf.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.composition.actions as composition_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
dataloaf, = composition_actions.ancombc(
table=table,
metadata=metadata_md,
formula='bodysite + animal',
reference_levels=['bodysite::tongue', 'animal::dog'],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /2 /table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /2 /metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 composition ancombc
tool: - Set "table" to
#: table.qza
- For "metadata":
- Perform the following steps.
- Leave as
Metadata from TSV
- Set "Metadata Source" to
metadata.tsv
- Leave as
- Perform the following steps.
- Set "formula" to
bodysite + animal
- Expand the
additional options
section- For "reference_levels", use the
+ reference_levels
button to add the corresponding values:- Add "element" set to
bodysite::tongue
- Add "element" set to
animal::dog
- Add "element" set to
- For "reference_levels", use the
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 composition ancombc [...] : differentials.qza
dataloaf.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
composition_actions <- import("qiime2.plugins.composition.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
action_results <- composition_actions$ancombc(
table=table,
metadata=metadata_md,
formula='bodysite + animal',
reference_levels=list('bodysite::tongue', 'animal::dog'),
)
dataloaf <- action_results$differentials
from q2_composition._examples import ancombc_multi_formula_with_reference_levels
ancombc_multi_formula_with_reference_levels(use)
composition ancom¶
Apply Analysis of Composition of Microbiomes (ANCOM) to identify features that are differentially abundant across groups.
Citations¶
Inputs¶
- table:
FeatureTable[Composition]
The feature table to be used for ANCOM computation.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
The categorical sample metadata column to test for differential abundance across.[required]
- transform_function:
Str
%
Choices
('sqrt', 'log', 'clr')
The method applied to transform feature values before generating volcano plots.[default:
'clr'
]- difference_function:
Str
%
Choices
('mean_difference', 'f_statistic')
The method applied to visualize fold difference in feature abundances across groups for volcano plots.[optional]
- filter_missing:
Bool
If True, samples with missing metadata values will be filtered from the table prior to analysis. If False, an error will be raised if there are any missing metadata values.[default:
False
]
Outputs¶
- visualization:
Visualization
<no description>[required]
composition tabulate¶
Generate tabular view of ANCOM-BC output, which includes per-page views for the log-fold change (lfc), standard error (se), P values, Q values, and W scores.
Inputs¶
- data:
FeatureData[DifferentialAbundance]
The ANCOM-BC output to be tabulated.[required]
Outputs¶
- visualization:
Visualization
<no description>[required]
composition da-barplot¶
Generate bar plot views of ANCOM-BC output. One plot will be present per column in the ANCOM-BC output. The significance_threshold
, effect_size_threshold
and feature_ids
filter results are intersected, such that only features that remain after all three filters have been applied will be present in the output.
Inputs¶
- data:
FeatureData[DifferentialAbundance]
The ANCOM-BC output to be plotted.[required]
Parameters¶
- effect_size_label:
Str
Label for effect sizes in
data
.[default:'lfc'
]- feature_id_label:
Str
Label for feature ids in
data
.[default:'id'
]- error_label:
Str
Label for effect size errors in
data
.[default:'se'
]- significance_label:
Str
Label for statistical significance level in
data
.[default:'q_val'
]- significance_threshold:
Float
%
Range
(0.0, 1.0, inclusive_end=True)
Exclude features with statistical significance level greater (i.e., less significant) than this threshold.[default:
1.0
]- effect_size_threshold:
Float
%
Range
(0.0, None)
Exclude features with an absolute value of effect size less than this threshold.[default:
0.0
]- feature_ids:
Metadata
Exclude features if their ids are not included in this index.[optional]
- level_delimiter:
Str
If feature ids encode hierarchical information, split the levels when generating feature labels in the visualization using this delimiter.[optional]
- label_limit:
Int
Set the maximum length that will be viewable for axis labels. You can set this parameter if your axis labels are being cut off.[optional]
Outputs¶
- visualization:
Visualization
<no description>[required]
This QIIME 2 plugin supports methods for compositional data analysis.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -composition - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
Name | Type | Short Description |
---|---|---|
add-pseudocount | method | Add pseudocount to table. |
ancombc | method | Analysis of Composition of Microbiomes with Bias Correction |
ancom | visualizer | Apply ANCOM to identify features that differ in abundance. |
tabulate | visualizer | View tabular output from ANCOM-BC. |
da-barplot | visualizer | Differential abundance bar plots |
Artifact Classes¶
FeatureData[DifferentialAbundance] |
Formats¶
FrictionlessCSVFileFormat |
DataPackageSchemaFileFormat |
DataLoafPackageDirFmt |
composition add-pseudocount¶
Increment all counts in table by pseudocount.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to which pseudocounts should be added.[required]
Parameters¶
- pseudocount:
Int
The value to add to all counts in the feature table.[default:
1
]
Outputs¶
- composition_table:
FeatureTable[Composition]
The resulting feature table.[required]
composition ancombc¶
Apply Analysis of Compositions of Microbiomes with Bias Correction (ANCOM-BC) to identify features that are differentially abundant across groups.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be used for ANCOM-BC computation.[required]
Parameters¶
- metadata:
Metadata
The sample metadata.[required]
- formula:
Str
How the microbial absolute abundances for each taxon depend on the variables within the
metadata
.[required]- p_adj_method:
Str
%
Choices
('holm', 'hochberg', 'hommel', 'bonferroni', 'BH', 'BY', 'fdr', 'none')
Method to adjust p-values.[default:
'holm'
]- prv_cut:
Float
A numerical fraction between 0-1. Taxa with prevalences less than this value will be excluded from the analysis.[default:
0.1
]- lib_cut:
Int
A numerical threshold for filtering samples based on library sizes. Samples with library sizes less than this value will be excluded from the analysis.[default:
0
]- reference_levels:
List
[
Str
]
Define the reference level(s) to be used for categorical columns found in the
formula
. These categorical factors are dummy coded relative to the reference(s) provided. The syntax is as follows: "column_name::column_value"[optional]- tol:
Float
The iteration convergence tolerance for the E-M algorithm.[default:
1e-05
]- max_iter:
Int
The maximum number of iterations for the E-M algorithm.[default:
100
]- conserve:
Bool
Whether to use a conservative variance estimator for the test statistic. It is recommended if the sample size is small and/or the number of differentially abundant taxa is believed to be large.[default:
False
]- alpha:
Float
Level of significance.[default:
0.05
]
Outputs¶
- differentials:
FeatureData[DifferentialAbundance]
The calculated per-feature differentials.[required]
Examples¶
ancombc_single_formula¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
wget -O 'metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
qiime composition ancombc \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-formula bodysite \
--o-differentials dataloaf.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.composition.actions as composition_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
dataloaf, = composition_actions.ancombc(
table=table,
metadata=metadata_md,
formula='bodysite',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /1 /table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /1 /metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 composition ancombc
tool: - Set "table" to
#: table.qza
- For "metadata":
- Perform the following steps.
- Leave as
Metadata from TSV
- Set "Metadata Source" to
metadata.tsv
- Leave as
- Perform the following steps.
- Set "formula" to
bodysite
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 composition ancombc [...] : differentials.qza
dataloaf.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
composition_actions <- import("qiime2.plugins.composition.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
action_results <- composition_actions$ancombc(
table=table,
metadata=metadata_md,
formula='bodysite',
)
dataloaf <- action_results$differentials
from q2_composition._examples import ancombc_single_formula
ancombc_single_formula(use)
ancombc_multi_formula_with_reference_levels¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
wget -O 'metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
qiime composition ancombc \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-formula 'bodysite + animal' \
--p-reference-levels bodysite::tongue animal::dog \
--o-differentials dataloaf.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.composition.actions as composition_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
dataloaf, = composition_actions.ancombc(
table=table,
metadata=metadata_md,
formula='bodysite + animal',
reference_levels=['bodysite::tongue', 'animal::dog'],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /2 /table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /2 /metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 composition ancombc
tool: - Set "table" to
#: table.qza
- For "metadata":
- Perform the following steps.
- Leave as
Metadata from TSV
- Set "Metadata Source" to
metadata.tsv
- Leave as
- Perform the following steps.
- Set "formula" to
bodysite + animal
- Expand the
additional options
section- For "reference_levels", use the
+ reference_levels
button to add the corresponding values:- Add "element" set to
bodysite::tongue
- Add "element" set to
animal::dog
- Add "element" set to
- For "reference_levels", use the
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 composition ancombc [...] : differentials.qza
dataloaf.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
composition_actions <- import("qiime2.plugins.composition.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
action_results <- composition_actions$ancombc(
table=table,
metadata=metadata_md,
formula='bodysite + animal',
reference_levels=list('bodysite::tongue', 'animal::dog'),
)
dataloaf <- action_results$differentials
from q2_composition._examples import ancombc_multi_formula_with_reference_levels
ancombc_multi_formula_with_reference_levels(use)
composition ancom¶
Apply Analysis of Composition of Microbiomes (ANCOM) to identify features that are differentially abundant across groups.
Citations¶
Inputs¶
- table:
FeatureTable[Composition]
The feature table to be used for ANCOM computation.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
The categorical sample metadata column to test for differential abundance across.[required]
- transform_function:
Str
%
Choices
('sqrt', 'log', 'clr')
The method applied to transform feature values before generating volcano plots.[default:
'clr'
]- difference_function:
Str
%
Choices
('mean_difference', 'f_statistic')
The method applied to visualize fold difference in feature abundances across groups for volcano plots.[optional]
- filter_missing:
Bool
If True, samples with missing metadata values will be filtered from the table prior to analysis. If False, an error will be raised if there are any missing metadata values.[default:
False
]
Outputs¶
- visualization:
Visualization
<no description>[required]
composition tabulate¶
Generate tabular view of ANCOM-BC output, which includes per-page views for the log-fold change (lfc), standard error (se), P values, Q values, and W scores.
Inputs¶
- data:
FeatureData[DifferentialAbundance]
The ANCOM-BC output to be tabulated.[required]
Outputs¶
- visualization:
Visualization
<no description>[required]
composition da-barplot¶
Generate bar plot views of ANCOM-BC output. One plot will be present per column in the ANCOM-BC output. The significance_threshold
, effect_size_threshold
and feature_ids
filter results are intersected, such that only features that remain after all three filters have been applied will be present in the output.
Inputs¶
- data:
FeatureData[DifferentialAbundance]
The ANCOM-BC output to be plotted.[required]
Parameters¶
- effect_size_label:
Str
Label for effect sizes in
data
.[default:'lfc'
]- feature_id_label:
Str
Label for feature ids in
data
.[default:'id'
]- error_label:
Str
Label for effect size errors in
data
.[default:'se'
]- significance_label:
Str
Label for statistical significance level in
data
.[default:'q_val'
]- significance_threshold:
Float
%
Range
(0.0, 1.0, inclusive_end=True)
Exclude features with statistical significance level greater (i.e., less significant) than this threshold.[default:
1.0
]- effect_size_threshold:
Float
%
Range
(0.0, None)
Exclude features with an absolute value of effect size less than this threshold.[default:
0.0
]- feature_ids:
Metadata
Exclude features if their ids are not included in this index.[optional]
- level_delimiter:
Str
If feature ids encode hierarchical information, split the levels when generating feature labels in the visualization using this delimiter.[optional]
- label_limit:
Int
Set the maximum length that will be viewable for axis labels. You can set this parameter if your axis labels are being cut off.[optional]
Outputs¶
- visualization:
Visualization
<no description>[required]
This QIIME 2 plugin supports methods for compositional data analysis.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -composition - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
Name | Type | Short Description |
---|---|---|
add-pseudocount | method | Add pseudocount to table. |
ancombc | method | Analysis of Composition of Microbiomes with Bias Correction |
ancom | visualizer | Apply ANCOM to identify features that differ in abundance. |
tabulate | visualizer | View tabular output from ANCOM-BC. |
da-barplot | visualizer | Differential abundance bar plots |
Artifact Classes¶
FeatureData[DifferentialAbundance] |
Formats¶
FrictionlessCSVFileFormat |
DataPackageSchemaFileFormat |
DataLoafPackageDirFmt |
composition add-pseudocount¶
Increment all counts in table by pseudocount.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to which pseudocounts should be added.[required]
Parameters¶
- pseudocount:
Int
The value to add to all counts in the feature table.[default:
1
]
Outputs¶
- composition_table:
FeatureTable[Composition]
The resulting feature table.[required]
composition ancombc¶
Apply Analysis of Compositions of Microbiomes with Bias Correction (ANCOM-BC) to identify features that are differentially abundant across groups.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be used for ANCOM-BC computation.[required]
Parameters¶
- metadata:
Metadata
The sample metadata.[required]
- formula:
Str
How the microbial absolute abundances for each taxon depend on the variables within the
metadata
.[required]- p_adj_method:
Str
%
Choices
('holm', 'hochberg', 'hommel', 'bonferroni', 'BH', 'BY', 'fdr', 'none')
Method to adjust p-values.[default:
'holm'
]- prv_cut:
Float
A numerical fraction between 0-1. Taxa with prevalences less than this value will be excluded from the analysis.[default:
0.1
]- lib_cut:
Int
A numerical threshold for filtering samples based on library sizes. Samples with library sizes less than this value will be excluded from the analysis.[default:
0
]- reference_levels:
List
[
Str
]
Define the reference level(s) to be used for categorical columns found in the
formula
. These categorical factors are dummy coded relative to the reference(s) provided. The syntax is as follows: "column_name::column_value"[optional]- tol:
Float
The iteration convergence tolerance for the E-M algorithm.[default:
1e-05
]- max_iter:
Int
The maximum number of iterations for the E-M algorithm.[default:
100
]- conserve:
Bool
Whether to use a conservative variance estimator for the test statistic. It is recommended if the sample size is small and/or the number of differentially abundant taxa is believed to be large.[default:
False
]- alpha:
Float
Level of significance.[default:
0.05
]
Outputs¶
- differentials:
FeatureData[DifferentialAbundance]
The calculated per-feature differentials.[required]
Examples¶
ancombc_single_formula¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
wget -O 'metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
qiime composition ancombc \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-formula bodysite \
--o-differentials dataloaf.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.composition.actions as composition_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
dataloaf, = composition_actions.ancombc(
table=table,
metadata=metadata_md,
formula='bodysite',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /1 /table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /1 /metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 composition ancombc
tool: - Set "table" to
#: table.qza
- For "metadata":
- Perform the following steps.
- Leave as
Metadata from TSV
- Set "Metadata Source" to
metadata.tsv
- Leave as
- Perform the following steps.
- Set "formula" to
bodysite
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 composition ancombc [...] : differentials.qza
dataloaf.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
composition_actions <- import("qiime2.plugins.composition.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
action_results <- composition_actions$ancombc(
table=table,
metadata=metadata_md,
formula='bodysite',
)
dataloaf <- action_results$differentials
from q2_composition._examples import ancombc_single_formula
ancombc_single_formula(use)
ancombc_multi_formula_with_reference_levels¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
wget -O 'metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
qiime composition ancombc \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-formula 'bodysite + animal' \
--p-reference-levels bodysite::tongue animal::dog \
--o-differentials dataloaf.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.composition.actions as composition_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
dataloaf, = composition_actions.ancombc(
table=table,
metadata=metadata_md,
formula='bodysite + animal',
reference_levels=['bodysite::tongue', 'animal::dog'],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /2 /table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /2 /metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 composition ancombc
tool: - Set "table" to
#: table.qza
- For "metadata":
- Perform the following steps.
- Leave as
Metadata from TSV
- Set "Metadata Source" to
metadata.tsv
- Leave as
- Perform the following steps.
- Set "formula" to
bodysite + animal
- Expand the
additional options
section- For "reference_levels", use the
+ reference_levels
button to add the corresponding values:- Add "element" set to
bodysite::tongue
- Add "element" set to
animal::dog
- Add "element" set to
- For "reference_levels", use the
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 composition ancombc [...] : differentials.qza
dataloaf.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
composition_actions <- import("qiime2.plugins.composition.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
action_results <- composition_actions$ancombc(
table=table,
metadata=metadata_md,
formula='bodysite + animal',
reference_levels=list('bodysite::tongue', 'animal::dog'),
)
dataloaf <- action_results$differentials
from q2_composition._examples import ancombc_multi_formula_with_reference_levels
ancombc_multi_formula_with_reference_levels(use)
composition ancom¶
Apply Analysis of Composition of Microbiomes (ANCOM) to identify features that are differentially abundant across groups.
Citations¶
Inputs¶
- table:
FeatureTable[Composition]
The feature table to be used for ANCOM computation.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
The categorical sample metadata column to test for differential abundance across.[required]
- transform_function:
Str
%
Choices
('sqrt', 'log', 'clr')
The method applied to transform feature values before generating volcano plots.[default:
'clr'
]- difference_function:
Str
%
Choices
('mean_difference', 'f_statistic')
The method applied to visualize fold difference in feature abundances across groups for volcano plots.[optional]
- filter_missing:
Bool
If True, samples with missing metadata values will be filtered from the table prior to analysis. If False, an error will be raised if there are any missing metadata values.[default:
False
]
Outputs¶
- visualization:
Visualization
<no description>[required]
composition tabulate¶
Generate tabular view of ANCOM-BC output, which includes per-page views for the log-fold change (lfc), standard error (se), P values, Q values, and W scores.
Inputs¶
- data:
FeatureData[DifferentialAbundance]
The ANCOM-BC output to be tabulated.[required]
Outputs¶
- visualization:
Visualization
<no description>[required]
composition da-barplot¶
Generate bar plot views of ANCOM-BC output. One plot will be present per column in the ANCOM-BC output. The significance_threshold
, effect_size_threshold
and feature_ids
filter results are intersected, such that only features that remain after all three filters have been applied will be present in the output.
Inputs¶
- data:
FeatureData[DifferentialAbundance]
The ANCOM-BC output to be plotted.[required]
Parameters¶
- effect_size_label:
Str
Label for effect sizes in
data
.[default:'lfc'
]- feature_id_label:
Str
Label for feature ids in
data
.[default:'id'
]- error_label:
Str
Label for effect size errors in
data
.[default:'se'
]- significance_label:
Str
Label for statistical significance level in
data
.[default:'q_val'
]- significance_threshold:
Float
%
Range
(0.0, 1.0, inclusive_end=True)
Exclude features with statistical significance level greater (i.e., less significant) than this threshold.[default:
1.0
]- effect_size_threshold:
Float
%
Range
(0.0, None)
Exclude features with an absolute value of effect size less than this threshold.[default:
0.0
]- feature_ids:
Metadata
Exclude features if their ids are not included in this index.[optional]
- level_delimiter:
Str
If feature ids encode hierarchical information, split the levels when generating feature labels in the visualization using this delimiter.[optional]
- label_limit:
Int
Set the maximum length that will be viewable for axis labels. You can set this parameter if your axis labels are being cut off.[optional]
Outputs¶
- visualization:
Visualization
<no description>[required]
This QIIME 2 plugin supports methods for compositional data analysis.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -composition - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
Name | Type | Short Description |
---|---|---|
add-pseudocount | method | Add pseudocount to table. |
ancombc | method | Analysis of Composition of Microbiomes with Bias Correction |
ancom | visualizer | Apply ANCOM to identify features that differ in abundance. |
tabulate | visualizer | View tabular output from ANCOM-BC. |
da-barplot | visualizer | Differential abundance bar plots |
Artifact Classes¶
FeatureData[DifferentialAbundance] |
Formats¶
FrictionlessCSVFileFormat |
DataPackageSchemaFileFormat |
DataLoafPackageDirFmt |
composition add-pseudocount¶
Increment all counts in table by pseudocount.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to which pseudocounts should be added.[required]
Parameters¶
- pseudocount:
Int
The value to add to all counts in the feature table.[default:
1
]
Outputs¶
- composition_table:
FeatureTable[Composition]
The resulting feature table.[required]
composition ancombc¶
Apply Analysis of Compositions of Microbiomes with Bias Correction (ANCOM-BC) to identify features that are differentially abundant across groups.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be used for ANCOM-BC computation.[required]
Parameters¶
- metadata:
Metadata
The sample metadata.[required]
- formula:
Str
How the microbial absolute abundances for each taxon depend on the variables within the
metadata
.[required]- p_adj_method:
Str
%
Choices
('holm', 'hochberg', 'hommel', 'bonferroni', 'BH', 'BY', 'fdr', 'none')
Method to adjust p-values.[default:
'holm'
]- prv_cut:
Float
A numerical fraction between 0-1. Taxa with prevalences less than this value will be excluded from the analysis.[default:
0.1
]- lib_cut:
Int
A numerical threshold for filtering samples based on library sizes. Samples with library sizes less than this value will be excluded from the analysis.[default:
0
]- reference_levels:
List
[
Str
]
Define the reference level(s) to be used for categorical columns found in the
formula
. These categorical factors are dummy coded relative to the reference(s) provided. The syntax is as follows: "column_name::column_value"[optional]- tol:
Float
The iteration convergence tolerance for the E-M algorithm.[default:
1e-05
]- max_iter:
Int
The maximum number of iterations for the E-M algorithm.[default:
100
]- conserve:
Bool
Whether to use a conservative variance estimator for the test statistic. It is recommended if the sample size is small and/or the number of differentially abundant taxa is believed to be large.[default:
False
]- alpha:
Float
Level of significance.[default:
0.05
]
Outputs¶
- differentials:
FeatureData[DifferentialAbundance]
The calculated per-feature differentials.[required]
Examples¶
ancombc_single_formula¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
wget -O 'metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
qiime composition ancombc \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-formula bodysite \
--o-differentials dataloaf.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.composition.actions as composition_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
dataloaf, = composition_actions.ancombc(
table=table,
metadata=metadata_md,
formula='bodysite',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /1 /table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /1 /metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 composition ancombc
tool: - Set "table" to
#: table.qza
- For "metadata":
- Perform the following steps.
- Leave as
Metadata from TSV
- Set "Metadata Source" to
metadata.tsv
- Leave as
- Perform the following steps.
- Set "formula" to
bodysite
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 composition ancombc [...] : differentials.qza
dataloaf.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
composition_actions <- import("qiime2.plugins.composition.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/1/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
action_results <- composition_actions$ancombc(
table=table,
metadata=metadata_md,
formula='bodysite',
)
dataloaf <- action_results$differentials
from q2_composition._examples import ancombc_single_formula
ancombc_single_formula(use)
ancombc_multi_formula_with_reference_levels¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
wget -O 'metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
qiime composition ancombc \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-formula 'bodysite + animal' \
--p-reference-levels bodysite::tongue animal::dog \
--o-differentials dataloaf.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.composition.actions as composition_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
dataloaf, = composition_actions.ancombc(
table=table,
metadata=metadata_md,
formula='bodysite + animal',
reference_levels=['bodysite::tongue', 'animal::dog'],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /2 /table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /composition /ancombc /2 /metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 composition ancombc
tool: - Set "table" to
#: table.qza
- For "metadata":
- Perform the following steps.
- Leave as
Metadata from TSV
- Set "Metadata Source" to
metadata.tsv
- Leave as
- Perform the following steps.
- Set "formula" to
bodysite + animal
- Expand the
additional options
section- For "reference_levels", use the
+ reference_levels
button to add the corresponding values:- Add "element" set to
bodysite::tongue
- Add "element" set to
animal::dog
- Add "element" set to
- For "reference_levels", use the
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 composition ancombc [...] : differentials.qza
dataloaf.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
composition_actions <- import("qiime2.plugins.composition.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/composition/ancombc/2/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
action_results <- composition_actions$ancombc(
table=table,
metadata=metadata_md,
formula='bodysite + animal',
reference_levels=list('bodysite::tongue', 'animal::dog'),
)
dataloaf <- action_results$differentials
from q2_composition._examples import ancombc_multi_formula_with_reference_levels
ancombc_multi_formula_with_reference_levels(use)
composition ancom¶
Apply Analysis of Composition of Microbiomes (ANCOM) to identify features that are differentially abundant across groups.
Citations¶
Inputs¶
- table:
FeatureTable[Composition]
The feature table to be used for ANCOM computation.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
The categorical sample metadata column to test for differential abundance across.[required]
- transform_function:
Str
%
Choices
('sqrt', 'log', 'clr')
The method applied to transform feature values before generating volcano plots.[default:
'clr'
]- difference_function:
Str
%
Choices
('mean_difference', 'f_statistic')
The method applied to visualize fold difference in feature abundances across groups for volcano plots.[optional]
- filter_missing:
Bool
If True, samples with missing metadata values will be filtered from the table prior to analysis. If False, an error will be raised if there are any missing metadata values.[default:
False
]
Outputs¶
- visualization:
Visualization
<no description>[required]
composition tabulate¶
Generate tabular view of ANCOM-BC output, which includes per-page views for the log-fold change (lfc), standard error (se), P values, Q values, and W scores.
Inputs¶
- data:
FeatureData[DifferentialAbundance]
The ANCOM-BC output to be tabulated.[required]
Outputs¶
- visualization:
Visualization
<no description>[required]
composition da-barplot¶
Generate bar plot views of ANCOM-BC output. One plot will be present per column in the ANCOM-BC output. The significance_threshold
, effect_size_threshold
and feature_ids
filter results are intersected, such that only features that remain after all three filters have been applied will be present in the output.
Inputs¶
- data:
FeatureData[DifferentialAbundance]
The ANCOM-BC output to be plotted.[required]
Parameters¶
- effect_size_label:
Str
Label for effect sizes in
data
.[default:'lfc'
]- feature_id_label:
Str
Label for feature ids in
data
.[default:'id'
]- error_label:
Str
Label for effect size errors in
data
.[default:'se'
]- significance_label:
Str
Label for statistical significance level in
data
.[default:'q_val'
]- significance_threshold:
Float
%
Range
(0.0, 1.0, inclusive_end=True)
Exclude features with statistical significance level greater (i.e., less significant) than this threshold.[default:
1.0
]- effect_size_threshold:
Float
%
Range
(0.0, None)
Exclude features with an absolute value of effect size less than this threshold.[default:
0.0
]- feature_ids:
Metadata
Exclude features if their ids are not included in this index.[optional]
- level_delimiter:
Str
If feature ids encode hierarchical information, split the levels when generating feature labels in the visualization using this delimiter.[optional]
- label_limit:
Int
Set the maximum length that will be viewable for axis labels. You can set this parameter if your axis labels are being cut off.[optional]
Outputs¶
- visualization:
Visualization
<no description>[required]
- Links
- Documentation
- Source Code
- Stars
- 6
- Last Commit
- 7c877df
- Available Distros
- 2024.10
- 2024.10/amplicon
- 2024.10/metagenome
- 2024.5
- 2024.5/amplicon
- 2024.5/metagenome
- 2024.2
- 2024.2/amplicon
- 2023.9
- 2023.9/amplicon
- 2023.7
- 2023.7/core