Plugin Overview¶
A plugin providing bootstrapped and rarefaction-based (i.e., resampled) diversity analyses, designed to mirror the interface of q2-diversity.
- version:
2026.4.0 - website: https://
library .qiime2 .org /plugins /caporaso -lab /q2 -boots - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org - citations:
- Raspet et al., 2025
Actions¶
| Name | Type | Short Description |
|---|---|---|
| alpha-average | method | Average alpha diversity vectors. |
| beta-average | method | Average beta diversity distance matrices. |
| resample | pipeline | Resample feature table, returning `n` feature tables. |
| alpha-collection | pipeline | Perform resampled alpha diversity, returning `n` result vectors. |
| alpha | pipeline | Perform resampled alpha diversity, returning average result vector. |
| beta-collection | pipeline | Perform resampled beta diversity, returning `n` distance matrices. |
| beta | pipeline | Perform resampled beta diversity, returning average distance matrix. |
| core-metrics | pipeline | Perform resampled "core metrics" analysis. |
| kmer-diversity | pipeline | Perform resampled "core metrics" analysis on kmerized features. |
boots alpha-average¶
Compute the per-sample average across a collection of alpha diversity vectors computed from the same samples.
Citations¶
Inputs¶
- data:
Collection[SampleData[AlphaDiversity]] Alpha diversity vectors to be averaged.[required]
Parameters¶
- average_method:
Str%Choices('mean', 'median') Method to use for averaging.[required]
Outputs¶
- average_alpha_diversity:
SampleData[AlphaDiversity] The average alpha diversity vector.[required]
boots beta-average¶
Compute the average distance matrix across a collection of distance matrices.
Citations¶
Inputs¶
- data:
Collection[DistanceMatrix] Distance matrices to be average.[required]
Parameters¶
- average_method:
Str%Choices('non-metric-mean', 'non-metric-median', 'medoid') Method to use for averaging.[required]
Outputs¶
- average_distance_matrix:
DistanceMatrix The average distance matrix.[required]
boots resample¶
Resample table to sampling_depth total observations with replacement (i.e., bootstrapping) or without replacement (i.e., rarefaction) n times, to generate n resampled feature tables.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency] The input feature table.[required]
Parameters¶
- sampling_depth:
Int%Range(1, None) The total number of observations that each sample in
tableshould be resampled to. Samples where the total number of observations intableis less thansampling_depthwill be not be included in the output tables.[required]- n:
Int%Range(1, None) The number of resampled tables that should be generated.[required]
- replacement:
Bool Resample
tablewith replacement (i.e., bootstrap) or without replacement (i.e., rarefaction).[required]- random_seed:
Int Seed used in random number generation. Pass the same seed to get the same results. Defaults to None for random results.[optional]
Outputs¶
- resampled_tables:
Collection[FeatureTable[Frequency]] The
nresampled tables.[required]
Examples¶
Generate 10 bootstrapped tables.¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/resample/1/table.qza'
qiime boots resample \
--i-table table.qza \
--p-sampling-depth 20 \
--p-n 10 \
--p-replacement \
--o-resampled-tables bootstrapped-tables/from qiime2 import Artifact
from urllib import request
import rachis.plugins.boots.actions as boots_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/resample/1/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
bootstrapped_tables_artifact_collection, = boots_actions.resample(
table=table,
sampling_depth=20,
n=10,
replacement=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
boots_actions <- import("rachis.plugins.boots.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/resample/1/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
action_results <- boots_actions$resample(
table=table,
sampling_depth=20L,
n=10L,
replacement=TRUE,
)
bootstrapped_tables_artifact_collection <- action_results$resampled_tables
from q2_boots._examples import _resample_bootstrap_example
_resample_bootstrap_example(use)
Generate 10 rarefied tables.¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/resample/2/table.qza'
qiime boots resample \
--i-table table.qza \
--p-sampling-depth 20 \
--p-n 10 \
--p-no-replacement \
--o-resampled-tables rarefaction-tables/from qiime2 import Artifact
from urllib import request
import rachis.plugins.boots.actions as boots_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/resample/2/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
rarefaction_tables_artifact_collection, = boots_actions.resample(
table=table,
sampling_depth=20,
n=10,
replacement=False,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
boots_actions <- import("rachis.plugins.boots.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/resample/2/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
action_results <- boots_actions$resample(
table=table,
sampling_depth=20L,
n=10L,
replacement=FALSE,
)
rarefaction_tables_artifact_collection <- action_results$resampled_tables
from q2_boots._examples import _resample_rarefaction_example
_resample_rarefaction_example(use)
boots alpha-collection¶
Given a single feature table as input, this action resamples the feature table n times to a total frequency of sampling depth per sample, and then computes the specified alpha diversity metric on each resulting table. The resulting artifacts can be used, for example, to explore the variance across n iterations of resampling.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The input feature table.[required]
- phylogeny:
Phylogeny[Rooted] The phylogenetic tree to use in phylogenetic diversity calculations. All feature ids in
tablemust be present in this tree, but this tree can contain feature ids that are not present intable.[optional]
Parameters¶
- sampling_depth:
Int%Range(1, None) The total number of observations that each sample in
tableshould be resampled to. Samples where the total number of observations intableis less thansampling_depthwill be not be included in the output tables.[required]- metric:
Str%Choices('ace', 'berger_parker_d', 'brillouin_d', 'chao1', 'chao1_ci', 'dominance', 'doubles', 'enspie', 'esty_ci', 'faith_pd', 'fisher_alpha', 'gini_index', 'goods_coverage', 'heip_e', 'kempton_taylor_q', 'lladser_pe', 'margalef', 'mcintosh_d', 'mcintosh_e', 'menhinick', 'michaelis_menten_fit', 'observed_features', 'osd', 'pielou_e', 'robbins', 'shannon', 'simpson', 'simpson_e', 'singles', 'strong') The alpha diversity metric to be computed.[required]
- n:
Int%Range(1, None) The number of resampled tables that should be generated.[required]
- replacement:
Bool Resample
tablewith replacement (i.e., bootstrap) or without replacement (i.e., rarefaction).[required]- random_seed:
Int Seed used in random number generation. Pass the same seed to get the same results. Defaults to None for random results.[optional]
Outputs¶
- alpha_diversities:
Collection[SampleData[AlphaDiversity]] nalpha diversity vectors, each containing per-sample alpha diversity scores for the same samples.[required]
boots alpha¶
Given a single feature table as input, this action resamples the feature table n times to a total frequency of sampling depth per sample, and then computes the specified alpha diversity metric on each resulting table. The resulting artifacts are then averaged using the method specified by average_method, and the resulting average per-sample alpha diversities are returned.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The input feature table.[required]
- phylogeny:
Phylogeny[Rooted] The phylogenetic tree to use in phylogenetic diversity calculations. All feature ids in
tablemust be present in this tree, but this tree can contain feature ids that are not present intable.[optional]
Parameters¶
- sampling_depth:
Int%Range(1, None) The total number of observations that each sample in
tableshould be resampled to. Samples where the total number of observations intableis less thansampling_depthwill be not be included in the output tables.[required]- metric:
Str%Choices('ace', 'berger_parker_d', 'brillouin_d', 'chao1', 'chao1_ci', 'dominance', 'doubles', 'enspie', 'esty_ci', 'faith_pd', 'fisher_alpha', 'gini_index', 'goods_coverage', 'heip_e', 'kempton_taylor_q', 'lladser_pe', 'margalef', 'mcintosh_d', 'mcintosh_e', 'menhinick', 'michaelis_menten_fit', 'observed_features', 'osd', 'pielou_e', 'robbins', 'shannon', 'simpson', 'simpson_e', 'singles', 'strong') The alpha diversity metric to be computed.[required]
- n:
Int%Range(1, None) The number of resampled tables that should be generated.[required]
- replacement:
Bool Resample
tablewith replacement (i.e., bootstrap) or without replacement (i.e., rarefaction).[required]- average_method:
Str%Choices('mean', 'median') Method to use for averaging.[default:
'median']- random_seed:
Int Seed used in random number generation. Pass the same seed to get the same results. Defaults to None for random results.[optional]
Outputs¶
- average_alpha_diversity:
SampleData[AlphaDiversity] The average alpha diversity vector.[required]
Examples¶
Bootstrapped observed features.¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/alpha/1/table.qza'
qiime boots alpha \
--i-table table.qza \
--p-sampling-depth 20 \
--p-metric observed_features \
--p-n 10 \
--p-replacement \
--p-average-method median \
--o-average-alpha-diversity observed-features-bootstrapped.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.boots.actions as boots_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/alpha/1/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
observed_features_bootstrapped, = boots_actions.alpha(
table=table,
sampling_depth=20,
metric='observed_features',
n=10,
replacement=True,
average_method='median',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
boots_actions <- import("rachis.plugins.boots.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/alpha/1/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
action_results <- boots_actions$alpha(
table=table,
sampling_depth=20L,
metric='observed_features',
n=10L,
replacement=TRUE,
average_method='median',
)
observed_features_bootstrapped <- action_results$average_alpha_diversity
from q2_boots._examples import _alpha_bootstrap_example
_alpha_bootstrap_example(use)
Rarefaction-based observed features.¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/alpha/2/table.qza'
qiime boots alpha \
--i-table table.qza \
--p-sampling-depth 20 \
--p-metric observed_features \
--p-n 10 \
--p-no-replacement \
--p-average-method median \
--o-average-alpha-diversity observed-features-rarefaction.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.boots.actions as boots_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/alpha/2/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
observed_features_rarefaction, = boots_actions.alpha(
table=table,
sampling_depth=20,
metric='observed_features',
n=10,
replacement=False,
average_method='median',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
boots_actions <- import("rachis.plugins.boots.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/alpha/2/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
action_results <- boots_actions$alpha(
table=table,
sampling_depth=20L,
metric='observed_features',
n=10L,
replacement=FALSE,
average_method='median',
)
observed_features_rarefaction <- action_results$average_alpha_diversity
from q2_boots._examples import _alpha_rarefaction_example
_alpha_rarefaction_example(use)
boots beta-collection¶
Given a single feature table as input, this action resamples the feature table n times to a total frequency of sampling depth per sample, and then computes the specified beta diversity metric on each resulting table. The resulting artifacts can be used, for example, to explore the variance across n iterations of resampling.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The input feature table.[required]
- phylogeny:
Phylogeny[Rooted] The phylogenetic tree to use in phylogenetic diversity calculations. All feature ids in
tablemust be present in this tree, but this tree can contain feature ids that are not present intable.[optional]
Parameters¶
- metric:
Str%Choices('aitchison', 'braycurtis', 'canberra', 'canberra_adkins', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'generalized_unifrac', 'hamming', 'jaccard', 'jensenshannon', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalsneath', 'sqeuclidean', 'unweighted_unifrac', 'weighted_normalized_unifrac', 'weighted_unifrac', 'yule') The beta diversity metric to be computed.[required]
- sampling_depth:
Int%Range(1, None) The total number of observations that each sample in
tableshould be resampled to. Samples where the total number of observations intableis less thansampling_depthwill be not be included in the output tables.[required]- n:
Int%Range(1, None) The number of resampled tables that should be generated.[required]
- replacement:
Bool Resample
tablewith replacement (i.e., bootstrap) or without replacement (i.e., rarefaction).[required]- bypass_tips:
Bool Ignore tips of tree in phylogenetic diversity calculations, trading specificity for reduced compute time. This has the effect of collapsing the phylogeny, and is analogous (in concept) to moving from 99% to 97% OTUs.[default:
False]- pseudocount:
Int%Range(1, None) A pseudocount to handle zeros for compositional metrics. This is ignored for other metrics.[default:
1]- alpha:
Float%Range(0, 1, inclusive_end=True) The alpha value used with the generalized UniFrac metric.[optional]
- variance_adjusted:
Bool Perform variance adjustment based on Chang et al. BMC Bioinformatics (2011) for phylogenetic diversity metrics.[default:
False]- random_seed:
Int Seed used in random number generation. Pass the same seed to get the same results. Defaults to None for random results.[optional]
Outputs¶
- distance_matrices:
Collection[DistanceMatrix] nbeta diversity distance matrices, each containing distances between all pairs of samples and computed from resampled feature tables.[required]
Examples¶
Bootstrapped Bray-Curtis.¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/beta-collection/1/table.qza'
qiime boots beta \
--i-table table.qza \
--p-metric braycurtis \
--p-sampling-depth 20 \
--p-n 10 \
--p-replacement \
--p-average-method medoid \
--o-average-distance-matrix braycurtis-bootstrapped.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.boots.actions as boots_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/beta-collection/1/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
braycurtis_bootstrapped, = boots_actions.beta(
table=table,
metric='braycurtis',
sampling_depth=20,
n=10,
replacement=True,
average_method='medoid',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
boots_actions <- import("rachis.plugins.boots.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/beta-collection/1/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
action_results <- boots_actions$beta(
table=table,
metric='braycurtis',
sampling_depth=20L,
n=10L,
replacement=TRUE,
average_method='medoid',
)
braycurtis_bootstrapped <- action_results$average_distance_matrix
from q2_boots._examples import _beta_bootstrap_example
_beta_bootstrap_example(use)
Rarefaction-based Bray-Curtis.¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/beta-collection/2/table.qza'
qiime boots beta \
--i-table table.qza \
--p-sampling-depth 20 \
--p-metric braycurtis \
--p-n 10 \
--p-no-replacement \
--p-average-method medoid \
--o-average-distance-matrix braycurtis-rarefaction.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.boots.actions as boots_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/beta-collection/2/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
braycurtis_rarefaction, = boots_actions.beta(
table=table,
sampling_depth=20,
metric='braycurtis',
n=10,
replacement=False,
average_method='medoid',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
boots_actions <- import("rachis.plugins.boots.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/beta-collection/2/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
action_results <- boots_actions$beta(
table=table,
sampling_depth=20L,
metric='braycurtis',
n=10L,
replacement=FALSE,
average_method='medoid',
)
braycurtis_rarefaction <- action_results$average_distance_matrix
from q2_boots._examples import _beta_rarefaction_example
_beta_rarefaction_example(use)
boots beta¶
Given a single feature table as input, this action resamples the feature table n times to a total frequency of sampling depth per sample, and then computes the specified beta diversity metric on each resulting table. The resulting artifacts are then averaged using the method specified by average_method, and the resulting average beta diversity distance matrix is returned.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The input feature table.[required]
- phylogeny:
Phylogeny[Rooted] The phylogenetic tree to use in phylogenetic diversity calculations. All feature ids in
tablemust be present in this tree, but this tree can contain feature ids that are not present intable.[optional]
Parameters¶
- metric:
Str%Choices('aitchison', 'braycurtis', 'canberra', 'canberra_adkins', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'generalized_unifrac', 'hamming', 'jaccard', 'jensenshannon', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalsneath', 'sqeuclidean', 'unweighted_unifrac', 'weighted_normalized_unifrac', 'weighted_unifrac', 'yule') The beta diversity metric to be computed.[required]
- sampling_depth:
Int%Range(1, None) The total number of observations that each sample in
tableshould be resampled to. Samples where the total number of observations intableis less thansampling_depthwill be not be included in the output tables.[required]- n:
Int%Range(1, None) The number of resampled tables that should be generated.[required]
- replacement:
Bool Resample
tablewith replacement (i.e., bootstrap) or without replacement (i.e., rarefaction).[required]- average_method:
Str%Choices('non-metric-mean', 'non-metric-median', 'medoid') Method to use for averaging.[default:
'medoid']- bypass_tips:
Bool Ignore tips of tree in phylogenetic diversity calculations, trading specificity for reduced compute time. This has the effect of collapsing the phylogeny, and is analogous (in concept) to moving from 99% to 97% OTUs.[default:
False]- pseudocount:
Int%Range(1, None) A pseudocount to handle zeros for compositional metrics. This is ignored for other metrics.[default:
1]- alpha:
Float%Range(0, 1, inclusive_end=True) The alpha value used with the generalized UniFrac metric.[optional]
- variance_adjusted:
Bool Perform variance adjustment based on Chang et al. BMC Bioinformatics (2011) for phylogenetic diversity metrics.[default:
False]- random_seed:
Int Seed used in random number generation. Pass the same seed to get the same results. Defaults to None for random results.[optional]
Outputs¶
- average_distance_matrix:
DistanceMatrix The average distance matrix.[required]
boots core-metrics¶
Given a single feature table as input, this action resamples the feature table n times to a total frequency of sampling depth per sample, and then computes common alpha and beta diversity on each resulting table. The resulting artifacts are then averaged using the method specified by alpha_average_method and beta_average_method parameters. The resulting average alpha and beta diversity artifacts are returned, along with PCoA matrices, Emperor plots, and a 2D scatter plot including alpha diversity values and PCoA of all beta diversity metrics.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The input feature table.[required]
- phylogeny:
Phylogeny[Rooted] The phylogenetic tree to use in phylogenetic diversity calculations. All feature ids in
tablemust be present in this tree, but this tree can contain feature ids that are not present intable.[optional]
Parameters¶
- sampling_depth:
Int%Range(1, None) The total number of observations that each sample in
tableshould be resampled to. Samples where the total number of observations intableis less thansampling_depthwill be not be included in the output tables.[required]- metadata:
Metadata The sample metadata used in generating Emperor plots.[required]
- n:
Int%Range(1, None) The number of resampled tables that should be generated.[required]
- replacement:
Bool Resample
tablewith replacement (i.e., bootstrap) or without replacement (i.e., rarefaction).[required]- alpha_average_method:
Str%Choices('mean', 'median') Method to use for averaging alpha diversity.[default:
'median']- beta_average_method:
Str%Choices('non-metric-mean', 'non-metric-median', 'medoid') Method to use for averaging beta diversity.[default:
'medoid']- pc_dimensions:
Int Number of principal coordinate dimensions to present in the 2D scatterplot.[default:
3]- color_by:
Str Categorical measure from the input Metadata that should be used for color-coding the 2D scatterplot.[optional]
- random_seed:
Int Seed used in random number generation. Pass the same seed to get the same results. Defaults to None for random results.[optional]
Outputs¶
- resampled_tables:
Collection[FeatureTable[Frequency]] The
nresampled tables.[required]- alpha_diversities:
Collection[SampleData[AlphaDiversity]] Average alpha diversity vector for each metric.[required]
- distance_matrices:
Collection[DistanceMatrix] Average beta diversity distance matrix for each metric.[required]
- pcoas:
Collection[PCoAResults] PCoA matrix for each beta diversity metric.[required]
- emperor_plots:
Collection[Visualization] Emperor plot for each beta diversity metric.[required]
- scatter_plot:
Visualization 2D scatter plot including alpha diversity and pcoa results for all selected metrics.[required]
Examples¶
Bootstrapped core metrics.¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/core-metrics/1/table.qza'
wget -O 'metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/core-metrics/1/metadata.tsv'
qiime boots core-metrics \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-sampling-depth 20 \
--p-n 10 \
--p-replacement \
--p-alpha-average-method median \
--p-beta-average-method medoid \
--output-dir boots-core-metricsfrom qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import rachis.plugins.boots.actions as boots_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/core-metrics/1/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/core-metrics/1/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
action_results = boots_actions.core_metrics(
table=table,
metadata=metadata_md,
sampling_depth=20,
n=10,
replacement=True,
alpha_average_method='median',
beta_average_method='medoid',
)
bootstrap_tables_artifact_collection = action_results.resampled_tables
bootstrap_alpha_diversities_artifact_collection = action_results.alpha_diversities
bootstrap_distance_matrices_artifact_collection = action_results.distance_matrices
bootstrap_pcoas_artifact_collection = action_results.pcoas
bootstrap_emperor_plots_viz_collection = action_results.emperor_plots
scatter_plot_viz = action_results.scatter_plotlibrary(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
boots_actions <- import("rachis.plugins.boots.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/core-metrics/1/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/core-metrics/1/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
action_results <- boots_actions$core_metrics(
table=table,
metadata=metadata_md,
sampling_depth=20L,
n=10L,
replacement=TRUE,
alpha_average_method='median',
beta_average_method='medoid',
)
bootstrap_tables_artifact_collection <- action_results$resampled_tables
bootstrap_alpha_diversities_artifact_collection <- action_results$alpha_diversities
bootstrap_distance_matrices_artifact_collection <- action_results$distance_matrices
bootstrap_pcoas_artifact_collection <- action_results$pcoas
bootstrap_emperor_plots_viz_collection <- action_results$emperor_plots
scatter_plot_viz <- action_results$scatter_plot
from q2_boots._examples import _core_metrics_bootstrap_example
_core_metrics_bootstrap_example(use)
table.qza| download | viewmetadata.tsv| downloadboots-core-metrics/resampled_tables.zip| downloadboots-core-metrics/alpha_diversities.zip| downloadboots-core-metrics/distance_matrices.zip| downloadboots-core-metrics/pcoas.zip| downloadboots-core-metrics/emperor_plots.zip| downloadboots-core-metrics/scatter_plot.qzv| download | view
Rarefaction-based core metrics.¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/core-metrics/2/table.qza'
wget -O 'metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/core-metrics/2/metadata.tsv'
qiime boots core-metrics \
--i-table table.qza \
--m-metadata-file metadata.tsv \
--p-sampling-depth 20 \
--p-n 10 \
--p-no-replacement \
--p-alpha-average-method median \
--p-beta-average-method medoid \
--output-dir boots-core-metricsfrom qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import rachis.plugins.boots.actions as boots_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/core-metrics/2/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/core-metrics/2/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
action_results = boots_actions.core_metrics(
table=table,
metadata=metadata_md,
sampling_depth=20,
n=10,
replacement=False,
alpha_average_method='median',
beta_average_method='medoid',
)
rarefaction_tables_artifact_collection = action_results.resampled_tables
rarefaction_alpha_diversities_artifact_collection = action_results.alpha_diversities
rarefaction_distance_matrices_artifact_collection = action_results.distance_matrices
rarefaction_pcoas_artifact_collection = action_results.pcoas
rarefaction_emperor_plots_viz_collection = action_results.emperor_plots
scatter_plot_viz = action_results.scatter_plotlibrary(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
boots_actions <- import("rachis.plugins.boots.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/core-metrics/2/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/core-metrics/2/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
action_results <- boots_actions$core_metrics(
table=table,
metadata=metadata_md,
sampling_depth=20L,
n=10L,
replacement=FALSE,
alpha_average_method='median',
beta_average_method='medoid',
)
rarefaction_tables_artifact_collection <- action_results$resampled_tables
rarefaction_alpha_diversities_artifact_collection <- action_results$alpha_diversities
rarefaction_distance_matrices_artifact_collection <- action_results$distance_matrices
rarefaction_pcoas_artifact_collection <- action_results$pcoas
rarefaction_emperor_plots_viz_collection <- action_results$emperor_plots
scatter_plot_viz <- action_results$scatter_plot
from q2_boots._examples import _core_metrics_rarefaction_example
_core_metrics_rarefaction_example(use)
table.qza| download | viewmetadata.tsv| downloadboots-core-metrics/resampled_tables.zip| downloadboots-core-metrics/alpha_diversities.zip| downloadboots-core-metrics/distance_matrices.zip| downloadboots-core-metrics/pcoas.zip| downloadboots-core-metrics/emperor_plots.zip| downloadboots-core-metrics/scatter_plot.qzv| download | view
boots kmer-diversity¶
Given a single feature table as input, this action resamples the feature table n times to a total frequency of sampling depth per sample. It then splits all input sequences into kmers, and computes common alpha and beta diversity on each resulting kmer table. The resulting artifacts are then averaged using the method specified by alpha_average_method and beta_average_method parameters. The resulting average alpha and beta diversity artifacts are returned, along with a scatter plot integrated all alpha diversity metrics and the PCoA axes for all beta diversity metrics.
Citations¶
Raspet et al., 2025; Bokulich, 2025
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The input feature table.[required]
- sequences:
FeatureData[Sequence | RNASequence | ProteinSequence] Input sequences for kmerization.[required]
Parameters¶
- sampling_depth:
Int%Range(1, None) The total number of observations that each sample in
tableshould be resampled to. Samples where the total number of observations intableis less thansampling_depthwill be not be included in the output tables.[required]- metadata:
Metadata The sample metadata used in generating Emperor plots.[required]
- n:
Int%Range(1, None) The number of resampled tables that should be generated.[required]
- replacement:
Bool Resample
tablewith replacement (i.e., bootstrap) or without replacement (i.e., rarefaction).[required]- kmer_size:
Int Length of kmers to generate.[default:
16]- tfidf:
Bool If True, kmers will be scored using TF-IDF and output frequencies will be weighted by scores. If False, kmers are counted without TF-IDF scores.[default:
False]- max_df:
Float%Range(0, 1, inclusive_end=True)|Int Ignore kmers that have a frequency strictly higher than the given threshold. If float, the parameter represents a proportion of sequences, if an integer it represents an absolute count.[default:
1.0]- min_df:
Float%Range(0, 1)|Int Ignore kmers that have a frequency strictly lower than the given threshold. If float, the parameter represents a proportion of sequences, if an integer it represents an absolute count.[default:
1]- max_features:
Int If not None, build a vocabulary that only considers the top max_features ordered by frequency (or TF-IDF score).[optional]
- alpha_average_method:
Str%Choices('mean', 'median') Method to use for averaging alpha diversity.[default:
'median']- beta_average_method:
Str%Choices('non-metric-mean', 'non-metric-median', 'medoid') Method to use for averaging beta diversity.[default:
'medoid']- pc_dimensions:
Int Number of principal coordinate dimensions to present in the 2D scatterplot.[default:
3]- color_by:
Str Categorical measure from the input Metadata that should be used for color-coding the 2D scatterplot.[optional]
- norm:
Str%Choices('None', 'l1', 'l2') Normalization procedure applied to TF-IDF scores. Ignored if tfidf=False. l2: Sum of squares of vector elements is 1. l1: Sum of absolute values of vector elements is 1.[default:
'None']- alpha_metrics:
List[Str%Choices('ace', 'berger_parker_d', 'brillouin_d', 'chao1', 'chao1_ci', 'dominance', 'doubles', 'enspie', 'esty_ci', 'fisher_alpha', 'gini_index', 'goods_coverage', 'heip_e', 'kempton_taylor_q', 'lladser_pe', 'margalef', 'mcintosh_d', 'mcintosh_e', 'menhinick', 'michaelis_menten_fit', 'observed_features', 'osd', 'pielou_e', 'robbins', 'shannon', 'simpson', 'simpson_e', 'singles', 'strong')] <no description>[default:
['pielou_e', 'observed_features', 'shannon']]- beta_metrics:
List[Str%Choices('aitchison', 'braycurtis', 'canberra', 'canberra_adkins', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jaccard', 'jensenshannon', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalsneath', 'sqeuclidean', 'yule')] <no description>[default:
['braycurtis', 'jaccard']]- random_seed:
Int <no description>[optional]
Outputs¶
- resampled_tables:
Collection[FeatureTable[Frequency]] The
nresampled tables.[required]- kmer_tables:
Collection[FeatureTable[Frequency]] The
nkmer tables.[required]- alpha_diversities:
Collection[SampleData[AlphaDiversity]] Average alpha diversity vector for each metric.[required]
- distance_matrices:
Collection[DistanceMatrix] Average beta diversity distance matrix for each metric.[required]
- pcoas:
Collection[PCoAResults] PCoA matrix for each beta diversity metric.[required]
- scatter_plot:
Visualization 2D scatter plot including alpha diversity and pcoa results for all selected metrics.[required]
Examples¶
Bootstrapped kmer diversity¶
wget -O 'table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/kmer-diversity/1/table.qza'
wget -O 'sequences.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/kmer-diversity/1/sequences.qza'
wget -O 'metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/kmer-diversity/1/metadata.tsv'
qiime boots kmer-diversity \
--i-table table.qza \
--i-sequences sequences.qza \
--m-metadata-file metadata.tsv \
--p-sampling-depth 20 \
--p-n 10 \
--p-kmer-size 5 \
--p-replacement \
--p-alpha-average-method median \
--p-beta-average-method medoid \
--output-dir boots-kmer-diversityfrom qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import rachis.plugins.boots.actions as boots_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/kmer-diversity/1/table.qza'
fn = 'table.qza'
request.urlretrieve(url, fn)
table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/kmer-diversity/1/sequences.qza'
fn = 'sequences.qza'
request.urlretrieve(url, fn)
sequences = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/kmer-diversity/1/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
action_results = boots_actions.kmer_diversity(
table=table,
sequences=sequences,
metadata=metadata_md,
sampling_depth=20,
n=10,
kmer_size=5,
replacement=True,
alpha_average_method='median',
beta_average_method='medoid',
)
bootstrap_tables_artifact_collection = action_results.resampled_tables
kmer_tables_artifact_collection = action_results.kmer_tables
bootstrap_alpha_diversities_artifact_collection = action_results.alpha_diversities
bootstrap_distance_matrices_artifact_collection = action_results.distance_matrices
bootstrap_pcoas_artifact_collection = action_results.pcoas
scatter_plot_viz = action_results.scatter_plotlibrary(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
boots_actions <- import("rachis.plugins.boots.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/kmer-diversity/1/table.qza'
fn <- 'table.qza'
request$urlretrieve(url, fn)
table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/kmer-diversity/1/sequences.qza'
fn <- 'sequences.qza'
request$urlretrieve(url, fn)
sequences <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/boots/kmer-diversity/1/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
action_results <- boots_actions$kmer_diversity(
table=table,
sequences=sequences,
metadata=metadata_md,
sampling_depth=20L,
n=10L,
kmer_size=5L,
replacement=TRUE,
alpha_average_method='median',
beta_average_method='medoid',
)
bootstrap_tables_artifact_collection <- action_results$resampled_tables
kmer_tables_artifact_collection <- action_results$kmer_tables
bootstrap_alpha_diversities_artifact_collection <- action_results$alpha_diversities
bootstrap_distance_matrices_artifact_collection <- action_results$distance_matrices
bootstrap_pcoas_artifact_collection <- action_results$pcoas
scatter_plot_viz <- action_results$scatter_plot
from q2_boots._examples import _kmer_diversity_bootstrap_example
_kmer_diversity_bootstrap_example(use)
table.qza| download | viewsequences.qza| download | viewmetadata.tsv| downloadboots-kmer-diversity/resampled_tables.zip| downloadboots-kmer-diversity/kmer_tables.zip| downloadboots-kmer-diversity/alpha_diversities.zip| downloadboots-kmer-diversity/distance_matrices.zip| downloadboots-kmer-diversity/pcoas.zip| downloadboots-kmer-diversity/scatter_plot.qzv| download | view
- Raspet, I., Gehret, E., Herman, C., Meilander, J., Manley, A., Simard, A., Bolyen, E., & Caporaso, J. G. (2025). Facilitating bootstrapped and rarefaction-based microbiome diversity analysis with q2-boots. F1000Res., 14(87), 87. https://doi.org/10.12688/f1000research.156295.1
- Bokulich, N. A. (2025). Integrating sequence composition information into microbial diversity analyses with k-mer frequency counting. mSystems, 10(3), e0155024.