This QIIME 2 plugin computes individual metrics for community alpha and beta diversity.
- version:
2026.4.0 - website: https://
github .com /qiime2 /q2 -diversity -lib - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
| Name | Type | Short Description |
|---|---|---|
| faith-pd | method | Faith's Phylogenetic Diversity |
| observed-features | method | Observed Features |
| pielou-evenness | method | Pielou's Evenness |
| shannon-entropy | method | Shannon's Entropy |
| bray-curtis | method | Bray-Curtis Dissimilarity |
| jaccard | method | Jaccard Distance |
| unweighted-unifrac | method | Unweighted Unifrac |
| weighted-unifrac | method | Weighted Unifrac |
| alpha-passthrough | method | Alpha Passthrough (non-phylogenetic) |
| beta-passthrough | method | Beta Passthrough (non-phylogenetic) |
| beta-phylogenetic-passthrough | method | Beta Phylogenetic Passthrough |
| beta-phylogenetic-meta-passthrough | method | Beta Phylogenetic Meta Passthrough |
diversity-lib faith-pd¶
Computes Faith's Phylogenetic Diversity for all samples in a feature table.
Citations¶
Faith, 1992; Armstrong et al., 2021
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Faith's phylogenetic diversity should be computed. Table values will be converted to presence/absence.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Faith's Phylogenetic Diversity.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
qiime diversity-lib faith-pd \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-vector faith-pd-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
faith_pd_vector, = diversity_lib_actions.faith_pd(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$faith_pd(
table=feature_table,
phylogeny=phylogeny,
)
faith_pd_vector <- action_results$vector
from q2_diversity_lib.examples import faith_pd_example
faith_pd_example(use)
diversity-lib observed-features¶
Compute the number of observed features for each sample in a feature table
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which the number of observed features should be calculated. Table values will be converted to presence/absence.[required]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample counts of observed features.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
qiime diversity-lib observed-features \
--i-table feature-table.qza \
--o-vector obs-feat-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
obs_feat_vector, = diversity_lib_actions.observed_features(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$observed_features(
table=feature_table,
)
obs_feat_vector <- action_results$vector
from q2_diversity_lib.examples import observed_features_example
observed_features_example(use)
diversity-lib pielou-evenness¶
Compute Pielou's Evenness for each sample in a feature table
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Pielou's evenness should be computed.[required]
Parameters¶
- drop_undefined_samples:
Bool Samples with fewer than two observed features produce undefined (NaN) values. If true, these samples are dropped from the output vector.[default:
False]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Pielou's Evenness.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
qiime diversity-lib pielou-evenness \
--i-table feature-table.qza \
--o-vector pielou-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
pielou_vector, = diversity_lib_actions.pielou_evenness(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$pielou_evenness(
table=feature_table,
)
pielou_vector <- action_results$vector
from q2_diversity_lib.examples import pielou_evenness_example
pielou_evenness_example(use)
dropping undefined samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
qiime diversity-lib pielou-evenness \
--i-table feature-table.qza \
--p-drop-undefined-samples \
--o-vector pielou-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
pielou_vector, = diversity_lib_actions.pielou_evenness(
table=feature_table,
drop_undefined_samples=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$pielou_evenness(
table=feature_table,
drop_undefined_samples=TRUE,
)
pielou_vector <- action_results$vector
from q2_diversity_lib.examples import pielou_drop_example
pielou_drop_example(use)
diversity-lib shannon-entropy¶
Compute Shannon's Entropy for each sample in a feature table
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Shannon's Entropy should be computed.[required]
Parameters¶
- drop_undefined_samples:
Bool Samples with no observed features produce undefined (NaN) values. If true, these samples are dropped from the output vector.[default:
False]- base:
Float%Range(0, None, inclusive_start=False)|Str%Choices('e') The logarithm base used in calculations.[default:
2]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Shannon's Entropy.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_entropy_example
shannon_entropy_example(use)
base_e¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--p-base e \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
base='e',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
base='e',
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_base_e_example
shannon_base_e_example(use)
dropping undefined samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--p-drop-undefined-samples \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
drop_undefined_samples=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
drop_undefined_samples=TRUE,
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_drop_example
shannon_drop_example(use)
diversity-lib bray-curtis¶
Compute Bray-Curtis dissimilarity for each sample in a feature table. Note: Frequency and relative frequency data produce different results unless overall sample sizes are identical. Please consider the impact on your results if you use Bray-Curtis with count data that has not been adjusted (normalized).
Citations¶
Sørensen, 1948
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Bray-Curtis dissimilarity should be computed.[required]
Parameters¶
- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Bray-Curtis dissimilarity[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_example
bray_curtis_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--p-n-jobs 1 \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
n_jobs=1L,
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_n_jobs_example
bray_curtis_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--p-n-jobs auto \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
n_jobs='auto',
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_auto_jobs_example
bray_curtis_auto_jobs_example(use)
diversity-lib jaccard¶
Compute Jaccard distance for each sample in a feature table. Jaccard is calculated usingpresence/absence data. Data of type FeatureTable[Frequency | Relative Frequency] is reducedto presence/absence prior to calculation.
Citations¶
Jaccard, 1908
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Jaccard distance should be computed.[required]
Parameters¶
- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Jaccard index[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_example
jaccard_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--p-n-jobs 1 \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
n_jobs=1L,
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_n_jobs_example
jaccard_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--p-n-jobs auto \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
n_jobs='auto',
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_auto_jobs_example
jaccard_auto_jobs_example(use)
diversity-lib unweighted-unifrac¶
Compute Unweighted Unifrac for each sample in a feature table
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Unweighted Unifrac should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Unweighted Unifrac.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_example
u_u_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_n_threads_example
u_u_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_auto_threads_example
u_u_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=TRUE,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_bypass_tips_example
u_u_bypass_tips_example(use)
diversity-lib weighted-unifrac¶
Compute Weighted Unifrac for each sample in a feature table
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Weighted Unifrac should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Unweighted Unifrac.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_example
w_u_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_n_threads_example
w_u_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_auto_threads_example
w_u_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=TRUE,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_bypass_tips_example
w_u_bypass_tips_example(use)
diversity-lib alpha-passthrough¶
Computes a vector of values (one value for each samples in a feature table) using the scikit-bio implementation of the selected alpha diversity metric.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples for which a selected metric should be computed.[required]
Parameters¶
- metric:
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', 'osd', 'robbins', 'simpson', 'simpson_e', 'singles', 'strong') The alpha diversity metric to be computed.[required]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for the chosen metric.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
qiime diversity-lib alpha-passthrough \
--i-table feature-table.qza \
--p-metric simpson \
--o-vector simpson-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
simpson_vector, = diversity_lib_actions.alpha_passthrough(
table=feature_table,
metric='simpson',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$alpha_passthrough(
table=feature_table,
metric='simpson',
)
simpson_vector <- action_results$vector
from q2_diversity_lib.examples import alpha_passthrough_example
alpha_passthrough_example(use)
diversity-lib beta-passthrough¶
Computes a distance matrix for all pairs of samples in a feature table using the scikit-bio implementation of the selected beta diversity metric.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples over which beta diversity should be computed.[required]
Parameters¶
- metric:
Str%Choices('aitchison', 'canberra', 'canberra_adkins', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jensenshannon', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalsneath', 'sqeuclidean', 'yule') The beta diversity metric to be computed.[required]
- pseudocount:
Int%Range(1, None) A pseudocount to handle zeros for compositional metrics. This is ignored for non-compositional metrics.[default:
1]- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric euclidean \
--o-distance-matrix euclidean-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
euclidean_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='euclidean',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='euclidean',
)
euclidean_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_example
beta_passthrough_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric euclidean \
--p-n-jobs 1 \
--o-distance-matrix euclidean-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
euclidean_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='euclidean',
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='euclidean',
n_jobs=1L,
)
euclidean_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_n_jobs_example
beta_passthrough_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
# A default pseudocount of 1 is added to feature counts. Pseudocount is
# ignored for non-compositional metrics.
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric aitchison \
--p-n-jobs auto \
--o-distance-matrix aitchison-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# A default pseudocount of 1 is added to feature counts. Pseudocount is ignored for non-compositional metrics.
aitchison_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# A default pseudocount of 1 is added to feature counts. Pseudocount is ignored for non-compositional metrics.
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
)
aitchison_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_auto_jobs_example
beta_passthrough_auto_jobs_example(use)
use 'pseudocount' to manually set a pseudocount for compositional metrics¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric aitchison \
--p-n-jobs auto \
--p-pseudocount 5 \
--o-distance-matrix aitchison-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
aitchison_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
pseudocount=5,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
pseudocount=5L,
)
aitchison_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_pseudocount_example
beta_passthrough_pseudocount_example(use)
diversity-lib beta-phylogenetic-passthrough¶
Computes a distance matrix for all pairs of samples in a feature table using the unifrac implementation of the selected beta diversity metric.
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018; Chang et al., 2011; Chen et al., 2012; Sfiligoi et al., n.d.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples over which beta diversity should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- metric:
Str%Choices('generalized_unifrac', 'unweighted_unifrac', 'weighted_normalized_unifrac', 'weighted_unifrac') The beta diversity metric to be computed.[required]
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- variance_adjusted:
Bool Perform variance adjustment based on Chang et al. BMC Bioinformatics 2011. Weights distances based on the proportion of the relative abundance represented between the samples at a given node under evaluation.[default:
False]- alpha:
Float%Range(0, 1, inclusive_end=True) This parameter is only used when the choice of metric is generalized_unifrac. The value of alpha controls importance of sample proportions. 1.0 is weighted normalized UniFrac. 0.0 is close to unweighted UniFrac, but only if the sample proportions are dichotomized.[optional]
- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_example
beta_phylo_passthrough_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads=1,
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_n_threads_example
beta_phylo_passthrough_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_auto_threads_example
beta_phylo_passthrough_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
threads='auto',
bypass_tips=TRUE,
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_bypass_tips_example
beta_phylo_passthrough_bypass_tips_example(use)
variance adjustment¶
# Chang et al's variance adjustment may be applied to any unifrac method by
# using this passthrough function.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_unifrac \
--p-threads auto \
--p-variance-adjusted \
--o-distance-matrix var-adj-weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# Chang et al's variance adjustment may be applied to any unifrac method by using this passthrough function.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
var_adj_weighted_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_unifrac',
threads='auto',
variance_adjusted=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# Chang et al's variance adjustment may be applied to any unifrac method by using this passthrough function.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_unifrac',
threads='auto',
variance_adjusted=TRUE,
)
var_adj_weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_variance_adjusted_example
beta_phylo_passthrough_variance_adjusted_example(use)
minimal generalized unifrac¶
# Generalized unifrac is passed alpha=1 by default. This is roughly
# equivalent to weighted normalized unifrac, which method will be used
# instead, because it is better optimized.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric generalized_unifrac \
--o-distance-matrix generalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# Generalized unifrac is passed alpha=1 by default. This is roughly equivalent to weighted normalized unifrac, which method will be used instead, because it is better optimized.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
generalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# Generalized unifrac is passed alpha=1 by default. This is roughly equivalent to weighted normalized unifrac, which method will be used instead, because it is better optimized.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
)
generalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_min_generalized_unifrac_example
beta_phylo_passthrough_min_generalized_unifrac_example(use)
generalized unifrac¶
# passing a float between 0 and 1 to 'alpha' gives you control over the
# importance of sample proportions.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric generalized_unifrac \
--p-alpha 0.75 \
--o-distance-matrix generalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# passing a float between 0 and 1 to 'alpha' gives you control over the importance of sample proportions.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
generalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
alpha=0.75,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# passing a float between 0 and 1 to 'alpha' gives you control over the importance of sample proportions.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
alpha=0.75,
)
generalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_generalized_unifrac_example
beta_phylo_passthrough_generalized_unifrac_example(use)
diversity-lib beta-phylogenetic-meta-passthrough¶
Computes a distance matrix for all pairs of samples in the set of feature table and phylogeny pairs, using the unifrac implementation of the selected beta diversity metric.
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018; Chang et al., 2011; Chen et al., 2012; Lozupone et al., 2008
Inputs¶
- tables:
List[FeatureTable[Frequency]] The feature tables containing the samples over which beta diversity should be computed.[required]
- phylogenies:
List[Phylogeny[Rooted]] Phylogenetic trees containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- metric:
Str%Choices('generalized_unifrac', 'unweighted_unifrac', 'weighted_normalized_unifrac', 'weighted_unifrac') The beta diversity metric to be computed.[required]
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- variance_adjusted:
Bool Perform variance adjustment based on Chang et al. BMC Bioinformatics 2011. Weights distances based on the proportion of the relative abundance represented between the samples at a given node under evaluation.[default:
False]- alpha:
Float%Range(0, 1, inclusive_end=True) This parameter is only used when the choice of metric is generalized_unifrac. The value of alpha controls importance of sample proportions. 1.0 is weighted normalized UniFrac. 0.0 is close to unweighted UniFrac, but only if the sample proportions are dichotomized.[optional]
- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]- weights:
List[Float] The weight applied to each tree/table pair. This tuple is expected to be in index order with tables and phylogenies. Default is to weight each tree/table pair evenly.[optional]
- consolidation:
Str%Choices('skipping_missing_matrices', 'missing_zero', 'missing_one', 'skipping_missing_values') The matrix consolidation method, which determines how the individual distance matrices are aggregated[default:
'skipping_missing_values']
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
Basic meta unifrac¶
# For brevity, these examples are focused on meta-specific parameters. See
# the documentation for beta_phylogenetic_passthrough for additional
# relevant information.
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
wget -O 'phylogeny1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
wget -O 'phylogeny2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
# NOTE: the number of trees and tables must match.
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny1.qza phylogeny2.qza \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# For brevity, these examples are focused on meta-specific parameters. See the documentation for beta_phylogenetic_passthrough for additional relevant information.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
fn = 'phylogeny1.qza'
request.urlretrieve(url, fn)
phylogeny1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
fn = 'phylogeny2.qza'
request.urlretrieve(url, fn)
phylogeny2 = Artifact.load(fn)
# NOTE: the number of trees and tables must match.
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny1, phylogeny2],
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# For brevity, these examples are focused on meta-specific parameters. See the documentation for beta_phylogenetic_passthrough for additional relevant information.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
fn <- 'phylogeny1.qza'
request$urlretrieve(url, fn)
phylogeny1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
fn <- 'phylogeny2.qza'
request$urlretrieve(url, fn)
phylogeny2 <- Artifact$load(fn)
# NOTE: the number of trees and tables must match.
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny1, phylogeny2),
metric='weighted_normalized_unifrac',
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_passthrough_example
beta_phylo_meta_passthrough_example(use)
meta with weights¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny.qza phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--p-weights 3.0 42.0 \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny, phylogeny],
metric='weighted_normalized_unifrac',
weights=[3.0, 42.0],
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny, phylogeny),
metric='weighted_normalized_unifrac',
weights=list(3.0, 42.0),
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_weights_example
beta_phylo_meta_weights_example(use)
changing the consolidation method¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
wget -O 'phylogeny1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
wget -O 'phylogeny2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny1.qza phylogeny2.qza \
--p-metric weighted_normalized_unifrac \
--p-weights 0.4 0.6 \
--p-consolidation skipping_missing_values \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
fn = 'phylogeny1.qza'
request.urlretrieve(url, fn)
phylogeny1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
fn = 'phylogeny2.qza'
request.urlretrieve(url, fn)
phylogeny2 = Artifact.load(fn)
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny1, phylogeny2],
metric='weighted_normalized_unifrac',
weights=[0.4, 0.6],
consolidation='skipping_missing_values',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
fn <- 'phylogeny1.qza'
request$urlretrieve(url, fn)
phylogeny1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
fn <- 'phylogeny2.qza'
request$urlretrieve(url, fn)
phylogeny2 <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny1, phylogeny2),
metric='weighted_normalized_unifrac',
weights=list(0.4, 0.6),
consolidation='skipping_missing_values',
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_consolidation_example
beta_phylo_meta_consolidation_example(use)
This QIIME 2 plugin computes individual metrics for community alpha and beta diversity.
- version:
2026.4.0 - website: https://
github .com /qiime2 /q2 -diversity -lib - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
| Name | Type | Short Description |
|---|---|---|
| faith-pd | method | Faith's Phylogenetic Diversity |
| observed-features | method | Observed Features |
| pielou-evenness | method | Pielou's Evenness |
| shannon-entropy | method | Shannon's Entropy |
| bray-curtis | method | Bray-Curtis Dissimilarity |
| jaccard | method | Jaccard Distance |
| unweighted-unifrac | method | Unweighted Unifrac |
| weighted-unifrac | method | Weighted Unifrac |
| alpha-passthrough | method | Alpha Passthrough (non-phylogenetic) |
| beta-passthrough | method | Beta Passthrough (non-phylogenetic) |
| beta-phylogenetic-passthrough | method | Beta Phylogenetic Passthrough |
| beta-phylogenetic-meta-passthrough | method | Beta Phylogenetic Meta Passthrough |
diversity-lib faith-pd¶
Computes Faith's Phylogenetic Diversity for all samples in a feature table.
Citations¶
Faith, 1992; Armstrong et al., 2021
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Faith's phylogenetic diversity should be computed. Table values will be converted to presence/absence.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Faith's Phylogenetic Diversity.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
qiime diversity-lib faith-pd \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-vector faith-pd-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
faith_pd_vector, = diversity_lib_actions.faith_pd(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$faith_pd(
table=feature_table,
phylogeny=phylogeny,
)
faith_pd_vector <- action_results$vector
from q2_diversity_lib.examples import faith_pd_example
faith_pd_example(use)
diversity-lib observed-features¶
Compute the number of observed features for each sample in a feature table
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which the number of observed features should be calculated. Table values will be converted to presence/absence.[required]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample counts of observed features.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
qiime diversity-lib observed-features \
--i-table feature-table.qza \
--o-vector obs-feat-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
obs_feat_vector, = diversity_lib_actions.observed_features(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$observed_features(
table=feature_table,
)
obs_feat_vector <- action_results$vector
from q2_diversity_lib.examples import observed_features_example
observed_features_example(use)
diversity-lib pielou-evenness¶
Compute Pielou's Evenness for each sample in a feature table
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Pielou's evenness should be computed.[required]
Parameters¶
- drop_undefined_samples:
Bool Samples with fewer than two observed features produce undefined (NaN) values. If true, these samples are dropped from the output vector.[default:
False]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Pielou's Evenness.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
qiime diversity-lib pielou-evenness \
--i-table feature-table.qza \
--o-vector pielou-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
pielou_vector, = diversity_lib_actions.pielou_evenness(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$pielou_evenness(
table=feature_table,
)
pielou_vector <- action_results$vector
from q2_diversity_lib.examples import pielou_evenness_example
pielou_evenness_example(use)
dropping undefined samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
qiime diversity-lib pielou-evenness \
--i-table feature-table.qza \
--p-drop-undefined-samples \
--o-vector pielou-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
pielou_vector, = diversity_lib_actions.pielou_evenness(
table=feature_table,
drop_undefined_samples=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$pielou_evenness(
table=feature_table,
drop_undefined_samples=TRUE,
)
pielou_vector <- action_results$vector
from q2_diversity_lib.examples import pielou_drop_example
pielou_drop_example(use)
diversity-lib shannon-entropy¶
Compute Shannon's Entropy for each sample in a feature table
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Shannon's Entropy should be computed.[required]
Parameters¶
- drop_undefined_samples:
Bool Samples with no observed features produce undefined (NaN) values. If true, these samples are dropped from the output vector.[default:
False]- base:
Float%Range(0, None, inclusive_start=False)|Str%Choices('e') The logarithm base used in calculations.[default:
2]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Shannon's Entropy.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_entropy_example
shannon_entropy_example(use)
base_e¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--p-base e \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
base='e',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
base='e',
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_base_e_example
shannon_base_e_example(use)
dropping undefined samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--p-drop-undefined-samples \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
drop_undefined_samples=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
drop_undefined_samples=TRUE,
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_drop_example
shannon_drop_example(use)
diversity-lib bray-curtis¶
Compute Bray-Curtis dissimilarity for each sample in a feature table. Note: Frequency and relative frequency data produce different results unless overall sample sizes are identical. Please consider the impact on your results if you use Bray-Curtis with count data that has not been adjusted (normalized).
Citations¶
Sørensen, 1948
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Bray-Curtis dissimilarity should be computed.[required]
Parameters¶
- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Bray-Curtis dissimilarity[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_example
bray_curtis_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--p-n-jobs 1 \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
n_jobs=1L,
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_n_jobs_example
bray_curtis_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--p-n-jobs auto \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
n_jobs='auto',
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_auto_jobs_example
bray_curtis_auto_jobs_example(use)
diversity-lib jaccard¶
Compute Jaccard distance for each sample in a feature table. Jaccard is calculated usingpresence/absence data. Data of type FeatureTable[Frequency | Relative Frequency] is reducedto presence/absence prior to calculation.
Citations¶
Jaccard, 1908
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Jaccard distance should be computed.[required]
Parameters¶
- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Jaccard index[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_example
jaccard_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--p-n-jobs 1 \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
n_jobs=1L,
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_n_jobs_example
jaccard_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--p-n-jobs auto \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
n_jobs='auto',
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_auto_jobs_example
jaccard_auto_jobs_example(use)
diversity-lib unweighted-unifrac¶
Compute Unweighted Unifrac for each sample in a feature table
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Unweighted Unifrac should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Unweighted Unifrac.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_example
u_u_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_n_threads_example
u_u_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_auto_threads_example
u_u_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=TRUE,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_bypass_tips_example
u_u_bypass_tips_example(use)
diversity-lib weighted-unifrac¶
Compute Weighted Unifrac for each sample in a feature table
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Weighted Unifrac should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Unweighted Unifrac.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_example
w_u_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_n_threads_example
w_u_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_auto_threads_example
w_u_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=TRUE,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_bypass_tips_example
w_u_bypass_tips_example(use)
diversity-lib alpha-passthrough¶
Computes a vector of values (one value for each samples in a feature table) using the scikit-bio implementation of the selected alpha diversity metric.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples for which a selected metric should be computed.[required]
Parameters¶
- metric:
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', 'osd', 'robbins', 'simpson', 'simpson_e', 'singles', 'strong') The alpha diversity metric to be computed.[required]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for the chosen metric.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
qiime diversity-lib alpha-passthrough \
--i-table feature-table.qza \
--p-metric simpson \
--o-vector simpson-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
simpson_vector, = diversity_lib_actions.alpha_passthrough(
table=feature_table,
metric='simpson',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$alpha_passthrough(
table=feature_table,
metric='simpson',
)
simpson_vector <- action_results$vector
from q2_diversity_lib.examples import alpha_passthrough_example
alpha_passthrough_example(use)
diversity-lib beta-passthrough¶
Computes a distance matrix for all pairs of samples in a feature table using the scikit-bio implementation of the selected beta diversity metric.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples over which beta diversity should be computed.[required]
Parameters¶
- metric:
Str%Choices('aitchison', 'canberra', 'canberra_adkins', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jensenshannon', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalsneath', 'sqeuclidean', 'yule') The beta diversity metric to be computed.[required]
- pseudocount:
Int%Range(1, None) A pseudocount to handle zeros for compositional metrics. This is ignored for non-compositional metrics.[default:
1]- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric euclidean \
--o-distance-matrix euclidean-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
euclidean_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='euclidean',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='euclidean',
)
euclidean_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_example
beta_passthrough_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric euclidean \
--p-n-jobs 1 \
--o-distance-matrix euclidean-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
euclidean_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='euclidean',
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='euclidean',
n_jobs=1L,
)
euclidean_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_n_jobs_example
beta_passthrough_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
# A default pseudocount of 1 is added to feature counts. Pseudocount is
# ignored for non-compositional metrics.
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric aitchison \
--p-n-jobs auto \
--o-distance-matrix aitchison-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# A default pseudocount of 1 is added to feature counts. Pseudocount is ignored for non-compositional metrics.
aitchison_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# A default pseudocount of 1 is added to feature counts. Pseudocount is ignored for non-compositional metrics.
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
)
aitchison_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_auto_jobs_example
beta_passthrough_auto_jobs_example(use)
use 'pseudocount' to manually set a pseudocount for compositional metrics¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric aitchison \
--p-n-jobs auto \
--p-pseudocount 5 \
--o-distance-matrix aitchison-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
aitchison_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
pseudocount=5,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
pseudocount=5L,
)
aitchison_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_pseudocount_example
beta_passthrough_pseudocount_example(use)
diversity-lib beta-phylogenetic-passthrough¶
Computes a distance matrix for all pairs of samples in a feature table using the unifrac implementation of the selected beta diversity metric.
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018; Chang et al., 2011; Chen et al., 2012; Sfiligoi et al., n.d.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples over which beta diversity should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- metric:
Str%Choices('generalized_unifrac', 'unweighted_unifrac', 'weighted_normalized_unifrac', 'weighted_unifrac') The beta diversity metric to be computed.[required]
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- variance_adjusted:
Bool Perform variance adjustment based on Chang et al. BMC Bioinformatics 2011. Weights distances based on the proportion of the relative abundance represented between the samples at a given node under evaluation.[default:
False]- alpha:
Float%Range(0, 1, inclusive_end=True) This parameter is only used when the choice of metric is generalized_unifrac. The value of alpha controls importance of sample proportions. 1.0 is weighted normalized UniFrac. 0.0 is close to unweighted UniFrac, but only if the sample proportions are dichotomized.[optional]
- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_example
beta_phylo_passthrough_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads=1,
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_n_threads_example
beta_phylo_passthrough_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_auto_threads_example
beta_phylo_passthrough_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
threads='auto',
bypass_tips=TRUE,
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_bypass_tips_example
beta_phylo_passthrough_bypass_tips_example(use)
variance adjustment¶
# Chang et al's variance adjustment may be applied to any unifrac method by
# using this passthrough function.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_unifrac \
--p-threads auto \
--p-variance-adjusted \
--o-distance-matrix var-adj-weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# Chang et al's variance adjustment may be applied to any unifrac method by using this passthrough function.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
var_adj_weighted_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_unifrac',
threads='auto',
variance_adjusted=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# Chang et al's variance adjustment may be applied to any unifrac method by using this passthrough function.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_unifrac',
threads='auto',
variance_adjusted=TRUE,
)
var_adj_weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_variance_adjusted_example
beta_phylo_passthrough_variance_adjusted_example(use)
minimal generalized unifrac¶
# Generalized unifrac is passed alpha=1 by default. This is roughly
# equivalent to weighted normalized unifrac, which method will be used
# instead, because it is better optimized.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric generalized_unifrac \
--o-distance-matrix generalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# Generalized unifrac is passed alpha=1 by default. This is roughly equivalent to weighted normalized unifrac, which method will be used instead, because it is better optimized.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
generalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# Generalized unifrac is passed alpha=1 by default. This is roughly equivalent to weighted normalized unifrac, which method will be used instead, because it is better optimized.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
)
generalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_min_generalized_unifrac_example
beta_phylo_passthrough_min_generalized_unifrac_example(use)
generalized unifrac¶
# passing a float between 0 and 1 to 'alpha' gives you control over the
# importance of sample proportions.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric generalized_unifrac \
--p-alpha 0.75 \
--o-distance-matrix generalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# passing a float between 0 and 1 to 'alpha' gives you control over the importance of sample proportions.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
generalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
alpha=0.75,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# passing a float between 0 and 1 to 'alpha' gives you control over the importance of sample proportions.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
alpha=0.75,
)
generalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_generalized_unifrac_example
beta_phylo_passthrough_generalized_unifrac_example(use)
diversity-lib beta-phylogenetic-meta-passthrough¶
Computes a distance matrix for all pairs of samples in the set of feature table and phylogeny pairs, using the unifrac implementation of the selected beta diversity metric.
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018; Chang et al., 2011; Chen et al., 2012; Lozupone et al., 2008
Inputs¶
- tables:
List[FeatureTable[Frequency]] The feature tables containing the samples over which beta diversity should be computed.[required]
- phylogenies:
List[Phylogeny[Rooted]] Phylogenetic trees containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- metric:
Str%Choices('generalized_unifrac', 'unweighted_unifrac', 'weighted_normalized_unifrac', 'weighted_unifrac') The beta diversity metric to be computed.[required]
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- variance_adjusted:
Bool Perform variance adjustment based on Chang et al. BMC Bioinformatics 2011. Weights distances based on the proportion of the relative abundance represented between the samples at a given node under evaluation.[default:
False]- alpha:
Float%Range(0, 1, inclusive_end=True) This parameter is only used when the choice of metric is generalized_unifrac. The value of alpha controls importance of sample proportions. 1.0 is weighted normalized UniFrac. 0.0 is close to unweighted UniFrac, but only if the sample proportions are dichotomized.[optional]
- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]- weights:
List[Float] The weight applied to each tree/table pair. This tuple is expected to be in index order with tables and phylogenies. Default is to weight each tree/table pair evenly.[optional]
- consolidation:
Str%Choices('skipping_missing_matrices', 'missing_zero', 'missing_one', 'skipping_missing_values') The matrix consolidation method, which determines how the individual distance matrices are aggregated[default:
'skipping_missing_values']
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
Basic meta unifrac¶
# For brevity, these examples are focused on meta-specific parameters. See
# the documentation for beta_phylogenetic_passthrough for additional
# relevant information.
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
wget -O 'phylogeny1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
wget -O 'phylogeny2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
# NOTE: the number of trees and tables must match.
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny1.qza phylogeny2.qza \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# For brevity, these examples are focused on meta-specific parameters. See the documentation for beta_phylogenetic_passthrough for additional relevant information.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
fn = 'phylogeny1.qza'
request.urlretrieve(url, fn)
phylogeny1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
fn = 'phylogeny2.qza'
request.urlretrieve(url, fn)
phylogeny2 = Artifact.load(fn)
# NOTE: the number of trees and tables must match.
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny1, phylogeny2],
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# For brevity, these examples are focused on meta-specific parameters. See the documentation for beta_phylogenetic_passthrough for additional relevant information.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
fn <- 'phylogeny1.qza'
request$urlretrieve(url, fn)
phylogeny1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
fn <- 'phylogeny2.qza'
request$urlretrieve(url, fn)
phylogeny2 <- Artifact$load(fn)
# NOTE: the number of trees and tables must match.
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny1, phylogeny2),
metric='weighted_normalized_unifrac',
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_passthrough_example
beta_phylo_meta_passthrough_example(use)
meta with weights¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny.qza phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--p-weights 3.0 42.0 \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny, phylogeny],
metric='weighted_normalized_unifrac',
weights=[3.0, 42.0],
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny, phylogeny),
metric='weighted_normalized_unifrac',
weights=list(3.0, 42.0),
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_weights_example
beta_phylo_meta_weights_example(use)
changing the consolidation method¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
wget -O 'phylogeny1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
wget -O 'phylogeny2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny1.qza phylogeny2.qza \
--p-metric weighted_normalized_unifrac \
--p-weights 0.4 0.6 \
--p-consolidation skipping_missing_values \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
fn = 'phylogeny1.qza'
request.urlretrieve(url, fn)
phylogeny1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
fn = 'phylogeny2.qza'
request.urlretrieve(url, fn)
phylogeny2 = Artifact.load(fn)
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny1, phylogeny2],
metric='weighted_normalized_unifrac',
weights=[0.4, 0.6],
consolidation='skipping_missing_values',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
fn <- 'phylogeny1.qza'
request$urlretrieve(url, fn)
phylogeny1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
fn <- 'phylogeny2.qza'
request$urlretrieve(url, fn)
phylogeny2 <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny1, phylogeny2),
metric='weighted_normalized_unifrac',
weights=list(0.4, 0.6),
consolidation='skipping_missing_values',
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_consolidation_example
beta_phylo_meta_consolidation_example(use)
This QIIME 2 plugin computes individual metrics for community alpha and beta diversity.
- version:
2026.4.0 - website: https://
github .com /qiime2 /q2 -diversity -lib - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
| Name | Type | Short Description |
|---|---|---|
| faith-pd | method | Faith's Phylogenetic Diversity |
| observed-features | method | Observed Features |
| pielou-evenness | method | Pielou's Evenness |
| shannon-entropy | method | Shannon's Entropy |
| bray-curtis | method | Bray-Curtis Dissimilarity |
| jaccard | method | Jaccard Distance |
| unweighted-unifrac | method | Unweighted Unifrac |
| weighted-unifrac | method | Weighted Unifrac |
| alpha-passthrough | method | Alpha Passthrough (non-phylogenetic) |
| beta-passthrough | method | Beta Passthrough (non-phylogenetic) |
| beta-phylogenetic-passthrough | method | Beta Phylogenetic Passthrough |
| beta-phylogenetic-meta-passthrough | method | Beta Phylogenetic Meta Passthrough |
diversity-lib faith-pd¶
Computes Faith's Phylogenetic Diversity for all samples in a feature table.
Citations¶
Faith, 1992; Armstrong et al., 2021
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Faith's phylogenetic diversity should be computed. Table values will be converted to presence/absence.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Faith's Phylogenetic Diversity.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
qiime diversity-lib faith-pd \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-vector faith-pd-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
faith_pd_vector, = diversity_lib_actions.faith_pd(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$faith_pd(
table=feature_table,
phylogeny=phylogeny,
)
faith_pd_vector <- action_results$vector
from q2_diversity_lib.examples import faith_pd_example
faith_pd_example(use)
diversity-lib observed-features¶
Compute the number of observed features for each sample in a feature table
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which the number of observed features should be calculated. Table values will be converted to presence/absence.[required]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample counts of observed features.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
qiime diversity-lib observed-features \
--i-table feature-table.qza \
--o-vector obs-feat-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
obs_feat_vector, = diversity_lib_actions.observed_features(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$observed_features(
table=feature_table,
)
obs_feat_vector <- action_results$vector
from q2_diversity_lib.examples import observed_features_example
observed_features_example(use)
diversity-lib pielou-evenness¶
Compute Pielou's Evenness for each sample in a feature table
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Pielou's evenness should be computed.[required]
Parameters¶
- drop_undefined_samples:
Bool Samples with fewer than two observed features produce undefined (NaN) values. If true, these samples are dropped from the output vector.[default:
False]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Pielou's Evenness.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
qiime diversity-lib pielou-evenness \
--i-table feature-table.qza \
--o-vector pielou-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
pielou_vector, = diversity_lib_actions.pielou_evenness(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$pielou_evenness(
table=feature_table,
)
pielou_vector <- action_results$vector
from q2_diversity_lib.examples import pielou_evenness_example
pielou_evenness_example(use)
dropping undefined samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
qiime diversity-lib pielou-evenness \
--i-table feature-table.qza \
--p-drop-undefined-samples \
--o-vector pielou-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
pielou_vector, = diversity_lib_actions.pielou_evenness(
table=feature_table,
drop_undefined_samples=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$pielou_evenness(
table=feature_table,
drop_undefined_samples=TRUE,
)
pielou_vector <- action_results$vector
from q2_diversity_lib.examples import pielou_drop_example
pielou_drop_example(use)
diversity-lib shannon-entropy¶
Compute Shannon's Entropy for each sample in a feature table
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Shannon's Entropy should be computed.[required]
Parameters¶
- drop_undefined_samples:
Bool Samples with no observed features produce undefined (NaN) values. If true, these samples are dropped from the output vector.[default:
False]- base:
Float%Range(0, None, inclusive_start=False)|Str%Choices('e') The logarithm base used in calculations.[default:
2]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Shannon's Entropy.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_entropy_example
shannon_entropy_example(use)
base_e¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--p-base e \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
base='e',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
base='e',
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_base_e_example
shannon_base_e_example(use)
dropping undefined samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--p-drop-undefined-samples \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
drop_undefined_samples=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
drop_undefined_samples=TRUE,
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_drop_example
shannon_drop_example(use)
diversity-lib bray-curtis¶
Compute Bray-Curtis dissimilarity for each sample in a feature table. Note: Frequency and relative frequency data produce different results unless overall sample sizes are identical. Please consider the impact on your results if you use Bray-Curtis with count data that has not been adjusted (normalized).
Citations¶
Sørensen, 1948
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Bray-Curtis dissimilarity should be computed.[required]
Parameters¶
- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Bray-Curtis dissimilarity[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_example
bray_curtis_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--p-n-jobs 1 \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
n_jobs=1L,
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_n_jobs_example
bray_curtis_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--p-n-jobs auto \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
n_jobs='auto',
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_auto_jobs_example
bray_curtis_auto_jobs_example(use)
diversity-lib jaccard¶
Compute Jaccard distance for each sample in a feature table. Jaccard is calculated usingpresence/absence data. Data of type FeatureTable[Frequency | Relative Frequency] is reducedto presence/absence prior to calculation.
Citations¶
Jaccard, 1908
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Jaccard distance should be computed.[required]
Parameters¶
- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Jaccard index[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_example
jaccard_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--p-n-jobs 1 \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
n_jobs=1L,
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_n_jobs_example
jaccard_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--p-n-jobs auto \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
n_jobs='auto',
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_auto_jobs_example
jaccard_auto_jobs_example(use)
diversity-lib unweighted-unifrac¶
Compute Unweighted Unifrac for each sample in a feature table
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Unweighted Unifrac should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Unweighted Unifrac.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_example
u_u_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_n_threads_example
u_u_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_auto_threads_example
u_u_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=TRUE,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_bypass_tips_example
u_u_bypass_tips_example(use)
diversity-lib weighted-unifrac¶
Compute Weighted Unifrac for each sample in a feature table
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Weighted Unifrac should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Unweighted Unifrac.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_example
w_u_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_n_threads_example
w_u_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_auto_threads_example
w_u_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=TRUE,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_bypass_tips_example
w_u_bypass_tips_example(use)
diversity-lib alpha-passthrough¶
Computes a vector of values (one value for each samples in a feature table) using the scikit-bio implementation of the selected alpha diversity metric.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples for which a selected metric should be computed.[required]
Parameters¶
- metric:
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', 'osd', 'robbins', 'simpson', 'simpson_e', 'singles', 'strong') The alpha diversity metric to be computed.[required]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for the chosen metric.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
qiime diversity-lib alpha-passthrough \
--i-table feature-table.qza \
--p-metric simpson \
--o-vector simpson-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
simpson_vector, = diversity_lib_actions.alpha_passthrough(
table=feature_table,
metric='simpson',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$alpha_passthrough(
table=feature_table,
metric='simpson',
)
simpson_vector <- action_results$vector
from q2_diversity_lib.examples import alpha_passthrough_example
alpha_passthrough_example(use)
diversity-lib beta-passthrough¶
Computes a distance matrix for all pairs of samples in a feature table using the scikit-bio implementation of the selected beta diversity metric.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples over which beta diversity should be computed.[required]
Parameters¶
- metric:
Str%Choices('aitchison', 'canberra', 'canberra_adkins', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jensenshannon', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalsneath', 'sqeuclidean', 'yule') The beta diversity metric to be computed.[required]
- pseudocount:
Int%Range(1, None) A pseudocount to handle zeros for compositional metrics. This is ignored for non-compositional metrics.[default:
1]- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric euclidean \
--o-distance-matrix euclidean-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
euclidean_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='euclidean',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='euclidean',
)
euclidean_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_example
beta_passthrough_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric euclidean \
--p-n-jobs 1 \
--o-distance-matrix euclidean-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
euclidean_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='euclidean',
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='euclidean',
n_jobs=1L,
)
euclidean_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_n_jobs_example
beta_passthrough_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
# A default pseudocount of 1 is added to feature counts. Pseudocount is
# ignored for non-compositional metrics.
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric aitchison \
--p-n-jobs auto \
--o-distance-matrix aitchison-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# A default pseudocount of 1 is added to feature counts. Pseudocount is ignored for non-compositional metrics.
aitchison_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# A default pseudocount of 1 is added to feature counts. Pseudocount is ignored for non-compositional metrics.
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
)
aitchison_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_auto_jobs_example
beta_passthrough_auto_jobs_example(use)
use 'pseudocount' to manually set a pseudocount for compositional metrics¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric aitchison \
--p-n-jobs auto \
--p-pseudocount 5 \
--o-distance-matrix aitchison-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
aitchison_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
pseudocount=5,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
pseudocount=5L,
)
aitchison_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_pseudocount_example
beta_passthrough_pseudocount_example(use)
diversity-lib beta-phylogenetic-passthrough¶
Computes a distance matrix for all pairs of samples in a feature table using the unifrac implementation of the selected beta diversity metric.
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018; Chang et al., 2011; Chen et al., 2012; Sfiligoi et al., n.d.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples over which beta diversity should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- metric:
Str%Choices('generalized_unifrac', 'unweighted_unifrac', 'weighted_normalized_unifrac', 'weighted_unifrac') The beta diversity metric to be computed.[required]
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- variance_adjusted:
Bool Perform variance adjustment based on Chang et al. BMC Bioinformatics 2011. Weights distances based on the proportion of the relative abundance represented between the samples at a given node under evaluation.[default:
False]- alpha:
Float%Range(0, 1, inclusive_end=True) This parameter is only used when the choice of metric is generalized_unifrac. The value of alpha controls importance of sample proportions. 1.0 is weighted normalized UniFrac. 0.0 is close to unweighted UniFrac, but only if the sample proportions are dichotomized.[optional]
- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_example
beta_phylo_passthrough_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads=1,
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_n_threads_example
beta_phylo_passthrough_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_auto_threads_example
beta_phylo_passthrough_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
threads='auto',
bypass_tips=TRUE,
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_bypass_tips_example
beta_phylo_passthrough_bypass_tips_example(use)
variance adjustment¶
# Chang et al's variance adjustment may be applied to any unifrac method by
# using this passthrough function.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_unifrac \
--p-threads auto \
--p-variance-adjusted \
--o-distance-matrix var-adj-weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# Chang et al's variance adjustment may be applied to any unifrac method by using this passthrough function.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
var_adj_weighted_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_unifrac',
threads='auto',
variance_adjusted=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# Chang et al's variance adjustment may be applied to any unifrac method by using this passthrough function.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_unifrac',
threads='auto',
variance_adjusted=TRUE,
)
var_adj_weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_variance_adjusted_example
beta_phylo_passthrough_variance_adjusted_example(use)
minimal generalized unifrac¶
# Generalized unifrac is passed alpha=1 by default. This is roughly
# equivalent to weighted normalized unifrac, which method will be used
# instead, because it is better optimized.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric generalized_unifrac \
--o-distance-matrix generalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# Generalized unifrac is passed alpha=1 by default. This is roughly equivalent to weighted normalized unifrac, which method will be used instead, because it is better optimized.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
generalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# Generalized unifrac is passed alpha=1 by default. This is roughly equivalent to weighted normalized unifrac, which method will be used instead, because it is better optimized.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
)
generalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_min_generalized_unifrac_example
beta_phylo_passthrough_min_generalized_unifrac_example(use)
generalized unifrac¶
# passing a float between 0 and 1 to 'alpha' gives you control over the
# importance of sample proportions.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric generalized_unifrac \
--p-alpha 0.75 \
--o-distance-matrix generalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# passing a float between 0 and 1 to 'alpha' gives you control over the importance of sample proportions.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
generalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
alpha=0.75,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# passing a float between 0 and 1 to 'alpha' gives you control over the importance of sample proportions.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
alpha=0.75,
)
generalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_generalized_unifrac_example
beta_phylo_passthrough_generalized_unifrac_example(use)
diversity-lib beta-phylogenetic-meta-passthrough¶
Computes a distance matrix for all pairs of samples in the set of feature table and phylogeny pairs, using the unifrac implementation of the selected beta diversity metric.
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018; Chang et al., 2011; Chen et al., 2012; Lozupone et al., 2008
Inputs¶
- tables:
List[FeatureTable[Frequency]] The feature tables containing the samples over which beta diversity should be computed.[required]
- phylogenies:
List[Phylogeny[Rooted]] Phylogenetic trees containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- metric:
Str%Choices('generalized_unifrac', 'unweighted_unifrac', 'weighted_normalized_unifrac', 'weighted_unifrac') The beta diversity metric to be computed.[required]
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- variance_adjusted:
Bool Perform variance adjustment based on Chang et al. BMC Bioinformatics 2011. Weights distances based on the proportion of the relative abundance represented between the samples at a given node under evaluation.[default:
False]- alpha:
Float%Range(0, 1, inclusive_end=True) This parameter is only used when the choice of metric is generalized_unifrac. The value of alpha controls importance of sample proportions. 1.0 is weighted normalized UniFrac. 0.0 is close to unweighted UniFrac, but only if the sample proportions are dichotomized.[optional]
- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]- weights:
List[Float] The weight applied to each tree/table pair. This tuple is expected to be in index order with tables and phylogenies. Default is to weight each tree/table pair evenly.[optional]
- consolidation:
Str%Choices('skipping_missing_matrices', 'missing_zero', 'missing_one', 'skipping_missing_values') The matrix consolidation method, which determines how the individual distance matrices are aggregated[default:
'skipping_missing_values']
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
Basic meta unifrac¶
# For brevity, these examples are focused on meta-specific parameters. See
# the documentation for beta_phylogenetic_passthrough for additional
# relevant information.
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
wget -O 'phylogeny1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
wget -O 'phylogeny2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
# NOTE: the number of trees and tables must match.
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny1.qza phylogeny2.qza \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# For brevity, these examples are focused on meta-specific parameters. See the documentation for beta_phylogenetic_passthrough for additional relevant information.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
fn = 'phylogeny1.qza'
request.urlretrieve(url, fn)
phylogeny1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
fn = 'phylogeny2.qza'
request.urlretrieve(url, fn)
phylogeny2 = Artifact.load(fn)
# NOTE: the number of trees and tables must match.
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny1, phylogeny2],
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# For brevity, these examples are focused on meta-specific parameters. See the documentation for beta_phylogenetic_passthrough for additional relevant information.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
fn <- 'phylogeny1.qza'
request$urlretrieve(url, fn)
phylogeny1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
fn <- 'phylogeny2.qza'
request$urlretrieve(url, fn)
phylogeny2 <- Artifact$load(fn)
# NOTE: the number of trees and tables must match.
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny1, phylogeny2),
metric='weighted_normalized_unifrac',
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_passthrough_example
beta_phylo_meta_passthrough_example(use)
meta with weights¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny.qza phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--p-weights 3.0 42.0 \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny, phylogeny],
metric='weighted_normalized_unifrac',
weights=[3.0, 42.0],
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny, phylogeny),
metric='weighted_normalized_unifrac',
weights=list(3.0, 42.0),
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_weights_example
beta_phylo_meta_weights_example(use)
changing the consolidation method¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
wget -O 'phylogeny1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
wget -O 'phylogeny2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny1.qza phylogeny2.qza \
--p-metric weighted_normalized_unifrac \
--p-weights 0.4 0.6 \
--p-consolidation skipping_missing_values \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
fn = 'phylogeny1.qza'
request.urlretrieve(url, fn)
phylogeny1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
fn = 'phylogeny2.qza'
request.urlretrieve(url, fn)
phylogeny2 = Artifact.load(fn)
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny1, phylogeny2],
metric='weighted_normalized_unifrac',
weights=[0.4, 0.6],
consolidation='skipping_missing_values',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
fn <- 'phylogeny1.qza'
request$urlretrieve(url, fn)
phylogeny1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
fn <- 'phylogeny2.qza'
request$urlretrieve(url, fn)
phylogeny2 <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny1, phylogeny2),
metric='weighted_normalized_unifrac',
weights=list(0.4, 0.6),
consolidation='skipping_missing_values',
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_consolidation_example
beta_phylo_meta_consolidation_example(use)
This QIIME 2 plugin computes individual metrics for community alpha and beta diversity.
- version:
2026.4.0 - website: https://
github .com /qiime2 /q2 -diversity -lib - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
| Name | Type | Short Description |
|---|---|---|
| faith-pd | method | Faith's Phylogenetic Diversity |
| observed-features | method | Observed Features |
| pielou-evenness | method | Pielou's Evenness |
| shannon-entropy | method | Shannon's Entropy |
| bray-curtis | method | Bray-Curtis Dissimilarity |
| jaccard | method | Jaccard Distance |
| unweighted-unifrac | method | Unweighted Unifrac |
| weighted-unifrac | method | Weighted Unifrac |
| alpha-passthrough | method | Alpha Passthrough (non-phylogenetic) |
| beta-passthrough | method | Beta Passthrough (non-phylogenetic) |
| beta-phylogenetic-passthrough | method | Beta Phylogenetic Passthrough |
| beta-phylogenetic-meta-passthrough | method | Beta Phylogenetic Meta Passthrough |
diversity-lib faith-pd¶
Computes Faith's Phylogenetic Diversity for all samples in a feature table.
Citations¶
Faith, 1992; Armstrong et al., 2021
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Faith's phylogenetic diversity should be computed. Table values will be converted to presence/absence.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Faith's Phylogenetic Diversity.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
qiime diversity-lib faith-pd \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-vector faith-pd-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
faith_pd_vector, = diversity_lib_actions.faith_pd(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$faith_pd(
table=feature_table,
phylogeny=phylogeny,
)
faith_pd_vector <- action_results$vector
from q2_diversity_lib.examples import faith_pd_example
faith_pd_example(use)
diversity-lib observed-features¶
Compute the number of observed features for each sample in a feature table
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which the number of observed features should be calculated. Table values will be converted to presence/absence.[required]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample counts of observed features.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
qiime diversity-lib observed-features \
--i-table feature-table.qza \
--o-vector obs-feat-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
obs_feat_vector, = diversity_lib_actions.observed_features(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$observed_features(
table=feature_table,
)
obs_feat_vector <- action_results$vector
from q2_diversity_lib.examples import observed_features_example
observed_features_example(use)
diversity-lib pielou-evenness¶
Compute Pielou's Evenness for each sample in a feature table
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Pielou's evenness should be computed.[required]
Parameters¶
- drop_undefined_samples:
Bool Samples with fewer than two observed features produce undefined (NaN) values. If true, these samples are dropped from the output vector.[default:
False]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Pielou's Evenness.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
qiime diversity-lib pielou-evenness \
--i-table feature-table.qza \
--o-vector pielou-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
pielou_vector, = diversity_lib_actions.pielou_evenness(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$pielou_evenness(
table=feature_table,
)
pielou_vector <- action_results$vector
from q2_diversity_lib.examples import pielou_evenness_example
pielou_evenness_example(use)
dropping undefined samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
qiime diversity-lib pielou-evenness \
--i-table feature-table.qza \
--p-drop-undefined-samples \
--o-vector pielou-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
pielou_vector, = diversity_lib_actions.pielou_evenness(
table=feature_table,
drop_undefined_samples=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$pielou_evenness(
table=feature_table,
drop_undefined_samples=TRUE,
)
pielou_vector <- action_results$vector
from q2_diversity_lib.examples import pielou_drop_example
pielou_drop_example(use)
diversity-lib shannon-entropy¶
Compute Shannon's Entropy for each sample in a feature table
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Shannon's Entropy should be computed.[required]
Parameters¶
- drop_undefined_samples:
Bool Samples with no observed features produce undefined (NaN) values. If true, these samples are dropped from the output vector.[default:
False]- base:
Float%Range(0, None, inclusive_start=False)|Str%Choices('e') The logarithm base used in calculations.[default:
2]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Shannon's Entropy.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_entropy_example
shannon_entropy_example(use)
base_e¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--p-base e \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
base='e',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
base='e',
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_base_e_example
shannon_base_e_example(use)
dropping undefined samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--p-drop-undefined-samples \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
drop_undefined_samples=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
drop_undefined_samples=TRUE,
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_drop_example
shannon_drop_example(use)
diversity-lib bray-curtis¶
Compute Bray-Curtis dissimilarity for each sample in a feature table. Note: Frequency and relative frequency data produce different results unless overall sample sizes are identical. Please consider the impact on your results if you use Bray-Curtis with count data that has not been adjusted (normalized).
Citations¶
Sørensen, 1948
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Bray-Curtis dissimilarity should be computed.[required]
Parameters¶
- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Bray-Curtis dissimilarity[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_example
bray_curtis_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--p-n-jobs 1 \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
n_jobs=1L,
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_n_jobs_example
bray_curtis_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--p-n-jobs auto \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
n_jobs='auto',
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_auto_jobs_example
bray_curtis_auto_jobs_example(use)
diversity-lib jaccard¶
Compute Jaccard distance for each sample in a feature table. Jaccard is calculated usingpresence/absence data. Data of type FeatureTable[Frequency | Relative Frequency] is reducedto presence/absence prior to calculation.
Citations¶
Jaccard, 1908
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Jaccard distance should be computed.[required]
Parameters¶
- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Jaccard index[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_example
jaccard_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--p-n-jobs 1 \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
n_jobs=1L,
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_n_jobs_example
jaccard_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--p-n-jobs auto \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
n_jobs='auto',
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_auto_jobs_example
jaccard_auto_jobs_example(use)
diversity-lib unweighted-unifrac¶
Compute Unweighted Unifrac for each sample in a feature table
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Unweighted Unifrac should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Unweighted Unifrac.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_example
u_u_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_n_threads_example
u_u_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_auto_threads_example
u_u_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=TRUE,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_bypass_tips_example
u_u_bypass_tips_example(use)
diversity-lib weighted-unifrac¶
Compute Weighted Unifrac for each sample in a feature table
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Weighted Unifrac should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Unweighted Unifrac.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_example
w_u_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_n_threads_example
w_u_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_auto_threads_example
w_u_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=TRUE,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_bypass_tips_example
w_u_bypass_tips_example(use)
diversity-lib alpha-passthrough¶
Computes a vector of values (one value for each samples in a feature table) using the scikit-bio implementation of the selected alpha diversity metric.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples for which a selected metric should be computed.[required]
Parameters¶
- metric:
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', 'osd', 'robbins', 'simpson', 'simpson_e', 'singles', 'strong') The alpha diversity metric to be computed.[required]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for the chosen metric.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
qiime diversity-lib alpha-passthrough \
--i-table feature-table.qza \
--p-metric simpson \
--o-vector simpson-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
simpson_vector, = diversity_lib_actions.alpha_passthrough(
table=feature_table,
metric='simpson',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$alpha_passthrough(
table=feature_table,
metric='simpson',
)
simpson_vector <- action_results$vector
from q2_diversity_lib.examples import alpha_passthrough_example
alpha_passthrough_example(use)
diversity-lib beta-passthrough¶
Computes a distance matrix for all pairs of samples in a feature table using the scikit-bio implementation of the selected beta diversity metric.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples over which beta diversity should be computed.[required]
Parameters¶
- metric:
Str%Choices('aitchison', 'canberra', 'canberra_adkins', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jensenshannon', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalsneath', 'sqeuclidean', 'yule') The beta diversity metric to be computed.[required]
- pseudocount:
Int%Range(1, None) A pseudocount to handle zeros for compositional metrics. This is ignored for non-compositional metrics.[default:
1]- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric euclidean \
--o-distance-matrix euclidean-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
euclidean_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='euclidean',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='euclidean',
)
euclidean_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_example
beta_passthrough_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric euclidean \
--p-n-jobs 1 \
--o-distance-matrix euclidean-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
euclidean_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='euclidean',
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='euclidean',
n_jobs=1L,
)
euclidean_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_n_jobs_example
beta_passthrough_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
# A default pseudocount of 1 is added to feature counts. Pseudocount is
# ignored for non-compositional metrics.
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric aitchison \
--p-n-jobs auto \
--o-distance-matrix aitchison-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# A default pseudocount of 1 is added to feature counts. Pseudocount is ignored for non-compositional metrics.
aitchison_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# A default pseudocount of 1 is added to feature counts. Pseudocount is ignored for non-compositional metrics.
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
)
aitchison_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_auto_jobs_example
beta_passthrough_auto_jobs_example(use)
use 'pseudocount' to manually set a pseudocount for compositional metrics¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric aitchison \
--p-n-jobs auto \
--p-pseudocount 5 \
--o-distance-matrix aitchison-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
aitchison_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
pseudocount=5,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
pseudocount=5L,
)
aitchison_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_pseudocount_example
beta_passthrough_pseudocount_example(use)
diversity-lib beta-phylogenetic-passthrough¶
Computes a distance matrix for all pairs of samples in a feature table using the unifrac implementation of the selected beta diversity metric.
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018; Chang et al., 2011; Chen et al., 2012; Sfiligoi et al., n.d.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples over which beta diversity should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- metric:
Str%Choices('generalized_unifrac', 'unweighted_unifrac', 'weighted_normalized_unifrac', 'weighted_unifrac') The beta diversity metric to be computed.[required]
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- variance_adjusted:
Bool Perform variance adjustment based on Chang et al. BMC Bioinformatics 2011. Weights distances based on the proportion of the relative abundance represented between the samples at a given node under evaluation.[default:
False]- alpha:
Float%Range(0, 1, inclusive_end=True) This parameter is only used when the choice of metric is generalized_unifrac. The value of alpha controls importance of sample proportions. 1.0 is weighted normalized UniFrac. 0.0 is close to unweighted UniFrac, but only if the sample proportions are dichotomized.[optional]
- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_example
beta_phylo_passthrough_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads=1,
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_n_threads_example
beta_phylo_passthrough_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_auto_threads_example
beta_phylo_passthrough_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
threads='auto',
bypass_tips=TRUE,
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_bypass_tips_example
beta_phylo_passthrough_bypass_tips_example(use)
variance adjustment¶
# Chang et al's variance adjustment may be applied to any unifrac method by
# using this passthrough function.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_unifrac \
--p-threads auto \
--p-variance-adjusted \
--o-distance-matrix var-adj-weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# Chang et al's variance adjustment may be applied to any unifrac method by using this passthrough function.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
var_adj_weighted_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_unifrac',
threads='auto',
variance_adjusted=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# Chang et al's variance adjustment may be applied to any unifrac method by using this passthrough function.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_unifrac',
threads='auto',
variance_adjusted=TRUE,
)
var_adj_weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_variance_adjusted_example
beta_phylo_passthrough_variance_adjusted_example(use)
minimal generalized unifrac¶
# Generalized unifrac is passed alpha=1 by default. This is roughly
# equivalent to weighted normalized unifrac, which method will be used
# instead, because it is better optimized.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric generalized_unifrac \
--o-distance-matrix generalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# Generalized unifrac is passed alpha=1 by default. This is roughly equivalent to weighted normalized unifrac, which method will be used instead, because it is better optimized.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
generalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# Generalized unifrac is passed alpha=1 by default. This is roughly equivalent to weighted normalized unifrac, which method will be used instead, because it is better optimized.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
)
generalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_min_generalized_unifrac_example
beta_phylo_passthrough_min_generalized_unifrac_example(use)
generalized unifrac¶
# passing a float between 0 and 1 to 'alpha' gives you control over the
# importance of sample proportions.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric generalized_unifrac \
--p-alpha 0.75 \
--o-distance-matrix generalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# passing a float between 0 and 1 to 'alpha' gives you control over the importance of sample proportions.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
generalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
alpha=0.75,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# passing a float between 0 and 1 to 'alpha' gives you control over the importance of sample proportions.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
alpha=0.75,
)
generalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_generalized_unifrac_example
beta_phylo_passthrough_generalized_unifrac_example(use)
diversity-lib beta-phylogenetic-meta-passthrough¶
Computes a distance matrix for all pairs of samples in the set of feature table and phylogeny pairs, using the unifrac implementation of the selected beta diversity metric.
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018; Chang et al., 2011; Chen et al., 2012; Lozupone et al., 2008
Inputs¶
- tables:
List[FeatureTable[Frequency]] The feature tables containing the samples over which beta diversity should be computed.[required]
- phylogenies:
List[Phylogeny[Rooted]] Phylogenetic trees containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- metric:
Str%Choices('generalized_unifrac', 'unweighted_unifrac', 'weighted_normalized_unifrac', 'weighted_unifrac') The beta diversity metric to be computed.[required]
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- variance_adjusted:
Bool Perform variance adjustment based on Chang et al. BMC Bioinformatics 2011. Weights distances based on the proportion of the relative abundance represented between the samples at a given node under evaluation.[default:
False]- alpha:
Float%Range(0, 1, inclusive_end=True) This parameter is only used when the choice of metric is generalized_unifrac. The value of alpha controls importance of sample proportions. 1.0 is weighted normalized UniFrac. 0.0 is close to unweighted UniFrac, but only if the sample proportions are dichotomized.[optional]
- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]- weights:
List[Float] The weight applied to each tree/table pair. This tuple is expected to be in index order with tables and phylogenies. Default is to weight each tree/table pair evenly.[optional]
- consolidation:
Str%Choices('skipping_missing_matrices', 'missing_zero', 'missing_one', 'skipping_missing_values') The matrix consolidation method, which determines how the individual distance matrices are aggregated[default:
'skipping_missing_values']
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
Basic meta unifrac¶
# For brevity, these examples are focused on meta-specific parameters. See
# the documentation for beta_phylogenetic_passthrough for additional
# relevant information.
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
wget -O 'phylogeny1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
wget -O 'phylogeny2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
# NOTE: the number of trees and tables must match.
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny1.qza phylogeny2.qza \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# For brevity, these examples are focused on meta-specific parameters. See the documentation for beta_phylogenetic_passthrough for additional relevant information.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
fn = 'phylogeny1.qza'
request.urlretrieve(url, fn)
phylogeny1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
fn = 'phylogeny2.qza'
request.urlretrieve(url, fn)
phylogeny2 = Artifact.load(fn)
# NOTE: the number of trees and tables must match.
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny1, phylogeny2],
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# For brevity, these examples are focused on meta-specific parameters. See the documentation for beta_phylogenetic_passthrough for additional relevant information.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
fn <- 'phylogeny1.qza'
request$urlretrieve(url, fn)
phylogeny1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
fn <- 'phylogeny2.qza'
request$urlretrieve(url, fn)
phylogeny2 <- Artifact$load(fn)
# NOTE: the number of trees and tables must match.
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny1, phylogeny2),
metric='weighted_normalized_unifrac',
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_passthrough_example
beta_phylo_meta_passthrough_example(use)
meta with weights¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny.qza phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--p-weights 3.0 42.0 \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny, phylogeny],
metric='weighted_normalized_unifrac',
weights=[3.0, 42.0],
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny, phylogeny),
metric='weighted_normalized_unifrac',
weights=list(3.0, 42.0),
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_weights_example
beta_phylo_meta_weights_example(use)
changing the consolidation method¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
wget -O 'phylogeny1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
wget -O 'phylogeny2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny1.qza phylogeny2.qza \
--p-metric weighted_normalized_unifrac \
--p-weights 0.4 0.6 \
--p-consolidation skipping_missing_values \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
fn = 'phylogeny1.qza'
request.urlretrieve(url, fn)
phylogeny1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
fn = 'phylogeny2.qza'
request.urlretrieve(url, fn)
phylogeny2 = Artifact.load(fn)
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny1, phylogeny2],
metric='weighted_normalized_unifrac',
weights=[0.4, 0.6],
consolidation='skipping_missing_values',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
fn <- 'phylogeny1.qza'
request$urlretrieve(url, fn)
phylogeny1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
fn <- 'phylogeny2.qza'
request$urlretrieve(url, fn)
phylogeny2 <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny1, phylogeny2),
metric='weighted_normalized_unifrac',
weights=list(0.4, 0.6),
consolidation='skipping_missing_values',
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_consolidation_example
beta_phylo_meta_consolidation_example(use)
This QIIME 2 plugin computes individual metrics for community alpha and beta diversity.
- version:
2026.4.0 - website: https://
github .com /qiime2 /q2 -diversity -lib - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
| Name | Type | Short Description |
|---|---|---|
| faith-pd | method | Faith's Phylogenetic Diversity |
| observed-features | method | Observed Features |
| pielou-evenness | method | Pielou's Evenness |
| shannon-entropy | method | Shannon's Entropy |
| bray-curtis | method | Bray-Curtis Dissimilarity |
| jaccard | method | Jaccard Distance |
| unweighted-unifrac | method | Unweighted Unifrac |
| weighted-unifrac | method | Weighted Unifrac |
| alpha-passthrough | method | Alpha Passthrough (non-phylogenetic) |
| beta-passthrough | method | Beta Passthrough (non-phylogenetic) |
| beta-phylogenetic-passthrough | method | Beta Phylogenetic Passthrough |
| beta-phylogenetic-meta-passthrough | method | Beta Phylogenetic Meta Passthrough |
diversity-lib faith-pd¶
Computes Faith's Phylogenetic Diversity for all samples in a feature table.
Citations¶
Faith, 1992; Armstrong et al., 2021
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Faith's phylogenetic diversity should be computed. Table values will be converted to presence/absence.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Faith's Phylogenetic Diversity.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
qiime diversity-lib faith-pd \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-vector faith-pd-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
faith_pd_vector, = diversity_lib_actions.faith_pd(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$faith_pd(
table=feature_table,
phylogeny=phylogeny,
)
faith_pd_vector <- action_results$vector
from q2_diversity_lib.examples import faith_pd_example
faith_pd_example(use)
diversity-lib observed-features¶
Compute the number of observed features for each sample in a feature table
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which the number of observed features should be calculated. Table values will be converted to presence/absence.[required]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample counts of observed features.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
qiime diversity-lib observed-features \
--i-table feature-table.qza \
--o-vector obs-feat-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
obs_feat_vector, = diversity_lib_actions.observed_features(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$observed_features(
table=feature_table,
)
obs_feat_vector <- action_results$vector
from q2_diversity_lib.examples import observed_features_example
observed_features_example(use)
diversity-lib pielou-evenness¶
Compute Pielou's Evenness for each sample in a feature table
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Pielou's evenness should be computed.[required]
Parameters¶
- drop_undefined_samples:
Bool Samples with fewer than two observed features produce undefined (NaN) values. If true, these samples are dropped from the output vector.[default:
False]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Pielou's Evenness.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
qiime diversity-lib pielou-evenness \
--i-table feature-table.qza \
--o-vector pielou-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
pielou_vector, = diversity_lib_actions.pielou_evenness(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$pielou_evenness(
table=feature_table,
)
pielou_vector <- action_results$vector
from q2_diversity_lib.examples import pielou_evenness_example
pielou_evenness_example(use)
dropping undefined samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
qiime diversity-lib pielou-evenness \
--i-table feature-table.qza \
--p-drop-undefined-samples \
--o-vector pielou-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
pielou_vector, = diversity_lib_actions.pielou_evenness(
table=feature_table,
drop_undefined_samples=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$pielou_evenness(
table=feature_table,
drop_undefined_samples=TRUE,
)
pielou_vector <- action_results$vector
from q2_diversity_lib.examples import pielou_drop_example
pielou_drop_example(use)
diversity-lib shannon-entropy¶
Compute Shannon's Entropy for each sample in a feature table
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Shannon's Entropy should be computed.[required]
Parameters¶
- drop_undefined_samples:
Bool Samples with no observed features produce undefined (NaN) values. If true, these samples are dropped from the output vector.[default:
False]- base:
Float%Range(0, None, inclusive_start=False)|Str%Choices('e') The logarithm base used in calculations.[default:
2]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Shannon's Entropy.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_entropy_example
shannon_entropy_example(use)
base_e¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--p-base e \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
base='e',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
base='e',
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_base_e_example
shannon_base_e_example(use)
dropping undefined samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--p-drop-undefined-samples \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
drop_undefined_samples=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
drop_undefined_samples=TRUE,
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_drop_example
shannon_drop_example(use)
diversity-lib bray-curtis¶
Compute Bray-Curtis dissimilarity for each sample in a feature table. Note: Frequency and relative frequency data produce different results unless overall sample sizes are identical. Please consider the impact on your results if you use Bray-Curtis with count data that has not been adjusted (normalized).
Citations¶
Sørensen, 1948
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Bray-Curtis dissimilarity should be computed.[required]
Parameters¶
- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Bray-Curtis dissimilarity[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_example
bray_curtis_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--p-n-jobs 1 \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
n_jobs=1L,
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_n_jobs_example
bray_curtis_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--p-n-jobs auto \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
n_jobs='auto',
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_auto_jobs_example
bray_curtis_auto_jobs_example(use)
diversity-lib jaccard¶
Compute Jaccard distance for each sample in a feature table. Jaccard is calculated usingpresence/absence data. Data of type FeatureTable[Frequency | Relative Frequency] is reducedto presence/absence prior to calculation.
Citations¶
Jaccard, 1908
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Jaccard distance should be computed.[required]
Parameters¶
- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Jaccard index[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_example
jaccard_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--p-n-jobs 1 \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
n_jobs=1L,
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_n_jobs_example
jaccard_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--p-n-jobs auto \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
n_jobs='auto',
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_auto_jobs_example
jaccard_auto_jobs_example(use)
diversity-lib unweighted-unifrac¶
Compute Unweighted Unifrac for each sample in a feature table
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Unweighted Unifrac should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Unweighted Unifrac.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_example
u_u_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_n_threads_example
u_u_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_auto_threads_example
u_u_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=TRUE,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_bypass_tips_example
u_u_bypass_tips_example(use)
diversity-lib weighted-unifrac¶
Compute Weighted Unifrac for each sample in a feature table
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Weighted Unifrac should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Unweighted Unifrac.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_example
w_u_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_n_threads_example
w_u_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_auto_threads_example
w_u_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=TRUE,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_bypass_tips_example
w_u_bypass_tips_example(use)
diversity-lib alpha-passthrough¶
Computes a vector of values (one value for each samples in a feature table) using the scikit-bio implementation of the selected alpha diversity metric.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples for which a selected metric should be computed.[required]
Parameters¶
- metric:
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', 'osd', 'robbins', 'simpson', 'simpson_e', 'singles', 'strong') The alpha diversity metric to be computed.[required]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for the chosen metric.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
qiime diversity-lib alpha-passthrough \
--i-table feature-table.qza \
--p-metric simpson \
--o-vector simpson-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
simpson_vector, = diversity_lib_actions.alpha_passthrough(
table=feature_table,
metric='simpson',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$alpha_passthrough(
table=feature_table,
metric='simpson',
)
simpson_vector <- action_results$vector
from q2_diversity_lib.examples import alpha_passthrough_example
alpha_passthrough_example(use)
diversity-lib beta-passthrough¶
Computes a distance matrix for all pairs of samples in a feature table using the scikit-bio implementation of the selected beta diversity metric.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples over which beta diversity should be computed.[required]
Parameters¶
- metric:
Str%Choices('aitchison', 'canberra', 'canberra_adkins', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jensenshannon', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalsneath', 'sqeuclidean', 'yule') The beta diversity metric to be computed.[required]
- pseudocount:
Int%Range(1, None) A pseudocount to handle zeros for compositional metrics. This is ignored for non-compositional metrics.[default:
1]- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric euclidean \
--o-distance-matrix euclidean-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
euclidean_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='euclidean',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='euclidean',
)
euclidean_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_example
beta_passthrough_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric euclidean \
--p-n-jobs 1 \
--o-distance-matrix euclidean-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
euclidean_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='euclidean',
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='euclidean',
n_jobs=1L,
)
euclidean_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_n_jobs_example
beta_passthrough_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
# A default pseudocount of 1 is added to feature counts. Pseudocount is
# ignored for non-compositional metrics.
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric aitchison \
--p-n-jobs auto \
--o-distance-matrix aitchison-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# A default pseudocount of 1 is added to feature counts. Pseudocount is ignored for non-compositional metrics.
aitchison_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# A default pseudocount of 1 is added to feature counts. Pseudocount is ignored for non-compositional metrics.
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
)
aitchison_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_auto_jobs_example
beta_passthrough_auto_jobs_example(use)
use 'pseudocount' to manually set a pseudocount for compositional metrics¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric aitchison \
--p-n-jobs auto \
--p-pseudocount 5 \
--o-distance-matrix aitchison-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
aitchison_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
pseudocount=5,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
pseudocount=5L,
)
aitchison_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_pseudocount_example
beta_passthrough_pseudocount_example(use)
diversity-lib beta-phylogenetic-passthrough¶
Computes a distance matrix for all pairs of samples in a feature table using the unifrac implementation of the selected beta diversity metric.
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018; Chang et al., 2011; Chen et al., 2012; Sfiligoi et al., n.d.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples over which beta diversity should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- metric:
Str%Choices('generalized_unifrac', 'unweighted_unifrac', 'weighted_normalized_unifrac', 'weighted_unifrac') The beta diversity metric to be computed.[required]
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- variance_adjusted:
Bool Perform variance adjustment based on Chang et al. BMC Bioinformatics 2011. Weights distances based on the proportion of the relative abundance represented between the samples at a given node under evaluation.[default:
False]- alpha:
Float%Range(0, 1, inclusive_end=True) This parameter is only used when the choice of metric is generalized_unifrac. The value of alpha controls importance of sample proportions. 1.0 is weighted normalized UniFrac. 0.0 is close to unweighted UniFrac, but only if the sample proportions are dichotomized.[optional]
- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_example
beta_phylo_passthrough_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads=1,
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_n_threads_example
beta_phylo_passthrough_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_auto_threads_example
beta_phylo_passthrough_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
threads='auto',
bypass_tips=TRUE,
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_bypass_tips_example
beta_phylo_passthrough_bypass_tips_example(use)
variance adjustment¶
# Chang et al's variance adjustment may be applied to any unifrac method by
# using this passthrough function.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_unifrac \
--p-threads auto \
--p-variance-adjusted \
--o-distance-matrix var-adj-weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# Chang et al's variance adjustment may be applied to any unifrac method by using this passthrough function.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
var_adj_weighted_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_unifrac',
threads='auto',
variance_adjusted=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# Chang et al's variance adjustment may be applied to any unifrac method by using this passthrough function.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_unifrac',
threads='auto',
variance_adjusted=TRUE,
)
var_adj_weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_variance_adjusted_example
beta_phylo_passthrough_variance_adjusted_example(use)
minimal generalized unifrac¶
# Generalized unifrac is passed alpha=1 by default. This is roughly
# equivalent to weighted normalized unifrac, which method will be used
# instead, because it is better optimized.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric generalized_unifrac \
--o-distance-matrix generalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# Generalized unifrac is passed alpha=1 by default. This is roughly equivalent to weighted normalized unifrac, which method will be used instead, because it is better optimized.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
generalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# Generalized unifrac is passed alpha=1 by default. This is roughly equivalent to weighted normalized unifrac, which method will be used instead, because it is better optimized.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
)
generalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_min_generalized_unifrac_example
beta_phylo_passthrough_min_generalized_unifrac_example(use)
generalized unifrac¶
# passing a float between 0 and 1 to 'alpha' gives you control over the
# importance of sample proportions.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric generalized_unifrac \
--p-alpha 0.75 \
--o-distance-matrix generalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# passing a float between 0 and 1 to 'alpha' gives you control over the importance of sample proportions.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
generalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
alpha=0.75,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# passing a float between 0 and 1 to 'alpha' gives you control over the importance of sample proportions.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
alpha=0.75,
)
generalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_generalized_unifrac_example
beta_phylo_passthrough_generalized_unifrac_example(use)
diversity-lib beta-phylogenetic-meta-passthrough¶
Computes a distance matrix for all pairs of samples in the set of feature table and phylogeny pairs, using the unifrac implementation of the selected beta diversity metric.
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018; Chang et al., 2011; Chen et al., 2012; Lozupone et al., 2008
Inputs¶
- tables:
List[FeatureTable[Frequency]] The feature tables containing the samples over which beta diversity should be computed.[required]
- phylogenies:
List[Phylogeny[Rooted]] Phylogenetic trees containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- metric:
Str%Choices('generalized_unifrac', 'unweighted_unifrac', 'weighted_normalized_unifrac', 'weighted_unifrac') The beta diversity metric to be computed.[required]
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- variance_adjusted:
Bool Perform variance adjustment based on Chang et al. BMC Bioinformatics 2011. Weights distances based on the proportion of the relative abundance represented between the samples at a given node under evaluation.[default:
False]- alpha:
Float%Range(0, 1, inclusive_end=True) This parameter is only used when the choice of metric is generalized_unifrac. The value of alpha controls importance of sample proportions. 1.0 is weighted normalized UniFrac. 0.0 is close to unweighted UniFrac, but only if the sample proportions are dichotomized.[optional]
- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]- weights:
List[Float] The weight applied to each tree/table pair. This tuple is expected to be in index order with tables and phylogenies. Default is to weight each tree/table pair evenly.[optional]
- consolidation:
Str%Choices('skipping_missing_matrices', 'missing_zero', 'missing_one', 'skipping_missing_values') The matrix consolidation method, which determines how the individual distance matrices are aggregated[default:
'skipping_missing_values']
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
Basic meta unifrac¶
# For brevity, these examples are focused on meta-specific parameters. See
# the documentation for beta_phylogenetic_passthrough for additional
# relevant information.
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
wget -O 'phylogeny1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
wget -O 'phylogeny2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
# NOTE: the number of trees and tables must match.
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny1.qza phylogeny2.qza \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# For brevity, these examples are focused on meta-specific parameters. See the documentation for beta_phylogenetic_passthrough for additional relevant information.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
fn = 'phylogeny1.qza'
request.urlretrieve(url, fn)
phylogeny1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
fn = 'phylogeny2.qza'
request.urlretrieve(url, fn)
phylogeny2 = Artifact.load(fn)
# NOTE: the number of trees and tables must match.
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny1, phylogeny2],
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# For brevity, these examples are focused on meta-specific parameters. See the documentation for beta_phylogenetic_passthrough for additional relevant information.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
fn <- 'phylogeny1.qza'
request$urlretrieve(url, fn)
phylogeny1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
fn <- 'phylogeny2.qza'
request$urlretrieve(url, fn)
phylogeny2 <- Artifact$load(fn)
# NOTE: the number of trees and tables must match.
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny1, phylogeny2),
metric='weighted_normalized_unifrac',
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_passthrough_example
beta_phylo_meta_passthrough_example(use)
meta with weights¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny.qza phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--p-weights 3.0 42.0 \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny, phylogeny],
metric='weighted_normalized_unifrac',
weights=[3.0, 42.0],
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny, phylogeny),
metric='weighted_normalized_unifrac',
weights=list(3.0, 42.0),
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_weights_example
beta_phylo_meta_weights_example(use)
changing the consolidation method¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
wget -O 'phylogeny1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
wget -O 'phylogeny2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny1.qza phylogeny2.qza \
--p-metric weighted_normalized_unifrac \
--p-weights 0.4 0.6 \
--p-consolidation skipping_missing_values \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
fn = 'phylogeny1.qza'
request.urlretrieve(url, fn)
phylogeny1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
fn = 'phylogeny2.qza'
request.urlretrieve(url, fn)
phylogeny2 = Artifact.load(fn)
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny1, phylogeny2],
metric='weighted_normalized_unifrac',
weights=[0.4, 0.6],
consolidation='skipping_missing_values',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
fn <- 'phylogeny1.qza'
request$urlretrieve(url, fn)
phylogeny1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
fn <- 'phylogeny2.qza'
request$urlretrieve(url, fn)
phylogeny2 <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny1, phylogeny2),
metric='weighted_normalized_unifrac',
weights=list(0.4, 0.6),
consolidation='skipping_missing_values',
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_consolidation_example
beta_phylo_meta_consolidation_example(use)
This QIIME 2 plugin computes individual metrics for community alpha and beta diversity.
- version:
2026.4.0 - website: https://
github .com /qiime2 /q2 -diversity -lib - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
| Name | Type | Short Description |
|---|---|---|
| faith-pd | method | Faith's Phylogenetic Diversity |
| observed-features | method | Observed Features |
| pielou-evenness | method | Pielou's Evenness |
| shannon-entropy | method | Shannon's Entropy |
| bray-curtis | method | Bray-Curtis Dissimilarity |
| jaccard | method | Jaccard Distance |
| unweighted-unifrac | method | Unweighted Unifrac |
| weighted-unifrac | method | Weighted Unifrac |
| alpha-passthrough | method | Alpha Passthrough (non-phylogenetic) |
| beta-passthrough | method | Beta Passthrough (non-phylogenetic) |
| beta-phylogenetic-passthrough | method | Beta Phylogenetic Passthrough |
| beta-phylogenetic-meta-passthrough | method | Beta Phylogenetic Meta Passthrough |
diversity-lib faith-pd¶
Computes Faith's Phylogenetic Diversity for all samples in a feature table.
Citations¶
Faith, 1992; Armstrong et al., 2021
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Faith's phylogenetic diversity should be computed. Table values will be converted to presence/absence.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Faith's Phylogenetic Diversity.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
qiime diversity-lib faith-pd \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-vector faith-pd-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
faith_pd_vector, = diversity_lib_actions.faith_pd(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$faith_pd(
table=feature_table,
phylogeny=phylogeny,
)
faith_pd_vector <- action_results$vector
from q2_diversity_lib.examples import faith_pd_example
faith_pd_example(use)
diversity-lib observed-features¶
Compute the number of observed features for each sample in a feature table
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which the number of observed features should be calculated. Table values will be converted to presence/absence.[required]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample counts of observed features.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
qiime diversity-lib observed-features \
--i-table feature-table.qza \
--o-vector obs-feat-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
obs_feat_vector, = diversity_lib_actions.observed_features(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$observed_features(
table=feature_table,
)
obs_feat_vector <- action_results$vector
from q2_diversity_lib.examples import observed_features_example
observed_features_example(use)
diversity-lib pielou-evenness¶
Compute Pielou's Evenness for each sample in a feature table
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Pielou's evenness should be computed.[required]
Parameters¶
- drop_undefined_samples:
Bool Samples with fewer than two observed features produce undefined (NaN) values. If true, these samples are dropped from the output vector.[default:
False]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Pielou's Evenness.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
qiime diversity-lib pielou-evenness \
--i-table feature-table.qza \
--o-vector pielou-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
pielou_vector, = diversity_lib_actions.pielou_evenness(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$pielou_evenness(
table=feature_table,
)
pielou_vector <- action_results$vector
from q2_diversity_lib.examples import pielou_evenness_example
pielou_evenness_example(use)
dropping undefined samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
qiime diversity-lib pielou-evenness \
--i-table feature-table.qza \
--p-drop-undefined-samples \
--o-vector pielou-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
pielou_vector, = diversity_lib_actions.pielou_evenness(
table=feature_table,
drop_undefined_samples=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$pielou_evenness(
table=feature_table,
drop_undefined_samples=TRUE,
)
pielou_vector <- action_results$vector
from q2_diversity_lib.examples import pielou_drop_example
pielou_drop_example(use)
diversity-lib shannon-entropy¶
Compute Shannon's Entropy for each sample in a feature table
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Shannon's Entropy should be computed.[required]
Parameters¶
- drop_undefined_samples:
Bool Samples with no observed features produce undefined (NaN) values. If true, these samples are dropped from the output vector.[default:
False]- base:
Float%Range(0, None, inclusive_start=False)|Str%Choices('e') The logarithm base used in calculations.[default:
2]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Shannon's Entropy.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_entropy_example
shannon_entropy_example(use)
base_e¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--p-base e \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
base='e',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
base='e',
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_base_e_example
shannon_base_e_example(use)
dropping undefined samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--p-drop-undefined-samples \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
drop_undefined_samples=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
drop_undefined_samples=TRUE,
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_drop_example
shannon_drop_example(use)
diversity-lib bray-curtis¶
Compute Bray-Curtis dissimilarity for each sample in a feature table. Note: Frequency and relative frequency data produce different results unless overall sample sizes are identical. Please consider the impact on your results if you use Bray-Curtis with count data that has not been adjusted (normalized).
Citations¶
Sørensen, 1948
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Bray-Curtis dissimilarity should be computed.[required]
Parameters¶
- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Bray-Curtis dissimilarity[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_example
bray_curtis_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--p-n-jobs 1 \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
n_jobs=1L,
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_n_jobs_example
bray_curtis_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--p-n-jobs auto \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
n_jobs='auto',
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_auto_jobs_example
bray_curtis_auto_jobs_example(use)
diversity-lib jaccard¶
Compute Jaccard distance for each sample in a feature table. Jaccard is calculated usingpresence/absence data. Data of type FeatureTable[Frequency | Relative Frequency] is reducedto presence/absence prior to calculation.
Citations¶
Jaccard, 1908
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Jaccard distance should be computed.[required]
Parameters¶
- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Jaccard index[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_example
jaccard_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--p-n-jobs 1 \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
n_jobs=1L,
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_n_jobs_example
jaccard_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--p-n-jobs auto \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
n_jobs='auto',
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_auto_jobs_example
jaccard_auto_jobs_example(use)
diversity-lib unweighted-unifrac¶
Compute Unweighted Unifrac for each sample in a feature table
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Unweighted Unifrac should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Unweighted Unifrac.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_example
u_u_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_n_threads_example
u_u_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_auto_threads_example
u_u_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=TRUE,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_bypass_tips_example
u_u_bypass_tips_example(use)
diversity-lib weighted-unifrac¶
Compute Weighted Unifrac for each sample in a feature table
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Weighted Unifrac should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Unweighted Unifrac.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_example
w_u_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_n_threads_example
w_u_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_auto_threads_example
w_u_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=TRUE,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_bypass_tips_example
w_u_bypass_tips_example(use)
diversity-lib alpha-passthrough¶
Computes a vector of values (one value for each samples in a feature table) using the scikit-bio implementation of the selected alpha diversity metric.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples for which a selected metric should be computed.[required]
Parameters¶
- metric:
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', 'osd', 'robbins', 'simpson', 'simpson_e', 'singles', 'strong') The alpha diversity metric to be computed.[required]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for the chosen metric.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
qiime diversity-lib alpha-passthrough \
--i-table feature-table.qza \
--p-metric simpson \
--o-vector simpson-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
simpson_vector, = diversity_lib_actions.alpha_passthrough(
table=feature_table,
metric='simpson',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$alpha_passthrough(
table=feature_table,
metric='simpson',
)
simpson_vector <- action_results$vector
from q2_diversity_lib.examples import alpha_passthrough_example
alpha_passthrough_example(use)
diversity-lib beta-passthrough¶
Computes a distance matrix for all pairs of samples in a feature table using the scikit-bio implementation of the selected beta diversity metric.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples over which beta diversity should be computed.[required]
Parameters¶
- metric:
Str%Choices('aitchison', 'canberra', 'canberra_adkins', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jensenshannon', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalsneath', 'sqeuclidean', 'yule') The beta diversity metric to be computed.[required]
- pseudocount:
Int%Range(1, None) A pseudocount to handle zeros for compositional metrics. This is ignored for non-compositional metrics.[default:
1]- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric euclidean \
--o-distance-matrix euclidean-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
euclidean_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='euclidean',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='euclidean',
)
euclidean_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_example
beta_passthrough_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric euclidean \
--p-n-jobs 1 \
--o-distance-matrix euclidean-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
euclidean_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='euclidean',
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='euclidean',
n_jobs=1L,
)
euclidean_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_n_jobs_example
beta_passthrough_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
# A default pseudocount of 1 is added to feature counts. Pseudocount is
# ignored for non-compositional metrics.
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric aitchison \
--p-n-jobs auto \
--o-distance-matrix aitchison-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# A default pseudocount of 1 is added to feature counts. Pseudocount is ignored for non-compositional metrics.
aitchison_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# A default pseudocount of 1 is added to feature counts. Pseudocount is ignored for non-compositional metrics.
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
)
aitchison_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_auto_jobs_example
beta_passthrough_auto_jobs_example(use)
use 'pseudocount' to manually set a pseudocount for compositional metrics¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric aitchison \
--p-n-jobs auto \
--p-pseudocount 5 \
--o-distance-matrix aitchison-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
aitchison_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
pseudocount=5,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
pseudocount=5L,
)
aitchison_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_pseudocount_example
beta_passthrough_pseudocount_example(use)
diversity-lib beta-phylogenetic-passthrough¶
Computes a distance matrix for all pairs of samples in a feature table using the unifrac implementation of the selected beta diversity metric.
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018; Chang et al., 2011; Chen et al., 2012; Sfiligoi et al., n.d.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples over which beta diversity should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- metric:
Str%Choices('generalized_unifrac', 'unweighted_unifrac', 'weighted_normalized_unifrac', 'weighted_unifrac') The beta diversity metric to be computed.[required]
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- variance_adjusted:
Bool Perform variance adjustment based on Chang et al. BMC Bioinformatics 2011. Weights distances based on the proportion of the relative abundance represented between the samples at a given node under evaluation.[default:
False]- alpha:
Float%Range(0, 1, inclusive_end=True) This parameter is only used when the choice of metric is generalized_unifrac. The value of alpha controls importance of sample proportions. 1.0 is weighted normalized UniFrac. 0.0 is close to unweighted UniFrac, but only if the sample proportions are dichotomized.[optional]
- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_example
beta_phylo_passthrough_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads=1,
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_n_threads_example
beta_phylo_passthrough_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_auto_threads_example
beta_phylo_passthrough_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
threads='auto',
bypass_tips=TRUE,
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_bypass_tips_example
beta_phylo_passthrough_bypass_tips_example(use)
variance adjustment¶
# Chang et al's variance adjustment may be applied to any unifrac method by
# using this passthrough function.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_unifrac \
--p-threads auto \
--p-variance-adjusted \
--o-distance-matrix var-adj-weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# Chang et al's variance adjustment may be applied to any unifrac method by using this passthrough function.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
var_adj_weighted_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_unifrac',
threads='auto',
variance_adjusted=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# Chang et al's variance adjustment may be applied to any unifrac method by using this passthrough function.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_unifrac',
threads='auto',
variance_adjusted=TRUE,
)
var_adj_weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_variance_adjusted_example
beta_phylo_passthrough_variance_adjusted_example(use)
minimal generalized unifrac¶
# Generalized unifrac is passed alpha=1 by default. This is roughly
# equivalent to weighted normalized unifrac, which method will be used
# instead, because it is better optimized.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric generalized_unifrac \
--o-distance-matrix generalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# Generalized unifrac is passed alpha=1 by default. This is roughly equivalent to weighted normalized unifrac, which method will be used instead, because it is better optimized.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
generalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# Generalized unifrac is passed alpha=1 by default. This is roughly equivalent to weighted normalized unifrac, which method will be used instead, because it is better optimized.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
)
generalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_min_generalized_unifrac_example
beta_phylo_passthrough_min_generalized_unifrac_example(use)
generalized unifrac¶
# passing a float between 0 and 1 to 'alpha' gives you control over the
# importance of sample proportions.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric generalized_unifrac \
--p-alpha 0.75 \
--o-distance-matrix generalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# passing a float between 0 and 1 to 'alpha' gives you control over the importance of sample proportions.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
generalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
alpha=0.75,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# passing a float between 0 and 1 to 'alpha' gives you control over the importance of sample proportions.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
alpha=0.75,
)
generalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_generalized_unifrac_example
beta_phylo_passthrough_generalized_unifrac_example(use)
diversity-lib beta-phylogenetic-meta-passthrough¶
Computes a distance matrix for all pairs of samples in the set of feature table and phylogeny pairs, using the unifrac implementation of the selected beta diversity metric.
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018; Chang et al., 2011; Chen et al., 2012; Lozupone et al., 2008
Inputs¶
- tables:
List[FeatureTable[Frequency]] The feature tables containing the samples over which beta diversity should be computed.[required]
- phylogenies:
List[Phylogeny[Rooted]] Phylogenetic trees containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- metric:
Str%Choices('generalized_unifrac', 'unweighted_unifrac', 'weighted_normalized_unifrac', 'weighted_unifrac') The beta diversity metric to be computed.[required]
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- variance_adjusted:
Bool Perform variance adjustment based on Chang et al. BMC Bioinformatics 2011. Weights distances based on the proportion of the relative abundance represented between the samples at a given node under evaluation.[default:
False]- alpha:
Float%Range(0, 1, inclusive_end=True) This parameter is only used when the choice of metric is generalized_unifrac. The value of alpha controls importance of sample proportions. 1.0 is weighted normalized UniFrac. 0.0 is close to unweighted UniFrac, but only if the sample proportions are dichotomized.[optional]
- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]- weights:
List[Float] The weight applied to each tree/table pair. This tuple is expected to be in index order with tables and phylogenies. Default is to weight each tree/table pair evenly.[optional]
- consolidation:
Str%Choices('skipping_missing_matrices', 'missing_zero', 'missing_one', 'skipping_missing_values') The matrix consolidation method, which determines how the individual distance matrices are aggregated[default:
'skipping_missing_values']
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
Basic meta unifrac¶
# For brevity, these examples are focused on meta-specific parameters. See
# the documentation for beta_phylogenetic_passthrough for additional
# relevant information.
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
wget -O 'phylogeny1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
wget -O 'phylogeny2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
# NOTE: the number of trees and tables must match.
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny1.qza phylogeny2.qza \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# For brevity, these examples are focused on meta-specific parameters. See the documentation for beta_phylogenetic_passthrough for additional relevant information.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
fn = 'phylogeny1.qza'
request.urlretrieve(url, fn)
phylogeny1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
fn = 'phylogeny2.qza'
request.urlretrieve(url, fn)
phylogeny2 = Artifact.load(fn)
# NOTE: the number of trees and tables must match.
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny1, phylogeny2],
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# For brevity, these examples are focused on meta-specific parameters. See the documentation for beta_phylogenetic_passthrough for additional relevant information.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
fn <- 'phylogeny1.qza'
request$urlretrieve(url, fn)
phylogeny1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
fn <- 'phylogeny2.qza'
request$urlretrieve(url, fn)
phylogeny2 <- Artifact$load(fn)
# NOTE: the number of trees and tables must match.
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny1, phylogeny2),
metric='weighted_normalized_unifrac',
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_passthrough_example
beta_phylo_meta_passthrough_example(use)
meta with weights¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny.qza phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--p-weights 3.0 42.0 \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny, phylogeny],
metric='weighted_normalized_unifrac',
weights=[3.0, 42.0],
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny, phylogeny),
metric='weighted_normalized_unifrac',
weights=list(3.0, 42.0),
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_weights_example
beta_phylo_meta_weights_example(use)
changing the consolidation method¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
wget -O 'phylogeny1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
wget -O 'phylogeny2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny1.qza phylogeny2.qza \
--p-metric weighted_normalized_unifrac \
--p-weights 0.4 0.6 \
--p-consolidation skipping_missing_values \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
fn = 'phylogeny1.qza'
request.urlretrieve(url, fn)
phylogeny1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
fn = 'phylogeny2.qza'
request.urlretrieve(url, fn)
phylogeny2 = Artifact.load(fn)
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny1, phylogeny2],
metric='weighted_normalized_unifrac',
weights=[0.4, 0.6],
consolidation='skipping_missing_values',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
fn <- 'phylogeny1.qza'
request$urlretrieve(url, fn)
phylogeny1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
fn <- 'phylogeny2.qza'
request$urlretrieve(url, fn)
phylogeny2 <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny1, phylogeny2),
metric='weighted_normalized_unifrac',
weights=list(0.4, 0.6),
consolidation='skipping_missing_values',
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_consolidation_example
beta_phylo_meta_consolidation_example(use)
This QIIME 2 plugin computes individual metrics for community alpha and beta diversity.
- version:
2026.4.0 - website: https://
github .com /qiime2 /q2 -diversity -lib - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
| Name | Type | Short Description |
|---|---|---|
| faith-pd | method | Faith's Phylogenetic Diversity |
| observed-features | method | Observed Features |
| pielou-evenness | method | Pielou's Evenness |
| shannon-entropy | method | Shannon's Entropy |
| bray-curtis | method | Bray-Curtis Dissimilarity |
| jaccard | method | Jaccard Distance |
| unweighted-unifrac | method | Unweighted Unifrac |
| weighted-unifrac | method | Weighted Unifrac |
| alpha-passthrough | method | Alpha Passthrough (non-phylogenetic) |
| beta-passthrough | method | Beta Passthrough (non-phylogenetic) |
| beta-phylogenetic-passthrough | method | Beta Phylogenetic Passthrough |
| beta-phylogenetic-meta-passthrough | method | Beta Phylogenetic Meta Passthrough |
diversity-lib faith-pd¶
Computes Faith's Phylogenetic Diversity for all samples in a feature table.
Citations¶
Faith, 1992; Armstrong et al., 2021
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Faith's phylogenetic diversity should be computed. Table values will be converted to presence/absence.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Faith's Phylogenetic Diversity.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
qiime diversity-lib faith-pd \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-vector faith-pd-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
faith_pd_vector, = diversity_lib_actions.faith_pd(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$faith_pd(
table=feature_table,
phylogeny=phylogeny,
)
faith_pd_vector <- action_results$vector
from q2_diversity_lib.examples import faith_pd_example
faith_pd_example(use)
diversity-lib observed-features¶
Compute the number of observed features for each sample in a feature table
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which the number of observed features should be calculated. Table values will be converted to presence/absence.[required]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample counts of observed features.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
qiime diversity-lib observed-features \
--i-table feature-table.qza \
--o-vector obs-feat-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
obs_feat_vector, = diversity_lib_actions.observed_features(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$observed_features(
table=feature_table,
)
obs_feat_vector <- action_results$vector
from q2_diversity_lib.examples import observed_features_example
observed_features_example(use)
diversity-lib pielou-evenness¶
Compute Pielou's Evenness for each sample in a feature table
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Pielou's evenness should be computed.[required]
Parameters¶
- drop_undefined_samples:
Bool Samples with fewer than two observed features produce undefined (NaN) values. If true, these samples are dropped from the output vector.[default:
False]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Pielou's Evenness.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
qiime diversity-lib pielou-evenness \
--i-table feature-table.qza \
--o-vector pielou-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
pielou_vector, = diversity_lib_actions.pielou_evenness(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$pielou_evenness(
table=feature_table,
)
pielou_vector <- action_results$vector
from q2_diversity_lib.examples import pielou_evenness_example
pielou_evenness_example(use)
dropping undefined samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
qiime diversity-lib pielou-evenness \
--i-table feature-table.qza \
--p-drop-undefined-samples \
--o-vector pielou-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
pielou_vector, = diversity_lib_actions.pielou_evenness(
table=feature_table,
drop_undefined_samples=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$pielou_evenness(
table=feature_table,
drop_undefined_samples=TRUE,
)
pielou_vector <- action_results$vector
from q2_diversity_lib.examples import pielou_drop_example
pielou_drop_example(use)
diversity-lib shannon-entropy¶
Compute Shannon's Entropy for each sample in a feature table
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Shannon's Entropy should be computed.[required]
Parameters¶
- drop_undefined_samples:
Bool Samples with no observed features produce undefined (NaN) values. If true, these samples are dropped from the output vector.[default:
False]- base:
Float%Range(0, None, inclusive_start=False)|Str%Choices('e') The logarithm base used in calculations.[default:
2]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Shannon's Entropy.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_entropy_example
shannon_entropy_example(use)
base_e¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--p-base e \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
base='e',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
base='e',
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_base_e_example
shannon_base_e_example(use)
dropping undefined samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--p-drop-undefined-samples \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
drop_undefined_samples=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
drop_undefined_samples=TRUE,
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_drop_example
shannon_drop_example(use)
diversity-lib bray-curtis¶
Compute Bray-Curtis dissimilarity for each sample in a feature table. Note: Frequency and relative frequency data produce different results unless overall sample sizes are identical. Please consider the impact on your results if you use Bray-Curtis with count data that has not been adjusted (normalized).
Citations¶
Sørensen, 1948
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Bray-Curtis dissimilarity should be computed.[required]
Parameters¶
- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Bray-Curtis dissimilarity[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_example
bray_curtis_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--p-n-jobs 1 \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
n_jobs=1L,
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_n_jobs_example
bray_curtis_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--p-n-jobs auto \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
n_jobs='auto',
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_auto_jobs_example
bray_curtis_auto_jobs_example(use)
diversity-lib jaccard¶
Compute Jaccard distance for each sample in a feature table. Jaccard is calculated usingpresence/absence data. Data of type FeatureTable[Frequency | Relative Frequency] is reducedto presence/absence prior to calculation.
Citations¶
Jaccard, 1908
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Jaccard distance should be computed.[required]
Parameters¶
- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Jaccard index[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_example
jaccard_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--p-n-jobs 1 \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
n_jobs=1L,
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_n_jobs_example
jaccard_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--p-n-jobs auto \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
n_jobs='auto',
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_auto_jobs_example
jaccard_auto_jobs_example(use)
diversity-lib unweighted-unifrac¶
Compute Unweighted Unifrac for each sample in a feature table
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Unweighted Unifrac should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Unweighted Unifrac.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_example
u_u_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_n_threads_example
u_u_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_auto_threads_example
u_u_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=TRUE,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_bypass_tips_example
u_u_bypass_tips_example(use)
diversity-lib weighted-unifrac¶
Compute Weighted Unifrac for each sample in a feature table
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Weighted Unifrac should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Unweighted Unifrac.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_example
w_u_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_n_threads_example
w_u_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_auto_threads_example
w_u_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=TRUE,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_bypass_tips_example
w_u_bypass_tips_example(use)
diversity-lib alpha-passthrough¶
Computes a vector of values (one value for each samples in a feature table) using the scikit-bio implementation of the selected alpha diversity metric.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples for which a selected metric should be computed.[required]
Parameters¶
- metric:
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', 'osd', 'robbins', 'simpson', 'simpson_e', 'singles', 'strong') The alpha diversity metric to be computed.[required]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for the chosen metric.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
qiime diversity-lib alpha-passthrough \
--i-table feature-table.qza \
--p-metric simpson \
--o-vector simpson-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
simpson_vector, = diversity_lib_actions.alpha_passthrough(
table=feature_table,
metric='simpson',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$alpha_passthrough(
table=feature_table,
metric='simpson',
)
simpson_vector <- action_results$vector
from q2_diversity_lib.examples import alpha_passthrough_example
alpha_passthrough_example(use)
diversity-lib beta-passthrough¶
Computes a distance matrix for all pairs of samples in a feature table using the scikit-bio implementation of the selected beta diversity metric.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples over which beta diversity should be computed.[required]
Parameters¶
- metric:
Str%Choices('aitchison', 'canberra', 'canberra_adkins', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jensenshannon', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalsneath', 'sqeuclidean', 'yule') The beta diversity metric to be computed.[required]
- pseudocount:
Int%Range(1, None) A pseudocount to handle zeros for compositional metrics. This is ignored for non-compositional metrics.[default:
1]- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric euclidean \
--o-distance-matrix euclidean-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
euclidean_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='euclidean',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='euclidean',
)
euclidean_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_example
beta_passthrough_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric euclidean \
--p-n-jobs 1 \
--o-distance-matrix euclidean-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
euclidean_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='euclidean',
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='euclidean',
n_jobs=1L,
)
euclidean_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_n_jobs_example
beta_passthrough_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
# A default pseudocount of 1 is added to feature counts. Pseudocount is
# ignored for non-compositional metrics.
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric aitchison \
--p-n-jobs auto \
--o-distance-matrix aitchison-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# A default pseudocount of 1 is added to feature counts. Pseudocount is ignored for non-compositional metrics.
aitchison_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# A default pseudocount of 1 is added to feature counts. Pseudocount is ignored for non-compositional metrics.
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
)
aitchison_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_auto_jobs_example
beta_passthrough_auto_jobs_example(use)
use 'pseudocount' to manually set a pseudocount for compositional metrics¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric aitchison \
--p-n-jobs auto \
--p-pseudocount 5 \
--o-distance-matrix aitchison-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
aitchison_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
pseudocount=5,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
pseudocount=5L,
)
aitchison_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_pseudocount_example
beta_passthrough_pseudocount_example(use)
diversity-lib beta-phylogenetic-passthrough¶
Computes a distance matrix for all pairs of samples in a feature table using the unifrac implementation of the selected beta diversity metric.
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018; Chang et al., 2011; Chen et al., 2012; Sfiligoi et al., n.d.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples over which beta diversity should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- metric:
Str%Choices('generalized_unifrac', 'unweighted_unifrac', 'weighted_normalized_unifrac', 'weighted_unifrac') The beta diversity metric to be computed.[required]
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- variance_adjusted:
Bool Perform variance adjustment based on Chang et al. BMC Bioinformatics 2011. Weights distances based on the proportion of the relative abundance represented between the samples at a given node under evaluation.[default:
False]- alpha:
Float%Range(0, 1, inclusive_end=True) This parameter is only used when the choice of metric is generalized_unifrac. The value of alpha controls importance of sample proportions. 1.0 is weighted normalized UniFrac. 0.0 is close to unweighted UniFrac, but only if the sample proportions are dichotomized.[optional]
- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_example
beta_phylo_passthrough_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads=1,
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_n_threads_example
beta_phylo_passthrough_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_auto_threads_example
beta_phylo_passthrough_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
threads='auto',
bypass_tips=TRUE,
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_bypass_tips_example
beta_phylo_passthrough_bypass_tips_example(use)
variance adjustment¶
# Chang et al's variance adjustment may be applied to any unifrac method by
# using this passthrough function.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_unifrac \
--p-threads auto \
--p-variance-adjusted \
--o-distance-matrix var-adj-weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# Chang et al's variance adjustment may be applied to any unifrac method by using this passthrough function.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
var_adj_weighted_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_unifrac',
threads='auto',
variance_adjusted=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# Chang et al's variance adjustment may be applied to any unifrac method by using this passthrough function.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_unifrac',
threads='auto',
variance_adjusted=TRUE,
)
var_adj_weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_variance_adjusted_example
beta_phylo_passthrough_variance_adjusted_example(use)
minimal generalized unifrac¶
# Generalized unifrac is passed alpha=1 by default. This is roughly
# equivalent to weighted normalized unifrac, which method will be used
# instead, because it is better optimized.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric generalized_unifrac \
--o-distance-matrix generalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# Generalized unifrac is passed alpha=1 by default. This is roughly equivalent to weighted normalized unifrac, which method will be used instead, because it is better optimized.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
generalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# Generalized unifrac is passed alpha=1 by default. This is roughly equivalent to weighted normalized unifrac, which method will be used instead, because it is better optimized.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
)
generalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_min_generalized_unifrac_example
beta_phylo_passthrough_min_generalized_unifrac_example(use)
generalized unifrac¶
# passing a float between 0 and 1 to 'alpha' gives you control over the
# importance of sample proportions.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric generalized_unifrac \
--p-alpha 0.75 \
--o-distance-matrix generalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# passing a float between 0 and 1 to 'alpha' gives you control over the importance of sample proportions.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
generalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
alpha=0.75,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# passing a float between 0 and 1 to 'alpha' gives you control over the importance of sample proportions.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
alpha=0.75,
)
generalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_generalized_unifrac_example
beta_phylo_passthrough_generalized_unifrac_example(use)
diversity-lib beta-phylogenetic-meta-passthrough¶
Computes a distance matrix for all pairs of samples in the set of feature table and phylogeny pairs, using the unifrac implementation of the selected beta diversity metric.
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018; Chang et al., 2011; Chen et al., 2012; Lozupone et al., 2008
Inputs¶
- tables:
List[FeatureTable[Frequency]] The feature tables containing the samples over which beta diversity should be computed.[required]
- phylogenies:
List[Phylogeny[Rooted]] Phylogenetic trees containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- metric:
Str%Choices('generalized_unifrac', 'unweighted_unifrac', 'weighted_normalized_unifrac', 'weighted_unifrac') The beta diversity metric to be computed.[required]
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- variance_adjusted:
Bool Perform variance adjustment based on Chang et al. BMC Bioinformatics 2011. Weights distances based on the proportion of the relative abundance represented between the samples at a given node under evaluation.[default:
False]- alpha:
Float%Range(0, 1, inclusive_end=True) This parameter is only used when the choice of metric is generalized_unifrac. The value of alpha controls importance of sample proportions. 1.0 is weighted normalized UniFrac. 0.0 is close to unweighted UniFrac, but only if the sample proportions are dichotomized.[optional]
- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]- weights:
List[Float] The weight applied to each tree/table pair. This tuple is expected to be in index order with tables and phylogenies. Default is to weight each tree/table pair evenly.[optional]
- consolidation:
Str%Choices('skipping_missing_matrices', 'missing_zero', 'missing_one', 'skipping_missing_values') The matrix consolidation method, which determines how the individual distance matrices are aggregated[default:
'skipping_missing_values']
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
Basic meta unifrac¶
# For brevity, these examples are focused on meta-specific parameters. See
# the documentation for beta_phylogenetic_passthrough for additional
# relevant information.
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
wget -O 'phylogeny1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
wget -O 'phylogeny2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
# NOTE: the number of trees and tables must match.
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny1.qza phylogeny2.qza \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# For brevity, these examples are focused on meta-specific parameters. See the documentation for beta_phylogenetic_passthrough for additional relevant information.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
fn = 'phylogeny1.qza'
request.urlretrieve(url, fn)
phylogeny1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
fn = 'phylogeny2.qza'
request.urlretrieve(url, fn)
phylogeny2 = Artifact.load(fn)
# NOTE: the number of trees and tables must match.
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny1, phylogeny2],
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# For brevity, these examples are focused on meta-specific parameters. See the documentation for beta_phylogenetic_passthrough for additional relevant information.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
fn <- 'phylogeny1.qza'
request$urlretrieve(url, fn)
phylogeny1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
fn <- 'phylogeny2.qza'
request$urlretrieve(url, fn)
phylogeny2 <- Artifact$load(fn)
# NOTE: the number of trees and tables must match.
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny1, phylogeny2),
metric='weighted_normalized_unifrac',
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_passthrough_example
beta_phylo_meta_passthrough_example(use)
meta with weights¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny.qza phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--p-weights 3.0 42.0 \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny, phylogeny],
metric='weighted_normalized_unifrac',
weights=[3.0, 42.0],
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny, phylogeny),
metric='weighted_normalized_unifrac',
weights=list(3.0, 42.0),
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_weights_example
beta_phylo_meta_weights_example(use)
changing the consolidation method¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
wget -O 'phylogeny1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
wget -O 'phylogeny2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny1.qza phylogeny2.qza \
--p-metric weighted_normalized_unifrac \
--p-weights 0.4 0.6 \
--p-consolidation skipping_missing_values \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
fn = 'phylogeny1.qza'
request.urlretrieve(url, fn)
phylogeny1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
fn = 'phylogeny2.qza'
request.urlretrieve(url, fn)
phylogeny2 = Artifact.load(fn)
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny1, phylogeny2],
metric='weighted_normalized_unifrac',
weights=[0.4, 0.6],
consolidation='skipping_missing_values',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
fn <- 'phylogeny1.qza'
request$urlretrieve(url, fn)
phylogeny1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
fn <- 'phylogeny2.qza'
request$urlretrieve(url, fn)
phylogeny2 <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny1, phylogeny2),
metric='weighted_normalized_unifrac',
weights=list(0.4, 0.6),
consolidation='skipping_missing_values',
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_consolidation_example
beta_phylo_meta_consolidation_example(use)
This QIIME 2 plugin computes individual metrics for community alpha and beta diversity.
- version:
2026.4.0 - website: https://
github .com /qiime2 /q2 -diversity -lib - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
| Name | Type | Short Description |
|---|---|---|
| faith-pd | method | Faith's Phylogenetic Diversity |
| observed-features | method | Observed Features |
| pielou-evenness | method | Pielou's Evenness |
| shannon-entropy | method | Shannon's Entropy |
| bray-curtis | method | Bray-Curtis Dissimilarity |
| jaccard | method | Jaccard Distance |
| unweighted-unifrac | method | Unweighted Unifrac |
| weighted-unifrac | method | Weighted Unifrac |
| alpha-passthrough | method | Alpha Passthrough (non-phylogenetic) |
| beta-passthrough | method | Beta Passthrough (non-phylogenetic) |
| beta-phylogenetic-passthrough | method | Beta Phylogenetic Passthrough |
| beta-phylogenetic-meta-passthrough | method | Beta Phylogenetic Meta Passthrough |
diversity-lib faith-pd¶
Computes Faith's Phylogenetic Diversity for all samples in a feature table.
Citations¶
Faith, 1992; Armstrong et al., 2021
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Faith's phylogenetic diversity should be computed. Table values will be converted to presence/absence.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Faith's Phylogenetic Diversity.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
qiime diversity-lib faith-pd \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-vector faith-pd-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
faith_pd_vector, = diversity_lib_actions.faith_pd(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/faith-pd/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$faith_pd(
table=feature_table,
phylogeny=phylogeny,
)
faith_pd_vector <- action_results$vector
from q2_diversity_lib.examples import faith_pd_example
faith_pd_example(use)
diversity-lib observed-features¶
Compute the number of observed features for each sample in a feature table
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which the number of observed features should be calculated. Table values will be converted to presence/absence.[required]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample counts of observed features.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
qiime diversity-lib observed-features \
--i-table feature-table.qza \
--o-vector obs-feat-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
obs_feat_vector, = diversity_lib_actions.observed_features(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/observed-features/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$observed_features(
table=feature_table,
)
obs_feat_vector <- action_results$vector
from q2_diversity_lib.examples import observed_features_example
observed_features_example(use)
diversity-lib pielou-evenness¶
Compute Pielou's Evenness for each sample in a feature table
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Pielou's evenness should be computed.[required]
Parameters¶
- drop_undefined_samples:
Bool Samples with fewer than two observed features produce undefined (NaN) values. If true, these samples are dropped from the output vector.[default:
False]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Pielou's Evenness.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
qiime diversity-lib pielou-evenness \
--i-table feature-table.qza \
--o-vector pielou-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
pielou_vector, = diversity_lib_actions.pielou_evenness(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$pielou_evenness(
table=feature_table,
)
pielou_vector <- action_results$vector
from q2_diversity_lib.examples import pielou_evenness_example
pielou_evenness_example(use)
dropping undefined samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
qiime diversity-lib pielou-evenness \
--i-table feature-table.qza \
--p-drop-undefined-samples \
--o-vector pielou-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
pielou_vector, = diversity_lib_actions.pielou_evenness(
table=feature_table,
drop_undefined_samples=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/pielou-evenness/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$pielou_evenness(
table=feature_table,
drop_undefined_samples=TRUE,
)
pielou_vector <- action_results$vector
from q2_diversity_lib.examples import pielou_drop_example
pielou_drop_example(use)
diversity-lib shannon-entropy¶
Compute Shannon's Entropy for each sample in a feature table
Citations¶
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Shannon's Entropy should be computed.[required]
Parameters¶
- drop_undefined_samples:
Bool Samples with no observed features produce undefined (NaN) values. If true, these samples are dropped from the output vector.[default:
False]- base:
Float%Range(0, None, inclusive_start=False)|Str%Choices('e') The logarithm base used in calculations.[default:
2]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for Shannon's Entropy.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_entropy_example
shannon_entropy_example(use)
base_e¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--p-base e \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
base='e',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# Set the logarithm base to e for the Shannon calculation.
# This will result in values that match those produced by
# vegan and scikit-bio.
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
base='e',
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_base_e_example
shannon_base_e_example(use)
dropping undefined samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
qiime diversity-lib shannon-entropy \
--i-table feature-table.qza \
--p-drop-undefined-samples \
--o-vector shannon-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
shannon_vector, = diversity_lib_actions.shannon_entropy(
table=feature_table,
drop_undefined_samples=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/shannon-entropy/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$shannon_entropy(
table=feature_table,
drop_undefined_samples=TRUE,
)
shannon_vector <- action_results$vector
from q2_diversity_lib.examples import shannon_drop_example
shannon_drop_example(use)
diversity-lib bray-curtis¶
Compute Bray-Curtis dissimilarity for each sample in a feature table. Note: Frequency and relative frequency data produce different results unless overall sample sizes are identical. Please consider the impact on your results if you use Bray-Curtis with count data that has not been adjusted (normalized).
Citations¶
Sørensen, 1948
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Bray-Curtis dissimilarity should be computed.[required]
Parameters¶
- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Bray-Curtis dissimilarity[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_example
bray_curtis_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--p-n-jobs 1 \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
n_jobs=1L,
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_n_jobs_example
bray_curtis_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
qiime diversity-lib bray-curtis \
--i-table feature-table.qza \
--p-n-jobs auto \
--o-distance-matrix bray-curtis-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
bray_curtis_dm, = diversity_lib_actions.bray_curtis(
table=feature_table,
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/bray-curtis/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$bray_curtis(
table=feature_table,
n_jobs='auto',
)
bray_curtis_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import bray_curtis_auto_jobs_example
bray_curtis_auto_jobs_example(use)
diversity-lib jaccard¶
Compute Jaccard distance for each sample in a feature table. Jaccard is calculated usingpresence/absence data. Data of type FeatureTable[Frequency | Relative Frequency] is reducedto presence/absence prior to calculation.
Citations¶
Jaccard, 1908
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Jaccard distance should be computed.[required]
Parameters¶
- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Jaccard index[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_example
jaccard_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--p-n-jobs 1 \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
n_jobs=1L,
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_n_jobs_example
jaccard_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
qiime diversity-lib jaccard \
--i-table feature-table.qza \
--p-n-jobs auto \
--o-distance-matrix jaccard-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
jaccard_dm, = diversity_lib_actions.jaccard(
table=feature_table,
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/jaccard/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$jaccard(
table=feature_table,
n_jobs='auto',
)
jaccard_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import jaccard_auto_jobs_example
jaccard_auto_jobs_example(use)
diversity-lib unweighted-unifrac¶
Compute Unweighted Unifrac for each sample in a feature table
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency | PresenceAbsence] The feature table containing the samples for which Unweighted Unifrac should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Unweighted Unifrac.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_example
u_u_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_n_threads_example
u_u_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_auto_threads_example
u_u_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib unweighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix unweighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
unweighted_unifrac_dm, = diversity_lib_actions.unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/unweighted-unifrac/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$unweighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=TRUE,
)
unweighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import u_u_bypass_tips_example
u_u_bypass_tips_example(use)
diversity-lib weighted-unifrac¶
Compute Weighted Unifrac for each sample in a feature table
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency] The feature table containing the samples for which Weighted Unifrac should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix Distance matrix for Unweighted Unifrac.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_example
w_u_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_n_threads_example
w_u_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_auto_threads_example
w_u_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib weighted-unifrac \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
weighted_unifrac_dm, = diversity_lib_actions.weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/weighted-unifrac/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$weighted_unifrac(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
bypass_tips=TRUE,
)
weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import w_u_bypass_tips_example
w_u_bypass_tips_example(use)
diversity-lib alpha-passthrough¶
Computes a vector of values (one value for each samples in a feature table) using the scikit-bio implementation of the selected alpha diversity metric.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples for which a selected metric should be computed.[required]
Parameters¶
- metric:
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', 'osd', 'robbins', 'simpson', 'simpson_e', 'singles', 'strong') The alpha diversity metric to be computed.[required]
Outputs¶
- vector:
SampleData[AlphaDiversity] Vector containing per-sample values for the chosen metric.[required]
Examples¶
basic¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
qiime diversity-lib alpha-passthrough \
--i-table feature-table.qza \
--p-metric simpson \
--o-vector simpson-vector.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
simpson_vector, = diversity_lib_actions.alpha_passthrough(
table=feature_table,
metric='simpson',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/alpha-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$alpha_passthrough(
table=feature_table,
metric='simpson',
)
simpson_vector <- action_results$vector
from q2_diversity_lib.examples import alpha_passthrough_example
alpha_passthrough_example(use)
diversity-lib beta-passthrough¶
Computes a distance matrix for all pairs of samples in a feature table using the scikit-bio implementation of the selected beta diversity metric.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples over which beta diversity should be computed.[required]
Parameters¶
- metric:
Str%Choices('aitchison', 'canberra', 'canberra_adkins', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jensenshannon', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalsneath', 'sqeuclidean', 'yule') The beta diversity metric to be computed.[required]
- pseudocount:
Int%Range(1, None) A pseudocount to handle zeros for compositional metrics. This is ignored for non-compositional metrics.[default:
1]- n_jobs:
Threads The number of concurrent jobs to use in performing this calculation. May not exceed the number of available physical cores. If n_jobs = 'auto', one job will be launched for each identified CPU core on the host.[default:
1]
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric euclidean \
--o-distance-matrix euclidean-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
euclidean_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='euclidean',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='euclidean',
)
euclidean_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_example
beta_passthrough_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric euclidean \
--p-n-jobs 1 \
--o-distance-matrix euclidean-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
euclidean_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='euclidean',
n_jobs=1,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='euclidean',
n_jobs=1L,
)
euclidean_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_n_jobs_example
beta_passthrough_n_jobs_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
# A default pseudocount of 1 is added to feature counts. Pseudocount is
# ignored for non-compositional metrics.
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric aitchison \
--p-n-jobs auto \
--o-distance-matrix aitchison-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# A default pseudocount of 1 is added to feature counts. Pseudocount is ignored for non-compositional metrics.
aitchison_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# A default pseudocount of 1 is added to feature counts. Pseudocount is ignored for non-compositional metrics.
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
)
aitchison_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_auto_jobs_example
beta_passthrough_auto_jobs_example(use)
use 'pseudocount' to manually set a pseudocount for compositional metrics¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
qiime diversity-lib beta-passthrough \
--i-table feature-table.qza \
--p-metric aitchison \
--p-n-jobs auto \
--p-pseudocount 5 \
--o-distance-matrix aitchison-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
aitchison_dm, = diversity_lib_actions.beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
pseudocount=5,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-passthrough/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_passthrough(
table=feature_table,
metric='aitchison',
n_jobs='auto',
pseudocount=5L,
)
aitchison_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_passthrough_pseudocount_example
beta_passthrough_pseudocount_example(use)
diversity-lib beta-phylogenetic-passthrough¶
Computes a distance matrix for all pairs of samples in a feature table using the unifrac implementation of the selected beta diversity metric.
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018; Chang et al., 2011; Chen et al., 2012; Sfiligoi et al., n.d.
Inputs¶
- table:
FeatureTable[Frequency] The feature table containing the samples over which beta diversity should be computed.[required]
- phylogeny:
Phylogeny[Rooted] Phylogenetic tree containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- metric:
Str%Choices('generalized_unifrac', 'unweighted_unifrac', 'weighted_normalized_unifrac', 'weighted_unifrac') The beta diversity metric to be computed.[required]
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- variance_adjusted:
Bool Perform variance adjustment based on Chang et al. BMC Bioinformatics 2011. Weights distances based on the proportion of the relative abundance represented between the samples at a given node under evaluation.[default:
False]- alpha:
Float%Range(0, 1, inclusive_end=True) This parameter is only used when the choice of metric is generalized_unifrac. The value of alpha controls importance of sample proportions. 1.0 is weighted normalized UniFrac. 0.0 is close to unweighted UniFrac, but only if the sample proportions are dichotomized.[optional]
- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
run on one core (by default)¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/1/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_example
beta_phylo_passthrough_example(use)
to run on n cores, replace 1 here with your preferred integer¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads 1 \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads=1,
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads=1L,
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_n_threads_example
beta_phylo_passthrough_n_threads_example(use)
use 'auto' to run on all of host system's available CPU cores¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-threads auto \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/3/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
threads='auto',
metric='weighted_normalized_unifrac',
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_auto_threads_example
beta_phylo_passthrough_auto_threads_example(use)
use bypass_tips to trade specificity for reduced compute time¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
# bypass_tips can be used with any threads setting, but auto may be a good
# choice if you're trimming run time.
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--p-threads auto \
--p-bypass-tips \
--o-distance-matrix weighted-normalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
weighted_normalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
threads='auto',
bypass_tips=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/4/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# bypass_tips can be used with any threads setting, but auto may be a good choice if you're trimming run time.
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_normalized_unifrac',
threads='auto',
bypass_tips=TRUE,
)
weighted_normalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_bypass_tips_example
beta_phylo_passthrough_bypass_tips_example(use)
variance adjustment¶
# Chang et al's variance adjustment may be applied to any unifrac method by
# using this passthrough function.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric weighted_unifrac \
--p-threads auto \
--p-variance-adjusted \
--o-distance-matrix var-adj-weighted-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# Chang et al's variance adjustment may be applied to any unifrac method by using this passthrough function.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
var_adj_weighted_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_unifrac',
threads='auto',
variance_adjusted=True,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# Chang et al's variance adjustment may be applied to any unifrac method by using this passthrough function.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/5/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='weighted_unifrac',
threads='auto',
variance_adjusted=TRUE,
)
var_adj_weighted_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_variance_adjusted_example
beta_phylo_passthrough_variance_adjusted_example(use)
minimal generalized unifrac¶
# Generalized unifrac is passed alpha=1 by default. This is roughly
# equivalent to weighted normalized unifrac, which method will be used
# instead, because it is better optimized.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric generalized_unifrac \
--o-distance-matrix generalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# Generalized unifrac is passed alpha=1 by default. This is roughly equivalent to weighted normalized unifrac, which method will be used instead, because it is better optimized.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
generalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# Generalized unifrac is passed alpha=1 by default. This is roughly equivalent to weighted normalized unifrac, which method will be used instead, because it is better optimized.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/6/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
)
generalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_min_generalized_unifrac_example
beta_phylo_passthrough_min_generalized_unifrac_example(use)
generalized unifrac¶
# passing a float between 0 and 1 to 'alpha' gives you control over the
# importance of sample proportions.
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
qiime diversity-lib beta-phylogenetic-passthrough \
--i-table feature-table.qza \
--i-phylogeny phylogeny.qza \
--p-metric generalized_unifrac \
--p-alpha 0.75 \
--o-distance-matrix generalized-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# passing a float between 0 and 1 to 'alpha' gives you control over the importance of sample proportions.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
generalized_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
alpha=0.75,
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# passing a float between 0 and 1 to 'alpha' gives you control over the importance of sample proportions.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-passthrough/7/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_passthrough(
table=feature_table,
phylogeny=phylogeny,
metric='generalized_unifrac',
alpha=0.75,
)
generalized_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_passthrough_generalized_unifrac_example
beta_phylo_passthrough_generalized_unifrac_example(use)
diversity-lib beta-phylogenetic-meta-passthrough¶
Computes a distance matrix for all pairs of samples in the set of feature table and phylogeny pairs, using the unifrac implementation of the selected beta diversity metric.
Citations¶
Lozupone & Knight, 2005; Lozupone et al., 2007; Hamady et al., 2010; Lozupone et al., 2011; McDonald et al., 2018; Chang et al., 2011; Chen et al., 2012; Lozupone et al., 2008
Inputs¶
- tables:
List[FeatureTable[Frequency]] The feature tables containing the samples over which beta diversity should be computed.[required]
- phylogenies:
List[Phylogeny[Rooted]] Phylogenetic trees containing tip identifiers that correspond to the feature identifiers in the table. This tree can contain tip ids that are not present in the table, but all feature ids in the table must be present in this tree.[required]
Parameters¶
- metric:
Str%Choices('generalized_unifrac', 'unweighted_unifrac', 'weighted_normalized_unifrac', 'weighted_unifrac') The beta diversity metric to be computed.[required]
- threads:
Threads The number of CPU threads to use in performing this calculation. May not exceed the number of available physical cores. If threads = 'auto', one thread will be created for each identified CPU core on the host.[default:
1]- variance_adjusted:
Bool Perform variance adjustment based on Chang et al. BMC Bioinformatics 2011. Weights distances based on the proportion of the relative abundance represented between the samples at a given node under evaluation.[default:
False]- alpha:
Float%Range(0, 1, inclusive_end=True) This parameter is only used when the choice of metric is generalized_unifrac. The value of alpha controls importance of sample proportions. 1.0 is weighted normalized UniFrac. 0.0 is close to unweighted UniFrac, but only if the sample proportions are dichotomized.[optional]
- bypass_tips:
Bool In a bifurcating tree, the tips make up about 50% of the nodes in a tree. By ignoring them, specificity can be traded 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]- weights:
List[Float] The weight applied to each tree/table pair. This tuple is expected to be in index order with tables and phylogenies. Default is to weight each tree/table pair evenly.[optional]
- consolidation:
Str%Choices('skipping_missing_matrices', 'missing_zero', 'missing_one', 'skipping_missing_values') The matrix consolidation method, which determines how the individual distance matrices are aggregated[default:
'skipping_missing_values']
Outputs¶
- distance_matrix:
DistanceMatrix The resulting distance matrix.[required]
Examples¶
Basic meta unifrac¶
# For brevity, these examples are focused on meta-specific parameters. See
# the documentation for beta_phylogenetic_passthrough for additional
# relevant information.
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
wget -O 'phylogeny1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
wget -O 'phylogeny2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
# NOTE: the number of trees and tables must match.
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny1.qza phylogeny2.qza \
--p-metric weighted_normalized_unifrac \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
# For brevity, these examples are focused on meta-specific parameters. See the documentation for beta_phylogenetic_passthrough for additional relevant information.
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
fn = 'phylogeny1.qza'
request.urlretrieve(url, fn)
phylogeny1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
fn = 'phylogeny2.qza'
request.urlretrieve(url, fn)
phylogeny2 = Artifact.load(fn)
# NOTE: the number of trees and tables must match.
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny1, phylogeny2],
metric='weighted_normalized_unifrac',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
# For brevity, these examples are focused on meta-specific parameters. See the documentation for beta_phylogenetic_passthrough for additional relevant information.
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny1.qza'
fn <- 'phylogeny1.qza'
request$urlretrieve(url, fn)
phylogeny1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/1/phylogeny2.qza'
fn <- 'phylogeny2.qza'
request$urlretrieve(url, fn)
phylogeny2 <- Artifact$load(fn)
# NOTE: the number of trees and tables must match.
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny1, phylogeny2),
metric='weighted_normalized_unifrac',
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_passthrough_example
beta_phylo_meta_passthrough_example(use)
meta with weights¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
wget -O 'phylogeny.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny.qza phylogeny.qza \
--p-metric weighted_normalized_unifrac \
--p-weights 3.0 42.0 \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
fn = 'phylogeny.qza'
request.urlretrieve(url, fn)
phylogeny = Artifact.load(fn)
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny, phylogeny],
metric='weighted_normalized_unifrac',
weights=[3.0, 42.0],
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/2/phylogeny.qza'
fn <- 'phylogeny.qza'
request$urlretrieve(url, fn)
phylogeny <- Artifact$load(fn)
# The number of weights must match the number of tables/trees.
# If meaningful, it is possible to pass the same phylogeny more than once.
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny, phylogeny),
metric='weighted_normalized_unifrac',
weights=list(3.0, 42.0),
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_weights_example
beta_phylo_meta_weights_example(use)
changing the consolidation method¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
wget -O 'phylogeny1.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
wget -O 'phylogeny2.qza' \
'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
qiime diversity-lib beta-phylogenetic-meta-passthrough \
--i-tables feature-table1.qza feature-table2.qza \
--i-phylogenies phylogeny1.qza phylogeny2.qza \
--p-metric weighted_normalized_unifrac \
--p-weights 0.4 0.6 \
--p-consolidation skipping_missing_values \
--o-distance-matrix ft1-ft2-w-norm-unifrac-dm.qzafrom qiime2 import Artifact
from urllib import request
import rachis.plugins.diversity_lib.actions as diversity_lib_actions
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
fn = 'phylogeny1.qza'
request.urlretrieve(url, fn)
phylogeny1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
fn = 'phylogeny2.qza'
request.urlretrieve(url, fn)
phylogeny2 = Artifact.load(fn)
ft1_ft2_w_norm_unifrac_dm, = diversity_lib_actions.beta_phylogenetic_meta_passthrough(
tables=[feature_table1, feature_table2],
phylogenies=[phylogeny1, phylogeny2],
metric='weighted_normalized_unifrac',
weights=[0.4, 0.6],
consolidation='skipping_missing_values',
)library(reticulate)
Artifact <- import("qiime2")$Artifact
diversity_lib_actions <- import("rachis.plugins.diversity_lib.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny1.qza'
fn <- 'phylogeny1.qza'
request$urlretrieve(url, fn)
phylogeny1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/stable/data/examples/diversity-lib/beta-phylogenetic-meta-passthrough/3/phylogeny2.qza'
fn <- 'phylogeny2.qza'
request$urlretrieve(url, fn)
phylogeny2 <- Artifact$load(fn)
action_results <- diversity_lib_actions$beta_phylogenetic_meta_passthrough(
tables=list(feature_table1, feature_table2),
phylogenies=list(phylogeny1, phylogeny2),
metric='weighted_normalized_unifrac',
weights=list(0.4, 0.6),
consolidation='skipping_missing_values',
)
ft1_ft2_w_norm_unifrac_dm <- action_results$distance_matrix
from q2_diversity_lib.examples import beta_phylo_meta_consolidation_example
beta_phylo_meta_consolidation_example(use)
- Links
- Documentation
- Source Code
- Stars
- 0
- Last Commit
- 791d93e
- Available Distros
- 2026.4
- 2026.4/qiime2
- 2026.1
- 2026.1/qiime2
- 2026.1/moshpit
- 2025.10
- 2025.10/qiime2
- 2025.10/moshpit
- 2025.7
- 2025.7/qiime2
- 2025.7/moshpit
- 2025.4
- 2025.4/qiime2
- 2025.4/moshpit
- 2024.10
- 2024.10/qiime2
- 2024.10/moshpit
- 2024.5
- 2024.5/qiime2
- 2024.5/moshpit
- 2024.2
- 2024.2/qiime2
- 2023.9
- 2023.9/qiime2
- 2023.7
- 2023.7/qiime2