This is a QIIME 2 plugin supporting operations on sample by feature tables, such as filtering, merging, and transforming tables.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -feature -table - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
Name | Type | Short Description |
---|---|---|
rarefy | method | Rarefy table |
subsample-ids | method | Subsample table |
presence-absence | method | Convert to presence/absence |
relative-frequency | method | Convert to relative frequencies |
transpose | method | Transpose a feature table. |
group | method | Group samples or features by a metadata column |
merge | method | Combine multiple tables |
merge-seqs | method | Combine collections of feature sequences |
merge-taxa | method | Combine collections of feature taxonomies |
rename-ids | method | Renames sample or feature ids in a table |
filter-samples | method | Filter samples from table |
filter-features-conditionally | method | Filter features from a table based on abundance and prevalence |
filter-features | method | Filter features from table |
filter-seqs | method | Filter features from sequences |
split | method | Split one feature table into many |
tabulate-feature-frequencies | method | Tabulate feature frequencies |
tabulate-sample-frequencies | method | Tabulate sample frequencies |
summarize | visualizer | Summarize table |
tabulate-seqs | visualizer | View sequence associated with each feature |
core-features | visualizer | Identify core features in table |
heatmap | visualizer | Generate a heatmap representation of a feature table |
summarize-plus | pipeline | Summarize table plus |
feature-table rarefy¶
Subsample frequencies from all samples so that the sum of frequencies in each sample is equal to sampling-depth.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be rarefied.[required]
Parameters¶
- sampling_depth:
Int
%
Range
(1, None)
The total frequency that each sample should be rarefied to. Samples where the sum of frequencies is less than the sampling depth will be not be included in the resulting table.[required]
- with_replacement:
Bool
Rarefy with replacement by sampling from the multinomial distribution instead of rarefying without replacement.[default:
False
]
Outputs¶
- rarefied_table:
FeatureTable[Frequency]
The resulting rarefied feature table.[required]
feature-table subsample-ids¶
Randomly pick samples or features, without replacement, from the table.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be sampled.[required]
Parameters¶
- subsampling_depth:
Int
%
Range
(1, None)
The total number of samples or features to be randomly sampled. Samples or features that are reduced to a zero sum will not be included in the resulting table.[required]
- axis:
Str
%
Choices
('sample', 'feature')
The axis to sample over. If "sample" then samples will be randomly selected to be retained. If "feature" then a random set of features will be selected to be retained.[required]
Outputs¶
- sampled_table:
FeatureTable[Frequency]
The resulting subsampled feature table.[required]
feature-table presence-absence¶
Convert frequencies to binary values indicating presence or absence of a feature in a sample.
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency]
The feature table to be converted into presence/absence abundances.[required]
Outputs¶
- presence_absence_table:
FeatureTable[PresenceAbsence]
The resulting presence/absence feature table.[required]
feature-table relative-frequency¶
Convert frequencies to relative frequencies by dividing each frequency in a sample by the sum of frequencies in that sample.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be converted into relative frequencies.[required]
Outputs¶
- relative_frequency_table:
FeatureTable[RelativeFrequency]
The resulting relative frequency feature table.[required]
feature-table transpose¶
Transpose the rows and columns (typically samples and features) of a feature table.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table to be transposed.[required]
Outputs¶
- transposed_feature_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting transposed feature table.[required]
feature-table group¶
Group samples or features in a feature table using metadata to define the mapping of IDs to a group.
Inputs¶
- table:
FeatureTable[Frequency]
The table to group samples or features on.[required]
Parameters¶
- axis:
Str
%
Choices
('feature', 'sample')
Along which axis to group. Each ID in the given axis must exist in
metadata
.[required]- metadata:
MetadataColumn
[
Categorical
]
A column defining the groups. Each unique value will become a new ID for the table on the given
axis
.[required]- mode:
Str
%
Choices
('mean-ceiling', 'median-ceiling', 'sum')
How to combine samples or features within a group.
sum
will sum the frequencies across all samples or features within a group;mean-ceiling
will take the ceiling of the mean of these frequencies;median-ceiling
will take the ceiling of the median of these frequencies.[required]
Outputs¶
- grouped_table:
FeatureTable[Frequency]
A table that has been grouped along the given
axis
. IDs on that axis are replaced by values in themetadata
column.[required]
Examples¶
group_samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
# Combine samples from the same body-site into single sample. Feature
# frequencies will be the median across the samples being combined, rounded
# up to the nearest whole number.
qiime feature-table group \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--m-metadata-column body-site \
--p-mode median-ceiling \
--p-axis sample \
--o-grouped-table body-site-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
body_site_mdc = sample_metadata_md.get_column('body-site')
# Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
body_site_table, = feature_table_actions.group(
table=feature_table,
metadata=body_site_mdc,
mode='median-ceiling',
axis='sample',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /group /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /group /1 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
- Using the
qiime2 feature-table group
tool: - Set "table" to
#: feature-table.qza
- Set "axis" to
sample
- For "metadata":
- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Set "Column Name" to
body-site
- Leave as
- Set "mode" to
median-ceiling
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table group [...] : grouped_table.qza
body-site-table.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
body_site_mdc <- sample_metadata_md$get_column('body-site')
# Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
action_results <- feature_table_actions$group(
table=feature_table,
metadata=body_site_mdc,
mode='median-ceiling',
axis='sample',
)
body_site_table <- action_results$grouped_table
from q2_feature_table._examples import feature_table_group_samples
feature_table_group_samples(use)
feature-table merge¶
Combines feature tables using the overlap_method
provided.
Inputs¶
- tables:
List
[
FeatureTable[Frequency]
|
FeatureTable[RelativeFrequency]
|
FeatureTable[PresenceAbsence]
]
The collection of feature tables to be merged.[required]
Parameters¶
- overlap_method:
Str
%
Choices
('average', 'error_on_overlapping_feature', 'error_on_overlapping_sample', 'sum')
|
Str
%
Choices
('average', 'error_on_overlapping_feature', 'error_on_overlapping_sample')
|
Str
%
Choices
('error_on_overlapping_feature', 'error_on_overlapping_sample', 'union')
Method for handling overlapping ids.[default:
'error_on_overlapping_sample'
]
Outputs¶
- merged_table:
FeatureTable[Frequency]
|
FeatureTable[RelativeFrequency]
|
FeatureTable[PresenceAbsence]
The resulting merged feature table.[required]
Examples¶
feature_table_merge_two_tables¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
qiime feature-table merge \
--i-tables feature-table1.qza feature-table2.qza \
--o-merged-table merged-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
merged_table, = feature_table_actions.merge(
tables=[feature_table1, feature_table2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /1 /feature -table1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /1 /feature -table2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge
tool: - For "tables", use ctrl-(or command)-click to select the following inputs:
#: feature-table1.qza
#: feature-table2.qza
- Press the
Execute
button.
- For "tables", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge(
tables=list(feature_table1, feature_table2),
)
merged_table <- action_results$merged_table
from q2_feature_table._examples import feature_table_merge_two_tables
feature_table_merge_two_tables(use)
feature_table_merge_three_tables¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
wget -O 'feature-table3.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
qiime feature-table merge \
--i-tables feature-table1.qza feature-table2.qza feature-table3.qza \
--p-overlap-method sum \
--o-merged-table merged-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
fn = 'feature-table3.qza'
request.urlretrieve(url, fn)
feature_table3 = Artifact.load(fn)
merged_table, = feature_table_actions.merge(
tables=[feature_table1, feature_table2, feature_table3],
overlap_method='sum',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table3.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table3 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge
tool: - For "tables", use ctrl-(or command)-click to select the following inputs:
#: feature-table1.qza
#: feature-table2.qza
#: feature-table3.qza
- Expand the
additional options
section- Set "overlap_method" to
sum
- Set "overlap_method" to
- Press the
Execute
button.
- For "tables", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
fn <- 'feature-table3.qza'
request$urlretrieve(url, fn)
feature_table3 <- Artifact$load(fn)
action_results <- feature_table_actions$merge(
tables=list(feature_table1, feature_table2, feature_table3),
overlap_method='sum',
)
merged_table <- action_results$merged_table
from q2_feature_table._examples import feature_table_merge_three_tables
feature_table_merge_three_tables(use)
feature-table merge-seqs¶
Combines feature data objects which may or may not contain data for the same features. If different feature data is present for the same feature id in the inputs, the data from the first will be propagated to the result.
Inputs¶
- data:
List
[
FeatureData[Sequence]
]
The collection of feature sequences to be merged.[required]
Outputs¶
- merged_data:
FeatureData[Sequence]
The resulting collection of feature sequences containing all feature sequences provided.[required]
Examples¶
feature_table_merge_seqs¶
wget -O 'seqs1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
wget -O 'seqs2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
qiime feature-table merge-seqs \
--i-data seqs1.qza seqs2.qza \
--o-merged-data merged-data.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
fn = 'seqs1.qza'
request.urlretrieve(url, fn)
seqs1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
fn = 'seqs2.qza'
request.urlretrieve(url, fn)
seqs2 = Artifact.load(fn)
merged_data, = feature_table_actions.merge_seqs(
data=[seqs1, seqs2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
seqs1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -seqs /1 /seqs1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
seqs2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -seqs /1 /seqs2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge-seqs
tool: - For "data", use ctrl-(or command)-click to select the following inputs:
#: seqs1.qza
#: seqs2.qza
- Press the
Execute
button.
- For "data", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
fn <- 'seqs1.qza'
request$urlretrieve(url, fn)
seqs1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
fn <- 'seqs2.qza'
request$urlretrieve(url, fn)
seqs2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge_seqs(
data=list(seqs1, seqs2),
)
merged_data <- action_results$merged_data
from q2_feature_table._examples import feature_table_merge_seqs
feature_table_merge_seqs(use)
feature-table merge-taxa¶
Combines a pair of feature data objects which may or may not contain data for the same features. If different feature data is present for the same feature id in the inputs, the data from the first will be propagated to the result.
Inputs¶
- data:
List
[
FeatureData[Taxonomy]
]
The collection of feature taxonomies to be merged.[required]
Outputs¶
- merged_data:
FeatureData[Taxonomy]
The resulting collection of feature taxonomies containing all feature taxonomies provided.[required]
Examples¶
feature_table_merge_taxa¶
wget -O 'tax1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
wget -O 'tax2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
qiime feature-table merge-taxa \
--i-data tax1.qza tax2.qza \
--o-merged-data merged-data.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
fn = 'tax1.qza'
request.urlretrieve(url, fn)
tax1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
fn = 'tax2.qza'
request.urlretrieve(url, fn)
tax2 = Artifact.load(fn)
merged_data, = feature_table_actions.merge_taxa(
data=[tax1, tax2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
tax1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -taxa /1 /tax1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
tax2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -taxa /1 /tax2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge-taxa
tool: - For "data", use ctrl-(or command)-click to select the following inputs:
#: tax1.qza
#: tax2.qza
- Press the
Execute
button.
- For "data", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
fn <- 'tax1.qza'
request$urlretrieve(url, fn)
tax1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
fn <- 'tax2.qza'
request$urlretrieve(url, fn)
tax2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge_taxa(
data=list(tax1, tax2),
)
merged_data <- action_results$merged_data
from q2_feature_table._examples import feature_table_merge_taxa
feature_table_merge_taxa(use)
feature-table rename-ids¶
Renames the sample or feature ids in a feature table using metadata to define the new ids.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The table to be renamed[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
A metadata column defining the new ids. Each original id must map to a new unique id. If strict mode is used, then every id in the original table must have a new id.[required]
- axis:
Str
%
Choices
('feature', 'sample')
Along which axis to rename the ids.[default:
'sample'
]- strict:
Bool
Whether the naming needs to be strict (each id in the table must have a new id). Otherwise, only the ids described in
metadata
will be renamed and the others will keep their original id names.[default:False
]
Outputs¶
- renamed_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
A table which has new ids, where the ids are replaced by values in the
metadata
column.[required]
feature-table filter-samples¶
Filter samples from table based on frequency and/or metadata. Any features with a frequency of zero after sample filtering will also be removed. See the filtering tutorial on https://
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table from which samples should be filtered.[required]
Parameters¶
- min_frequency:
Int
The minimum total frequency that a sample must have to be retained.[default:
0
]- max_frequency:
Int
The maximum total frequency that a sample can have to be retained. If no value is provided this will default to infinity (i.e., no maximum frequency filter will be applied).[optional]
- min_features:
Int
The minimum number of features that a sample must have to be retained.[default:
0
]- max_features:
Int
The maximum number of features that a sample can have to be retained. If no value is provided this will default to infinity (i.e., no maximum feature filter will be applied).[optional]
- metadata:
Metadata
Sample metadata used with
where
parameter when selecting samples to retain, or withexclude_ids
when selecting samples to discard.[optional]- where:
Str
SQLite WHERE clause specifying sample metadata criteria that must be met to be included in the filtered feature table. If not provided, all samples in
metadata
that are also in the feature table will be retained.[optional]- exclude_ids:
Bool
If true, the samples selected by
metadata
orwhere
parameters will be excluded from the filtered table instead of being retained.[default:False
]- filter_empty_features:
Bool
If true, features which are not present in any retained samples are dropped.[default:
True
]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting feature table filtered by sample.[required]
Examples¶
filter_to_subject1¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /1 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1
feature_table_filter_samples_to_subject1(use)
filter_to_skin¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[body-site] IN ("left palm", "right palm")' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site] IN ("left palm", "right palm")',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /2 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /2 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[body-site] IN ("left palm", "right palm")
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site] IN ("left palm", "right palm")',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_skin
feature_table_filter_samples_to_skin(use)
filter_to_subject1_gut¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1" AND [body-site]="gut"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND [body-site]="gut"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /3 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /3 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1" AND [body-site]="gut"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND [body-site]="gut"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1_gut
feature_table_filter_samples_to_subject1_gut(use)
filter_to_gut_or_abx¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[body-site]="gut" OR [reported-antibiotic-usage]="Yes"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site]="gut" OR [reported-antibiotic-usage]="Yes"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /4 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /4 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[body-site]="gut" OR [reported-antibiotic-usage]="Yes"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site]="gut" OR [reported-antibiotic-usage]="Yes"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_gut_or_abx
feature_table_filter_samples_to_gut_or_abx(use)
filter_to_subject1_not_gut¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1" AND NOT [body-site]="gut"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND NOT [body-site]="gut"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /5 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /5 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1" AND NOT [body-site]="gut"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND NOT [body-site]="gut"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1_not_gut
feature_table_filter_samples_to_subject1_not_gut(use)
filter_min_features¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--p-min-features 10 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
min_features=10,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /6 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_features" to
10
- Set "min_features" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
min_features=10L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_min_features
feature_table_filter_samples_min_features(use)
filter_min_frequency¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--p-min-frequency 1500 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
min_frequency=1500,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /7 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_frequency" to
1500
- Set "min_frequency" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
min_frequency=1500L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_min_frequency
feature_table_filter_samples_min_frequency(use)
feature-table filter-features-conditionally¶
Filter features based on the relative abundance in a certain portion of samples (i.e., features must have a relative abundance of at least abundance
in at least prevalence
number of samples). Any samples with a frequency of zero after feature filtering will also be removed.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table from which features should be filtered.[required]
Parameters¶
- abundance:
Float
%
Range
(0, 1)
The minimum relative abundance for a feature to be retained.[required]
- prevalence:
Float
%
Range
(0, 1)
The minimum portion of samples that a feature must have a relative abundance of at least
abundance
to be retained.[required]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting feature table filtered by feature.[required]
Examples¶
feature_table_filter_features_conditionally¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
# Retain only features with at least 1%% abundance in at least 34%% of
# samples.
qiime feature-table filter-features-conditionally \
--i-table feature-table.qza \
--p-abundance 0.01 \
--p-prevalence 0.34 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# Retain only features with at least 1%% abundance in at least 34%% of samples.
filtered_table, = feature_table_actions.filter_features_conditionally(
table=feature_table,
abundance=0.01,
prevalence=0.34,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -features -conditionally /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
Retain only features with at least 1%% abundance in at least 34%% of samples.
- Using the
qiime2 feature-table filter-features-conditionally
tool: - Set "table" to
#: feature-table.qza
- Set "abundance" to
0.01
- Set "prevalence" to
0.34
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# Retain only features with at least 1%% abundance in at least 34%% of samples.
action_results <- feature_table_actions$filter_features_conditionally(
table=feature_table,
abundance=0.01,
prevalence=0.34,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_features_conditionally
feature_table_filter_features_conditionally(use)
feature-table filter-features¶
Filter features from table based on frequency and/or metadata. Any samples with a frequency of zero after feature filtering will also be removed. See the filtering tutorial on https://
Inputs¶
- table:
FeatureTable[Frequency]
The feature table from which features should be filtered.[required]
Parameters¶
- min_frequency:
Int
The minimum total frequency that a feature must have to be retained.[default:
0
]- max_frequency:
Int
The maximum total frequency that a feature can have to be retained. If no value is provided this will default to infinity (i.e., no maximum frequency filter will be applied).[optional]
- min_samples:
Int
The minimum number of samples that a feature must be observed in to be retained.[default:
0
]- max_samples:
Int
The maximum number of samples that a feature can be observed in to be retained. If no value is provided this will default to infinity (i.e., no maximum sample filter will be applied).[optional]
- metadata:
Metadata
Feature metadata used with
where
parameter when selecting features to retain, or withexclude_ids
when selecting features to discard.[optional]- where:
Str
SQLite WHERE clause specifying feature metadata criteria that must be met to be included in the filtered feature table. If not provided, all features in
metadata
that are also in the feature table will be retained.[optional]- exclude_ids:
Bool
If true, the features selected by
metadata
orwhere
parameters will be excluded from the filtered table instead of being retained.[default:False
]- filter_empty_samples:
Bool
If true, drop any samples where none of the retained features are present.[default:
True
]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency]
The resulting feature table filtered by feature.[required]
Examples¶
filter_features_min_samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
qiime feature-table filter-features \
--i-table feature-table.qza \
--p-min-samples 2 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_features(
table=feature_table,
min_samples=2,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -features /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-features
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_samples" to
2
- Set "min_samples" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_features(
table=feature_table,
min_samples=2L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_features_min_samples
feature_table_filter_features_min_samples(use)
feature-table filter-seqs¶
Filter features from sequences based on a feature table or metadata. See the filtering tutorial on https://
Inputs¶
- data:
FeatureData[Sequence¹ | AlignedSequence²]
The sequences from which features should be filtered.[required]
- table:
FeatureTable[Frequency]
Table containing feature ids used for id-based filtering.[optional]
Parameters¶
- metadata:
Metadata
Feature metadata used for id-based filtering, with
where
parameter when selecting features to retain, or withexclude_ids
when selecting features to discard.[optional]- where:
Str
SQLite WHERE clause specifying feature metadata criteria that must be met to be included in the filtered feature table. If not provided, all features in
metadata
that are also in the sequences will be retained.[optional]- exclude_ids:
Bool
If true, the features selected by the
metadata
(with or without thewhere
parameter) ortable
parameter will be excluded from the filtered sequences instead of being retained.[default:False
]
Outputs¶
- filtered_data:
FeatureData[Sequence¹ | AlignedSequence²]
The resulting filtered sequences.[required]
feature-table split¶
Splits one feature table into many feature tables, where splits are defined by values in metadata column.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The table to split.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
A column defining the groups. Each unique value will define a split feature table.[required]
- filter_empty_features:
Bool
If true, features which are not present in a split feature table are dropped.[default:
True
]
Outputs¶
- tables:
Collection
[
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
]
Directory where feature tables split based on metadata values should be written.[required]
feature-table tabulate-feature-frequencies¶
Tabulate sample count and total frequency per feature.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence | RelativeFrequency]
The input feature table.[required]
Outputs¶
- feature_frequencies:
ImmutableMetadata
Per-sample and total frequencies per feature.[required]
Examples¶
feature_table_tabulate_feature_frequencies¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
qiime feature-table tabulate-feature-frequencies \
--i-table feature-table.qza \
--o-feature-frequencies feature-frequencies.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
feature_frequencies, = feature_table_actions.tabulate_feature_frequencies(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -feature -frequencies /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-feature-frequencies
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_feature_frequencies(
table=feature_table,
)
feature_frequencies <- action_results$feature_frequencies
from q2_feature_table._examples import feature_table_tabulate_feature_freqs
feature_table_tabulate_feature_freqs(use)
feature-table tabulate-sample-frequencies¶
Tabulate feature count and total frequency per sample.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence | RelativeFrequency]
The input feature table.[required]
Outputs¶
- sample_frequencies:
ImmutableMetadata
Observed feature count and total frequencies per sample.[required]
Examples¶
feature_table_tabulate_sample_frequencies¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
qiime feature-table tabulate-sample-frequencies \
--i-table feature-table.qza \
--o-sample-frequencies sample-frequencies.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
sample_frequencies, = feature_table_actions.tabulate_sample_frequencies(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -sample -frequencies /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-sample-frequencies
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_sample_frequencies(
table=feature_table,
)
sample_frequencies <- action_results$sample_frequencies
from q2_feature_table._examples import feature_table_tabulate_sample_freqs
feature_table_tabulate_sample_freqs(use)
feature-table summarize¶
Generate visual and tabular summaries of a feature table.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence]
The feature table to be summarized.[required]
Parameters¶
- sample_metadata:
Metadata
The sample metadata.[optional]
Outputs¶
- visualization:
Visualization
<no description>[required]
Examples¶
feature_table_summarize¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
qiime feature-table summarize \
--i-table feature-table.qza \
--o-visualization table.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
table_viz, = feature_table_actions.summarize(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /summarize /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table summarize
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table summarize [...] : visualization.qzv
table.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$summarize(
table=feature_table,
)
table_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_summarize
feature_table_summarize(use)
feature-table tabulate-seqs¶
Generate tabular view of feature identifier to sequence mapping, including links to BLAST each sequence against the NCBI nt database.
Citations¶
Coordinators, 2017; Johnson et al., 2008
Inputs¶
- data:
FeatureData[Sequence | AlignedSequence]
The feature sequences to be tabulated.[required]
- taxonomy:
Collection
[
FeatureData[Taxonomy]
]
The taxonomic classifications of the tabulated features.[optional]
Parameters¶
- metadata:
Metadata
Any additional metadata for the tabulated features.[optional]
- merge_method:
Str
%
Choices
('strict', 'union', 'intersect')
Method that joins data sets[default:
'strict'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
Examples¶
feature_table_tabulate_seqs¶
wget -O 'rep-seqs.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs.qza \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
fn = 'rep-seqs.qza'
request.urlretrieve(url, fn)
rep_seqs = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /1 /rep -seqs .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs.qza
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
fn <- 'rep-seqs.qza'
request$urlretrieve(url, fn)
rep_seqs <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs,
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs
feature_table_tabulate_seqs(use)
feature_table_tabulate_seqs_single_taxon¶
wget -O 'rep-seqs-single-taxon.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
wget -O 'single-taxonomy.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs-single-taxon.qza \
--i-taxonomy single-taxonomy.qza \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
fn = 'rep-seqs-single-taxon.qza'
request.urlretrieve(url, fn)
rep_seqs_single_taxon = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
fn = 'single-taxonomy.qza'
request.urlretrieve(url, fn)
single_taxonomy = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs_single_taxon,
taxonomy=[single_taxonomy],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs-single-taxon.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /2 /rep -seqs -single -taxon .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
single-taxonomy.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /2 /single -taxonomy .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs-single-taxon.qza
- Expand the
additional options
section- Set "taxonomy" to
#: ['single-taxonomy.qza']
- Set "taxonomy" to
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
fn <- 'rep-seqs-single-taxon.qza'
request$urlretrieve(url, fn)
rep_seqs_single_taxon <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
fn <- 'single-taxonomy.qza'
request$urlretrieve(url, fn)
single_taxonomy <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs_single_taxon,
taxonomy=list(single_taxonomy),
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs_single_taxon
feature_table_tabulate_seqs_single_taxon(use)
feature_table_tabulate_seqs_multi_taxon¶
wget -O 'rep-seqs-multi-taxon.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs-multi-taxon.qza \
--i-taxonomy multi-taxonomy/ \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
fn = 'rep-seqs-multi-taxon.qza'
request.urlretrieve(url, fn)
rep_seqs_multi_taxon = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs_multi_taxon,
taxonomy=multi_taxonomy_artifact_collection,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs-multi-taxon.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /3 /rep -seqs -multi -taxon .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs-multi-taxon.qza
- Expand the
additional options
section- Set "taxonomy" to
#: multi-taxonomy/
- Set "taxonomy" to
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
fn <- 'rep-seqs-multi-taxon.qza'
request$urlretrieve(url, fn)
rep_seqs_multi_taxon <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs_multi_taxon,
taxonomy=multi_taxonomy_artifact_collection,
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs_multi_taxon
feature_table_tabulate_seqs_multi_taxon(use)
feature-table core-features¶
Identify "core" features, which are features observed in a user-defined fraction of the samples. Since the core features are a function of the fraction of samples that the feature must be observed in to be considered core, this is computed over a range of fractions defined by the min_fraction
, max_fraction
, and steps
parameters.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to use in core features calculations.[required]
Parameters¶
- min_fraction:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
The minimum fraction of samples that a feature must be observed in for that feature to be considered a core feature.[default:
0.5
]- max_fraction:
Float
%
Range
(0.0, 1.0, inclusive_end=True)
The maximum fraction of samples that a feature must be observed in for that feature to be considered a core feature.[default:
1.0
]- steps:
Int
%
Range
(2, None)
The number of steps to take between
min_fraction
andmax_fraction
for core features calculations. This parameter has no effect ifmin_fraction
andmax_fraction
are the same value.[default:11
]
Outputs¶
- visualization:
Visualization
<no description>[required]
feature-table heatmap¶
Generate a heatmap representation of a feature table with optional clustering on both the sample and feature axes.
Tip: To generate a heatmap containing taxonomic annotations, use qiime taxa collapse
to collapse the feature table at the desired taxonomic level.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to visualize.[required]
Parameters¶
- sample_metadata:
MetadataColumn
[
Categorical
]
Annotate the sample IDs with these sample metadata values. When metadata is present and
cluster
='feature', samples will be sorted by the metadata values.[optional]- feature_metadata:
MetadataColumn
[
Categorical
]
Annotate the feature IDs with these feature metadata values. When metadata is present and
cluster
='sample', features will be sorted by the metadata values.[optional]- normalize:
Bool
Normalize the feature table by adding a psuedocount of 1 and then taking the log10 of the table.[default:
True
]- title:
Str
Optional custom plot title.[optional]
- metric:
Str
%
Choices
('braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule')
Metrics exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'euclidean'
]- method:
Str
%
Choices
('average', 'centroid', 'complete', 'median', 'single', 'ward', 'weighted')
Clustering methods exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'average'
]- cluster:
Str
%
Choices
('both', 'features', 'none', 'samples')
Specify which axes to cluster.[default:
'both'
]- color_scheme:
Str
%
Choices
('Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Vega10', 'Vega10_r', 'Vega20', 'Vega20_r', 'Vega20b', 'Vega20b_r', 'Vega20c', 'Vega20c_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'mako', 'mako_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'rocket', 'rocket_r', 'seismic', 'seismic_r', 'spectral', 'spectral_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'viridis', 'viridis_r', 'vlag', 'vlag_r', 'winter', 'winter_r')
The matplotlib colorscheme to generate the heatmap with.[default:
'rocket'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
feature-table summarize-plus¶
Generate visual and tabular summaries of a feature table. Tabulate sample and feature frequencies.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence]
The feature table to be summarized.[required]
Parameters¶
- metadata:
Metadata
The sample metadata.[optional]
Outputs¶
- feature_frequencies:
ImmutableMetadata
Per-sample and total frequencies per feature.[required]
- sample_frequencies:
ImmutableMetadata
Observed feature count and total frequencies per sample.[required]
- summary:
Visualization
Visual summary of feature table[required]
Examples¶
feature_table_summarize_plus¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
qiime feature-table summarize-plus \
--i-table feature-table.qza \
--o-feature-frequencies feature-frequencies.qza \
--o-sample-frequencies sample-frequencies.qza \
--o-summary visual summary.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
feature_frequencies, sample_frequencies, visual_summary_viz = feature_table_actions.summarize_plus(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /summarize -plus /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table summarize-plus
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
- Once completed, for each new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table summarize-plus [...] : feature_frequencies.qza
feature-frequencies.qza
#: qiime2 feature-table summarize-plus [...] : sample_frequencies.qza
sample-frequencies.qza
#: qiime2 feature-table summarize-plus [...] : summary.qzv
visual summary.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$summarize_plus(
table=feature_table,
)
feature_frequencies <- action_results$feature_frequencies
sample_frequencies <- action_results$sample_frequencies
visual_summary_viz <- action_results$summary
from q2_feature_table._examples import feature_table_summarize_plus
feature_table_summarize_plus(use)
This is a QIIME 2 plugin supporting operations on sample by feature tables, such as filtering, merging, and transforming tables.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -feature -table - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
Name | Type | Short Description |
---|---|---|
rarefy | method | Rarefy table |
subsample-ids | method | Subsample table |
presence-absence | method | Convert to presence/absence |
relative-frequency | method | Convert to relative frequencies |
transpose | method | Transpose a feature table. |
group | method | Group samples or features by a metadata column |
merge | method | Combine multiple tables |
merge-seqs | method | Combine collections of feature sequences |
merge-taxa | method | Combine collections of feature taxonomies |
rename-ids | method | Renames sample or feature ids in a table |
filter-samples | method | Filter samples from table |
filter-features-conditionally | method | Filter features from a table based on abundance and prevalence |
filter-features | method | Filter features from table |
filter-seqs | method | Filter features from sequences |
split | method | Split one feature table into many |
tabulate-feature-frequencies | method | Tabulate feature frequencies |
tabulate-sample-frequencies | method | Tabulate sample frequencies |
summarize | visualizer | Summarize table |
tabulate-seqs | visualizer | View sequence associated with each feature |
core-features | visualizer | Identify core features in table |
heatmap | visualizer | Generate a heatmap representation of a feature table |
summarize-plus | pipeline | Summarize table plus |
feature-table rarefy¶
Subsample frequencies from all samples so that the sum of frequencies in each sample is equal to sampling-depth.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be rarefied.[required]
Parameters¶
- sampling_depth:
Int
%
Range
(1, None)
The total frequency that each sample should be rarefied to. Samples where the sum of frequencies is less than the sampling depth will be not be included in the resulting table.[required]
- with_replacement:
Bool
Rarefy with replacement by sampling from the multinomial distribution instead of rarefying without replacement.[default:
False
]
Outputs¶
- rarefied_table:
FeatureTable[Frequency]
The resulting rarefied feature table.[required]
feature-table subsample-ids¶
Randomly pick samples or features, without replacement, from the table.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be sampled.[required]
Parameters¶
- subsampling_depth:
Int
%
Range
(1, None)
The total number of samples or features to be randomly sampled. Samples or features that are reduced to a zero sum will not be included in the resulting table.[required]
- axis:
Str
%
Choices
('sample', 'feature')
The axis to sample over. If "sample" then samples will be randomly selected to be retained. If "feature" then a random set of features will be selected to be retained.[required]
Outputs¶
- sampled_table:
FeatureTable[Frequency]
The resulting subsampled feature table.[required]
feature-table presence-absence¶
Convert frequencies to binary values indicating presence or absence of a feature in a sample.
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency]
The feature table to be converted into presence/absence abundances.[required]
Outputs¶
- presence_absence_table:
FeatureTable[PresenceAbsence]
The resulting presence/absence feature table.[required]
feature-table relative-frequency¶
Convert frequencies to relative frequencies by dividing each frequency in a sample by the sum of frequencies in that sample.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be converted into relative frequencies.[required]
Outputs¶
- relative_frequency_table:
FeatureTable[RelativeFrequency]
The resulting relative frequency feature table.[required]
feature-table transpose¶
Transpose the rows and columns (typically samples and features) of a feature table.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table to be transposed.[required]
Outputs¶
- transposed_feature_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting transposed feature table.[required]
feature-table group¶
Group samples or features in a feature table using metadata to define the mapping of IDs to a group.
Inputs¶
- table:
FeatureTable[Frequency]
The table to group samples or features on.[required]
Parameters¶
- axis:
Str
%
Choices
('feature', 'sample')
Along which axis to group. Each ID in the given axis must exist in
metadata
.[required]- metadata:
MetadataColumn
[
Categorical
]
A column defining the groups. Each unique value will become a new ID for the table on the given
axis
.[required]- mode:
Str
%
Choices
('mean-ceiling', 'median-ceiling', 'sum')
How to combine samples or features within a group.
sum
will sum the frequencies across all samples or features within a group;mean-ceiling
will take the ceiling of the mean of these frequencies;median-ceiling
will take the ceiling of the median of these frequencies.[required]
Outputs¶
- grouped_table:
FeatureTable[Frequency]
A table that has been grouped along the given
axis
. IDs on that axis are replaced by values in themetadata
column.[required]
Examples¶
group_samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
# Combine samples from the same body-site into single sample. Feature
# frequencies will be the median across the samples being combined, rounded
# up to the nearest whole number.
qiime feature-table group \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--m-metadata-column body-site \
--p-mode median-ceiling \
--p-axis sample \
--o-grouped-table body-site-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
body_site_mdc = sample_metadata_md.get_column('body-site')
# Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
body_site_table, = feature_table_actions.group(
table=feature_table,
metadata=body_site_mdc,
mode='median-ceiling',
axis='sample',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /group /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /group /1 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
- Using the
qiime2 feature-table group
tool: - Set "table" to
#: feature-table.qza
- Set "axis" to
sample
- For "metadata":
- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Set "Column Name" to
body-site
- Leave as
- Set "mode" to
median-ceiling
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table group [...] : grouped_table.qza
body-site-table.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
body_site_mdc <- sample_metadata_md$get_column('body-site')
# Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
action_results <- feature_table_actions$group(
table=feature_table,
metadata=body_site_mdc,
mode='median-ceiling',
axis='sample',
)
body_site_table <- action_results$grouped_table
from q2_feature_table._examples import feature_table_group_samples
feature_table_group_samples(use)
feature-table merge¶
Combines feature tables using the overlap_method
provided.
Inputs¶
- tables:
List
[
FeatureTable[Frequency]
|
FeatureTable[RelativeFrequency]
|
FeatureTable[PresenceAbsence]
]
The collection of feature tables to be merged.[required]
Parameters¶
- overlap_method:
Str
%
Choices
('average', 'error_on_overlapping_feature', 'error_on_overlapping_sample', 'sum')
|
Str
%
Choices
('average', 'error_on_overlapping_feature', 'error_on_overlapping_sample')
|
Str
%
Choices
('error_on_overlapping_feature', 'error_on_overlapping_sample', 'union')
Method for handling overlapping ids.[default:
'error_on_overlapping_sample'
]
Outputs¶
- merged_table:
FeatureTable[Frequency]
|
FeatureTable[RelativeFrequency]
|
FeatureTable[PresenceAbsence]
The resulting merged feature table.[required]
Examples¶
feature_table_merge_two_tables¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
qiime feature-table merge \
--i-tables feature-table1.qza feature-table2.qza \
--o-merged-table merged-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
merged_table, = feature_table_actions.merge(
tables=[feature_table1, feature_table2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /1 /feature -table1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /1 /feature -table2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge
tool: - For "tables", use ctrl-(or command)-click to select the following inputs:
#: feature-table1.qza
#: feature-table2.qza
- Press the
Execute
button.
- For "tables", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge(
tables=list(feature_table1, feature_table2),
)
merged_table <- action_results$merged_table
from q2_feature_table._examples import feature_table_merge_two_tables
feature_table_merge_two_tables(use)
feature_table_merge_three_tables¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
wget -O 'feature-table3.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
qiime feature-table merge \
--i-tables feature-table1.qza feature-table2.qza feature-table3.qza \
--p-overlap-method sum \
--o-merged-table merged-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
fn = 'feature-table3.qza'
request.urlretrieve(url, fn)
feature_table3 = Artifact.load(fn)
merged_table, = feature_table_actions.merge(
tables=[feature_table1, feature_table2, feature_table3],
overlap_method='sum',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table3.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table3 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge
tool: - For "tables", use ctrl-(or command)-click to select the following inputs:
#: feature-table1.qza
#: feature-table2.qza
#: feature-table3.qza
- Expand the
additional options
section- Set "overlap_method" to
sum
- Set "overlap_method" to
- Press the
Execute
button.
- For "tables", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
fn <- 'feature-table3.qza'
request$urlretrieve(url, fn)
feature_table3 <- Artifact$load(fn)
action_results <- feature_table_actions$merge(
tables=list(feature_table1, feature_table2, feature_table3),
overlap_method='sum',
)
merged_table <- action_results$merged_table
from q2_feature_table._examples import feature_table_merge_three_tables
feature_table_merge_three_tables(use)
feature-table merge-seqs¶
Combines feature data objects which may or may not contain data for the same features. If different feature data is present for the same feature id in the inputs, the data from the first will be propagated to the result.
Inputs¶
- data:
List
[
FeatureData[Sequence]
]
The collection of feature sequences to be merged.[required]
Outputs¶
- merged_data:
FeatureData[Sequence]
The resulting collection of feature sequences containing all feature sequences provided.[required]
Examples¶
feature_table_merge_seqs¶
wget -O 'seqs1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
wget -O 'seqs2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
qiime feature-table merge-seqs \
--i-data seqs1.qza seqs2.qza \
--o-merged-data merged-data.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
fn = 'seqs1.qza'
request.urlretrieve(url, fn)
seqs1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
fn = 'seqs2.qza'
request.urlretrieve(url, fn)
seqs2 = Artifact.load(fn)
merged_data, = feature_table_actions.merge_seqs(
data=[seqs1, seqs2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
seqs1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -seqs /1 /seqs1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
seqs2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -seqs /1 /seqs2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge-seqs
tool: - For "data", use ctrl-(or command)-click to select the following inputs:
#: seqs1.qza
#: seqs2.qza
- Press the
Execute
button.
- For "data", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
fn <- 'seqs1.qza'
request$urlretrieve(url, fn)
seqs1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
fn <- 'seqs2.qza'
request$urlretrieve(url, fn)
seqs2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge_seqs(
data=list(seqs1, seqs2),
)
merged_data <- action_results$merged_data
from q2_feature_table._examples import feature_table_merge_seqs
feature_table_merge_seqs(use)
feature-table merge-taxa¶
Combines a pair of feature data objects which may or may not contain data for the same features. If different feature data is present for the same feature id in the inputs, the data from the first will be propagated to the result.
Inputs¶
- data:
List
[
FeatureData[Taxonomy]
]
The collection of feature taxonomies to be merged.[required]
Outputs¶
- merged_data:
FeatureData[Taxonomy]
The resulting collection of feature taxonomies containing all feature taxonomies provided.[required]
Examples¶
feature_table_merge_taxa¶
wget -O 'tax1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
wget -O 'tax2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
qiime feature-table merge-taxa \
--i-data tax1.qza tax2.qza \
--o-merged-data merged-data.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
fn = 'tax1.qza'
request.urlretrieve(url, fn)
tax1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
fn = 'tax2.qza'
request.urlretrieve(url, fn)
tax2 = Artifact.load(fn)
merged_data, = feature_table_actions.merge_taxa(
data=[tax1, tax2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
tax1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -taxa /1 /tax1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
tax2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -taxa /1 /tax2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge-taxa
tool: - For "data", use ctrl-(or command)-click to select the following inputs:
#: tax1.qza
#: tax2.qza
- Press the
Execute
button.
- For "data", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
fn <- 'tax1.qza'
request$urlretrieve(url, fn)
tax1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
fn <- 'tax2.qza'
request$urlretrieve(url, fn)
tax2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge_taxa(
data=list(tax1, tax2),
)
merged_data <- action_results$merged_data
from q2_feature_table._examples import feature_table_merge_taxa
feature_table_merge_taxa(use)
feature-table rename-ids¶
Renames the sample or feature ids in a feature table using metadata to define the new ids.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The table to be renamed[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
A metadata column defining the new ids. Each original id must map to a new unique id. If strict mode is used, then every id in the original table must have a new id.[required]
- axis:
Str
%
Choices
('feature', 'sample')
Along which axis to rename the ids.[default:
'sample'
]- strict:
Bool
Whether the naming needs to be strict (each id in the table must have a new id). Otherwise, only the ids described in
metadata
will be renamed and the others will keep their original id names.[default:False
]
Outputs¶
- renamed_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
A table which has new ids, where the ids are replaced by values in the
metadata
column.[required]
feature-table filter-samples¶
Filter samples from table based on frequency and/or metadata. Any features with a frequency of zero after sample filtering will also be removed. See the filtering tutorial on https://
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table from which samples should be filtered.[required]
Parameters¶
- min_frequency:
Int
The minimum total frequency that a sample must have to be retained.[default:
0
]- max_frequency:
Int
The maximum total frequency that a sample can have to be retained. If no value is provided this will default to infinity (i.e., no maximum frequency filter will be applied).[optional]
- min_features:
Int
The minimum number of features that a sample must have to be retained.[default:
0
]- max_features:
Int
The maximum number of features that a sample can have to be retained. If no value is provided this will default to infinity (i.e., no maximum feature filter will be applied).[optional]
- metadata:
Metadata
Sample metadata used with
where
parameter when selecting samples to retain, or withexclude_ids
when selecting samples to discard.[optional]- where:
Str
SQLite WHERE clause specifying sample metadata criteria that must be met to be included in the filtered feature table. If not provided, all samples in
metadata
that are also in the feature table will be retained.[optional]- exclude_ids:
Bool
If true, the samples selected by
metadata
orwhere
parameters will be excluded from the filtered table instead of being retained.[default:False
]- filter_empty_features:
Bool
If true, features which are not present in any retained samples are dropped.[default:
True
]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting feature table filtered by sample.[required]
Examples¶
filter_to_subject1¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /1 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1
feature_table_filter_samples_to_subject1(use)
filter_to_skin¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[body-site] IN ("left palm", "right palm")' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site] IN ("left palm", "right palm")',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /2 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /2 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[body-site] IN ("left palm", "right palm")
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site] IN ("left palm", "right palm")',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_skin
feature_table_filter_samples_to_skin(use)
filter_to_subject1_gut¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1" AND [body-site]="gut"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND [body-site]="gut"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /3 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /3 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1" AND [body-site]="gut"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND [body-site]="gut"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1_gut
feature_table_filter_samples_to_subject1_gut(use)
filter_to_gut_or_abx¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[body-site]="gut" OR [reported-antibiotic-usage]="Yes"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site]="gut" OR [reported-antibiotic-usage]="Yes"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /4 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /4 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[body-site]="gut" OR [reported-antibiotic-usage]="Yes"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site]="gut" OR [reported-antibiotic-usage]="Yes"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_gut_or_abx
feature_table_filter_samples_to_gut_or_abx(use)
filter_to_subject1_not_gut¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1" AND NOT [body-site]="gut"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND NOT [body-site]="gut"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /5 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /5 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1" AND NOT [body-site]="gut"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND NOT [body-site]="gut"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1_not_gut
feature_table_filter_samples_to_subject1_not_gut(use)
filter_min_features¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--p-min-features 10 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
min_features=10,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /6 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_features" to
10
- Set "min_features" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
min_features=10L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_min_features
feature_table_filter_samples_min_features(use)
filter_min_frequency¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--p-min-frequency 1500 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
min_frequency=1500,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /7 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_frequency" to
1500
- Set "min_frequency" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
min_frequency=1500L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_min_frequency
feature_table_filter_samples_min_frequency(use)
feature-table filter-features-conditionally¶
Filter features based on the relative abundance in a certain portion of samples (i.e., features must have a relative abundance of at least abundance
in at least prevalence
number of samples). Any samples with a frequency of zero after feature filtering will also be removed.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table from which features should be filtered.[required]
Parameters¶
- abundance:
Float
%
Range
(0, 1)
The minimum relative abundance for a feature to be retained.[required]
- prevalence:
Float
%
Range
(0, 1)
The minimum portion of samples that a feature must have a relative abundance of at least
abundance
to be retained.[required]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting feature table filtered by feature.[required]
Examples¶
feature_table_filter_features_conditionally¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
# Retain only features with at least 1%% abundance in at least 34%% of
# samples.
qiime feature-table filter-features-conditionally \
--i-table feature-table.qza \
--p-abundance 0.01 \
--p-prevalence 0.34 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# Retain only features with at least 1%% abundance in at least 34%% of samples.
filtered_table, = feature_table_actions.filter_features_conditionally(
table=feature_table,
abundance=0.01,
prevalence=0.34,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -features -conditionally /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
Retain only features with at least 1%% abundance in at least 34%% of samples.
- Using the
qiime2 feature-table filter-features-conditionally
tool: - Set "table" to
#: feature-table.qza
- Set "abundance" to
0.01
- Set "prevalence" to
0.34
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# Retain only features with at least 1%% abundance in at least 34%% of samples.
action_results <- feature_table_actions$filter_features_conditionally(
table=feature_table,
abundance=0.01,
prevalence=0.34,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_features_conditionally
feature_table_filter_features_conditionally(use)
feature-table filter-features¶
Filter features from table based on frequency and/or metadata. Any samples with a frequency of zero after feature filtering will also be removed. See the filtering tutorial on https://
Inputs¶
- table:
FeatureTable[Frequency]
The feature table from which features should be filtered.[required]
Parameters¶
- min_frequency:
Int
The minimum total frequency that a feature must have to be retained.[default:
0
]- max_frequency:
Int
The maximum total frequency that a feature can have to be retained. If no value is provided this will default to infinity (i.e., no maximum frequency filter will be applied).[optional]
- min_samples:
Int
The minimum number of samples that a feature must be observed in to be retained.[default:
0
]- max_samples:
Int
The maximum number of samples that a feature can be observed in to be retained. If no value is provided this will default to infinity (i.e., no maximum sample filter will be applied).[optional]
- metadata:
Metadata
Feature metadata used with
where
parameter when selecting features to retain, or withexclude_ids
when selecting features to discard.[optional]- where:
Str
SQLite WHERE clause specifying feature metadata criteria that must be met to be included in the filtered feature table. If not provided, all features in
metadata
that are also in the feature table will be retained.[optional]- exclude_ids:
Bool
If true, the features selected by
metadata
orwhere
parameters will be excluded from the filtered table instead of being retained.[default:False
]- filter_empty_samples:
Bool
If true, drop any samples where none of the retained features are present.[default:
True
]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency]
The resulting feature table filtered by feature.[required]
Examples¶
filter_features_min_samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
qiime feature-table filter-features \
--i-table feature-table.qza \
--p-min-samples 2 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_features(
table=feature_table,
min_samples=2,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -features /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-features
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_samples" to
2
- Set "min_samples" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_features(
table=feature_table,
min_samples=2L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_features_min_samples
feature_table_filter_features_min_samples(use)
feature-table filter-seqs¶
Filter features from sequences based on a feature table or metadata. See the filtering tutorial on https://
Inputs¶
- data:
FeatureData[Sequence¹ | AlignedSequence²]
The sequences from which features should be filtered.[required]
- table:
FeatureTable[Frequency]
Table containing feature ids used for id-based filtering.[optional]
Parameters¶
- metadata:
Metadata
Feature metadata used for id-based filtering, with
where
parameter when selecting features to retain, or withexclude_ids
when selecting features to discard.[optional]- where:
Str
SQLite WHERE clause specifying feature metadata criteria that must be met to be included in the filtered feature table. If not provided, all features in
metadata
that are also in the sequences will be retained.[optional]- exclude_ids:
Bool
If true, the features selected by the
metadata
(with or without thewhere
parameter) ortable
parameter will be excluded from the filtered sequences instead of being retained.[default:False
]
Outputs¶
- filtered_data:
FeatureData[Sequence¹ | AlignedSequence²]
The resulting filtered sequences.[required]
feature-table split¶
Splits one feature table into many feature tables, where splits are defined by values in metadata column.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The table to split.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
A column defining the groups. Each unique value will define a split feature table.[required]
- filter_empty_features:
Bool
If true, features which are not present in a split feature table are dropped.[default:
True
]
Outputs¶
- tables:
Collection
[
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
]
Directory where feature tables split based on metadata values should be written.[required]
feature-table tabulate-feature-frequencies¶
Tabulate sample count and total frequency per feature.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence | RelativeFrequency]
The input feature table.[required]
Outputs¶
- feature_frequencies:
ImmutableMetadata
Per-sample and total frequencies per feature.[required]
Examples¶
feature_table_tabulate_feature_frequencies¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
qiime feature-table tabulate-feature-frequencies \
--i-table feature-table.qza \
--o-feature-frequencies feature-frequencies.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
feature_frequencies, = feature_table_actions.tabulate_feature_frequencies(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -feature -frequencies /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-feature-frequencies
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_feature_frequencies(
table=feature_table,
)
feature_frequencies <- action_results$feature_frequencies
from q2_feature_table._examples import feature_table_tabulate_feature_freqs
feature_table_tabulate_feature_freqs(use)
feature-table tabulate-sample-frequencies¶
Tabulate feature count and total frequency per sample.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence | RelativeFrequency]
The input feature table.[required]
Outputs¶
- sample_frequencies:
ImmutableMetadata
Observed feature count and total frequencies per sample.[required]
Examples¶
feature_table_tabulate_sample_frequencies¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
qiime feature-table tabulate-sample-frequencies \
--i-table feature-table.qza \
--o-sample-frequencies sample-frequencies.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
sample_frequencies, = feature_table_actions.tabulate_sample_frequencies(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -sample -frequencies /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-sample-frequencies
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_sample_frequencies(
table=feature_table,
)
sample_frequencies <- action_results$sample_frequencies
from q2_feature_table._examples import feature_table_tabulate_sample_freqs
feature_table_tabulate_sample_freqs(use)
feature-table summarize¶
Generate visual and tabular summaries of a feature table.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence]
The feature table to be summarized.[required]
Parameters¶
- sample_metadata:
Metadata
The sample metadata.[optional]
Outputs¶
- visualization:
Visualization
<no description>[required]
Examples¶
feature_table_summarize¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
qiime feature-table summarize \
--i-table feature-table.qza \
--o-visualization table.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
table_viz, = feature_table_actions.summarize(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /summarize /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table summarize
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table summarize [...] : visualization.qzv
table.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$summarize(
table=feature_table,
)
table_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_summarize
feature_table_summarize(use)
feature-table tabulate-seqs¶
Generate tabular view of feature identifier to sequence mapping, including links to BLAST each sequence against the NCBI nt database.
Citations¶
Coordinators, 2017; Johnson et al., 2008
Inputs¶
- data:
FeatureData[Sequence | AlignedSequence]
The feature sequences to be tabulated.[required]
- taxonomy:
Collection
[
FeatureData[Taxonomy]
]
The taxonomic classifications of the tabulated features.[optional]
Parameters¶
- metadata:
Metadata
Any additional metadata for the tabulated features.[optional]
- merge_method:
Str
%
Choices
('strict', 'union', 'intersect')
Method that joins data sets[default:
'strict'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
Examples¶
feature_table_tabulate_seqs¶
wget -O 'rep-seqs.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs.qza \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
fn = 'rep-seqs.qza'
request.urlretrieve(url, fn)
rep_seqs = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /1 /rep -seqs .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs.qza
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
fn <- 'rep-seqs.qza'
request$urlretrieve(url, fn)
rep_seqs <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs,
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs
feature_table_tabulate_seqs(use)
feature_table_tabulate_seqs_single_taxon¶
wget -O 'rep-seqs-single-taxon.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
wget -O 'single-taxonomy.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs-single-taxon.qza \
--i-taxonomy single-taxonomy.qza \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
fn = 'rep-seqs-single-taxon.qza'
request.urlretrieve(url, fn)
rep_seqs_single_taxon = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
fn = 'single-taxonomy.qza'
request.urlretrieve(url, fn)
single_taxonomy = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs_single_taxon,
taxonomy=[single_taxonomy],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs-single-taxon.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /2 /rep -seqs -single -taxon .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
single-taxonomy.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /2 /single -taxonomy .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs-single-taxon.qza
- Expand the
additional options
section- Set "taxonomy" to
#: ['single-taxonomy.qza']
- Set "taxonomy" to
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
fn <- 'rep-seqs-single-taxon.qza'
request$urlretrieve(url, fn)
rep_seqs_single_taxon <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
fn <- 'single-taxonomy.qza'
request$urlretrieve(url, fn)
single_taxonomy <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs_single_taxon,
taxonomy=list(single_taxonomy),
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs_single_taxon
feature_table_tabulate_seqs_single_taxon(use)
feature_table_tabulate_seqs_multi_taxon¶
wget -O 'rep-seqs-multi-taxon.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs-multi-taxon.qza \
--i-taxonomy multi-taxonomy/ \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
fn = 'rep-seqs-multi-taxon.qza'
request.urlretrieve(url, fn)
rep_seqs_multi_taxon = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs_multi_taxon,
taxonomy=multi_taxonomy_artifact_collection,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs-multi-taxon.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /3 /rep -seqs -multi -taxon .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs-multi-taxon.qza
- Expand the
additional options
section- Set "taxonomy" to
#: multi-taxonomy/
- Set "taxonomy" to
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
fn <- 'rep-seqs-multi-taxon.qza'
request$urlretrieve(url, fn)
rep_seqs_multi_taxon <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs_multi_taxon,
taxonomy=multi_taxonomy_artifact_collection,
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs_multi_taxon
feature_table_tabulate_seqs_multi_taxon(use)
feature-table core-features¶
Identify "core" features, which are features observed in a user-defined fraction of the samples. Since the core features are a function of the fraction of samples that the feature must be observed in to be considered core, this is computed over a range of fractions defined by the min_fraction
, max_fraction
, and steps
parameters.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to use in core features calculations.[required]
Parameters¶
- min_fraction:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
The minimum fraction of samples that a feature must be observed in for that feature to be considered a core feature.[default:
0.5
]- max_fraction:
Float
%
Range
(0.0, 1.0, inclusive_end=True)
The maximum fraction of samples that a feature must be observed in for that feature to be considered a core feature.[default:
1.0
]- steps:
Int
%
Range
(2, None)
The number of steps to take between
min_fraction
andmax_fraction
for core features calculations. This parameter has no effect ifmin_fraction
andmax_fraction
are the same value.[default:11
]
Outputs¶
- visualization:
Visualization
<no description>[required]
feature-table heatmap¶
Generate a heatmap representation of a feature table with optional clustering on both the sample and feature axes.
Tip: To generate a heatmap containing taxonomic annotations, use qiime taxa collapse
to collapse the feature table at the desired taxonomic level.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to visualize.[required]
Parameters¶
- sample_metadata:
MetadataColumn
[
Categorical
]
Annotate the sample IDs with these sample metadata values. When metadata is present and
cluster
='feature', samples will be sorted by the metadata values.[optional]- feature_metadata:
MetadataColumn
[
Categorical
]
Annotate the feature IDs with these feature metadata values. When metadata is present and
cluster
='sample', features will be sorted by the metadata values.[optional]- normalize:
Bool
Normalize the feature table by adding a psuedocount of 1 and then taking the log10 of the table.[default:
True
]- title:
Str
Optional custom plot title.[optional]
- metric:
Str
%
Choices
('braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule')
Metrics exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'euclidean'
]- method:
Str
%
Choices
('average', 'centroid', 'complete', 'median', 'single', 'ward', 'weighted')
Clustering methods exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'average'
]- cluster:
Str
%
Choices
('both', 'features', 'none', 'samples')
Specify which axes to cluster.[default:
'both'
]- color_scheme:
Str
%
Choices
('Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Vega10', 'Vega10_r', 'Vega20', 'Vega20_r', 'Vega20b', 'Vega20b_r', 'Vega20c', 'Vega20c_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'mako', 'mako_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'rocket', 'rocket_r', 'seismic', 'seismic_r', 'spectral', 'spectral_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'viridis', 'viridis_r', 'vlag', 'vlag_r', 'winter', 'winter_r')
The matplotlib colorscheme to generate the heatmap with.[default:
'rocket'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
feature-table summarize-plus¶
Generate visual and tabular summaries of a feature table. Tabulate sample and feature frequencies.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence]
The feature table to be summarized.[required]
Parameters¶
- metadata:
Metadata
The sample metadata.[optional]
Outputs¶
- feature_frequencies:
ImmutableMetadata
Per-sample and total frequencies per feature.[required]
- sample_frequencies:
ImmutableMetadata
Observed feature count and total frequencies per sample.[required]
- summary:
Visualization
Visual summary of feature table[required]
Examples¶
feature_table_summarize_plus¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
qiime feature-table summarize-plus \
--i-table feature-table.qza \
--o-feature-frequencies feature-frequencies.qza \
--o-sample-frequencies sample-frequencies.qza \
--o-summary visual summary.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
feature_frequencies, sample_frequencies, visual_summary_viz = feature_table_actions.summarize_plus(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /summarize -plus /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table summarize-plus
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
- Once completed, for each new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table summarize-plus [...] : feature_frequencies.qza
feature-frequencies.qza
#: qiime2 feature-table summarize-plus [...] : sample_frequencies.qza
sample-frequencies.qza
#: qiime2 feature-table summarize-plus [...] : summary.qzv
visual summary.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$summarize_plus(
table=feature_table,
)
feature_frequencies <- action_results$feature_frequencies
sample_frequencies <- action_results$sample_frequencies
visual_summary_viz <- action_results$summary
from q2_feature_table._examples import feature_table_summarize_plus
feature_table_summarize_plus(use)
This is a QIIME 2 plugin supporting operations on sample by feature tables, such as filtering, merging, and transforming tables.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -feature -table - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
Name | Type | Short Description |
---|---|---|
rarefy | method | Rarefy table |
subsample-ids | method | Subsample table |
presence-absence | method | Convert to presence/absence |
relative-frequency | method | Convert to relative frequencies |
transpose | method | Transpose a feature table. |
group | method | Group samples or features by a metadata column |
merge | method | Combine multiple tables |
merge-seqs | method | Combine collections of feature sequences |
merge-taxa | method | Combine collections of feature taxonomies |
rename-ids | method | Renames sample or feature ids in a table |
filter-samples | method | Filter samples from table |
filter-features-conditionally | method | Filter features from a table based on abundance and prevalence |
filter-features | method | Filter features from table |
filter-seqs | method | Filter features from sequences |
split | method | Split one feature table into many |
tabulate-feature-frequencies | method | Tabulate feature frequencies |
tabulate-sample-frequencies | method | Tabulate sample frequencies |
summarize | visualizer | Summarize table |
tabulate-seqs | visualizer | View sequence associated with each feature |
core-features | visualizer | Identify core features in table |
heatmap | visualizer | Generate a heatmap representation of a feature table |
summarize-plus | pipeline | Summarize table plus |
feature-table rarefy¶
Subsample frequencies from all samples so that the sum of frequencies in each sample is equal to sampling-depth.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be rarefied.[required]
Parameters¶
- sampling_depth:
Int
%
Range
(1, None)
The total frequency that each sample should be rarefied to. Samples where the sum of frequencies is less than the sampling depth will be not be included in the resulting table.[required]
- with_replacement:
Bool
Rarefy with replacement by sampling from the multinomial distribution instead of rarefying without replacement.[default:
False
]
Outputs¶
- rarefied_table:
FeatureTable[Frequency]
The resulting rarefied feature table.[required]
feature-table subsample-ids¶
Randomly pick samples or features, without replacement, from the table.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be sampled.[required]
Parameters¶
- subsampling_depth:
Int
%
Range
(1, None)
The total number of samples or features to be randomly sampled. Samples or features that are reduced to a zero sum will not be included in the resulting table.[required]
- axis:
Str
%
Choices
('sample', 'feature')
The axis to sample over. If "sample" then samples will be randomly selected to be retained. If "feature" then a random set of features will be selected to be retained.[required]
Outputs¶
- sampled_table:
FeatureTable[Frequency]
The resulting subsampled feature table.[required]
feature-table presence-absence¶
Convert frequencies to binary values indicating presence or absence of a feature in a sample.
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency]
The feature table to be converted into presence/absence abundances.[required]
Outputs¶
- presence_absence_table:
FeatureTable[PresenceAbsence]
The resulting presence/absence feature table.[required]
feature-table relative-frequency¶
Convert frequencies to relative frequencies by dividing each frequency in a sample by the sum of frequencies in that sample.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be converted into relative frequencies.[required]
Outputs¶
- relative_frequency_table:
FeatureTable[RelativeFrequency]
The resulting relative frequency feature table.[required]
feature-table transpose¶
Transpose the rows and columns (typically samples and features) of a feature table.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table to be transposed.[required]
Outputs¶
- transposed_feature_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting transposed feature table.[required]
feature-table group¶
Group samples or features in a feature table using metadata to define the mapping of IDs to a group.
Inputs¶
- table:
FeatureTable[Frequency]
The table to group samples or features on.[required]
Parameters¶
- axis:
Str
%
Choices
('feature', 'sample')
Along which axis to group. Each ID in the given axis must exist in
metadata
.[required]- metadata:
MetadataColumn
[
Categorical
]
A column defining the groups. Each unique value will become a new ID for the table on the given
axis
.[required]- mode:
Str
%
Choices
('mean-ceiling', 'median-ceiling', 'sum')
How to combine samples or features within a group.
sum
will sum the frequencies across all samples or features within a group;mean-ceiling
will take the ceiling of the mean of these frequencies;median-ceiling
will take the ceiling of the median of these frequencies.[required]
Outputs¶
- grouped_table:
FeatureTable[Frequency]
A table that has been grouped along the given
axis
. IDs on that axis are replaced by values in themetadata
column.[required]
Examples¶
group_samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
# Combine samples from the same body-site into single sample. Feature
# frequencies will be the median across the samples being combined, rounded
# up to the nearest whole number.
qiime feature-table group \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--m-metadata-column body-site \
--p-mode median-ceiling \
--p-axis sample \
--o-grouped-table body-site-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
body_site_mdc = sample_metadata_md.get_column('body-site')
# Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
body_site_table, = feature_table_actions.group(
table=feature_table,
metadata=body_site_mdc,
mode='median-ceiling',
axis='sample',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /group /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /group /1 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
- Using the
qiime2 feature-table group
tool: - Set "table" to
#: feature-table.qza
- Set "axis" to
sample
- For "metadata":
- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Set "Column Name" to
body-site
- Leave as
- Set "mode" to
median-ceiling
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table group [...] : grouped_table.qza
body-site-table.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
body_site_mdc <- sample_metadata_md$get_column('body-site')
# Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
action_results <- feature_table_actions$group(
table=feature_table,
metadata=body_site_mdc,
mode='median-ceiling',
axis='sample',
)
body_site_table <- action_results$grouped_table
from q2_feature_table._examples import feature_table_group_samples
feature_table_group_samples(use)
feature-table merge¶
Combines feature tables using the overlap_method
provided.
Inputs¶
- tables:
List
[
FeatureTable[Frequency]
|
FeatureTable[RelativeFrequency]
|
FeatureTable[PresenceAbsence]
]
The collection of feature tables to be merged.[required]
Parameters¶
- overlap_method:
Str
%
Choices
('average', 'error_on_overlapping_feature', 'error_on_overlapping_sample', 'sum')
|
Str
%
Choices
('average', 'error_on_overlapping_feature', 'error_on_overlapping_sample')
|
Str
%
Choices
('error_on_overlapping_feature', 'error_on_overlapping_sample', 'union')
Method for handling overlapping ids.[default:
'error_on_overlapping_sample'
]
Outputs¶
- merged_table:
FeatureTable[Frequency]
|
FeatureTable[RelativeFrequency]
|
FeatureTable[PresenceAbsence]
The resulting merged feature table.[required]
Examples¶
feature_table_merge_two_tables¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
qiime feature-table merge \
--i-tables feature-table1.qza feature-table2.qza \
--o-merged-table merged-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
merged_table, = feature_table_actions.merge(
tables=[feature_table1, feature_table2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /1 /feature -table1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /1 /feature -table2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge
tool: - For "tables", use ctrl-(or command)-click to select the following inputs:
#: feature-table1.qza
#: feature-table2.qza
- Press the
Execute
button.
- For "tables", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge(
tables=list(feature_table1, feature_table2),
)
merged_table <- action_results$merged_table
from q2_feature_table._examples import feature_table_merge_two_tables
feature_table_merge_two_tables(use)
feature_table_merge_three_tables¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
wget -O 'feature-table3.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
qiime feature-table merge \
--i-tables feature-table1.qza feature-table2.qza feature-table3.qza \
--p-overlap-method sum \
--o-merged-table merged-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
fn = 'feature-table3.qza'
request.urlretrieve(url, fn)
feature_table3 = Artifact.load(fn)
merged_table, = feature_table_actions.merge(
tables=[feature_table1, feature_table2, feature_table3],
overlap_method='sum',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table3.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table3 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge
tool: - For "tables", use ctrl-(or command)-click to select the following inputs:
#: feature-table1.qza
#: feature-table2.qza
#: feature-table3.qza
- Expand the
additional options
section- Set "overlap_method" to
sum
- Set "overlap_method" to
- Press the
Execute
button.
- For "tables", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
fn <- 'feature-table3.qza'
request$urlretrieve(url, fn)
feature_table3 <- Artifact$load(fn)
action_results <- feature_table_actions$merge(
tables=list(feature_table1, feature_table2, feature_table3),
overlap_method='sum',
)
merged_table <- action_results$merged_table
from q2_feature_table._examples import feature_table_merge_three_tables
feature_table_merge_three_tables(use)
feature-table merge-seqs¶
Combines feature data objects which may or may not contain data for the same features. If different feature data is present for the same feature id in the inputs, the data from the first will be propagated to the result.
Inputs¶
- data:
List
[
FeatureData[Sequence]
]
The collection of feature sequences to be merged.[required]
Outputs¶
- merged_data:
FeatureData[Sequence]
The resulting collection of feature sequences containing all feature sequences provided.[required]
Examples¶
feature_table_merge_seqs¶
wget -O 'seqs1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
wget -O 'seqs2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
qiime feature-table merge-seqs \
--i-data seqs1.qza seqs2.qza \
--o-merged-data merged-data.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
fn = 'seqs1.qza'
request.urlretrieve(url, fn)
seqs1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
fn = 'seqs2.qza'
request.urlretrieve(url, fn)
seqs2 = Artifact.load(fn)
merged_data, = feature_table_actions.merge_seqs(
data=[seqs1, seqs2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
seqs1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -seqs /1 /seqs1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
seqs2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -seqs /1 /seqs2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge-seqs
tool: - For "data", use ctrl-(or command)-click to select the following inputs:
#: seqs1.qza
#: seqs2.qza
- Press the
Execute
button.
- For "data", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
fn <- 'seqs1.qza'
request$urlretrieve(url, fn)
seqs1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
fn <- 'seqs2.qza'
request$urlretrieve(url, fn)
seqs2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge_seqs(
data=list(seqs1, seqs2),
)
merged_data <- action_results$merged_data
from q2_feature_table._examples import feature_table_merge_seqs
feature_table_merge_seqs(use)
feature-table merge-taxa¶
Combines a pair of feature data objects which may or may not contain data for the same features. If different feature data is present for the same feature id in the inputs, the data from the first will be propagated to the result.
Inputs¶
- data:
List
[
FeatureData[Taxonomy]
]
The collection of feature taxonomies to be merged.[required]
Outputs¶
- merged_data:
FeatureData[Taxonomy]
The resulting collection of feature taxonomies containing all feature taxonomies provided.[required]
Examples¶
feature_table_merge_taxa¶
wget -O 'tax1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
wget -O 'tax2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
qiime feature-table merge-taxa \
--i-data tax1.qza tax2.qza \
--o-merged-data merged-data.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
fn = 'tax1.qza'
request.urlretrieve(url, fn)
tax1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
fn = 'tax2.qza'
request.urlretrieve(url, fn)
tax2 = Artifact.load(fn)
merged_data, = feature_table_actions.merge_taxa(
data=[tax1, tax2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
tax1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -taxa /1 /tax1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
tax2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -taxa /1 /tax2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge-taxa
tool: - For "data", use ctrl-(or command)-click to select the following inputs:
#: tax1.qza
#: tax2.qza
- Press the
Execute
button.
- For "data", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
fn <- 'tax1.qza'
request$urlretrieve(url, fn)
tax1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
fn <- 'tax2.qza'
request$urlretrieve(url, fn)
tax2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge_taxa(
data=list(tax1, tax2),
)
merged_data <- action_results$merged_data
from q2_feature_table._examples import feature_table_merge_taxa
feature_table_merge_taxa(use)
feature-table rename-ids¶
Renames the sample or feature ids in a feature table using metadata to define the new ids.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The table to be renamed[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
A metadata column defining the new ids. Each original id must map to a new unique id. If strict mode is used, then every id in the original table must have a new id.[required]
- axis:
Str
%
Choices
('feature', 'sample')
Along which axis to rename the ids.[default:
'sample'
]- strict:
Bool
Whether the naming needs to be strict (each id in the table must have a new id). Otherwise, only the ids described in
metadata
will be renamed and the others will keep their original id names.[default:False
]
Outputs¶
- renamed_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
A table which has new ids, where the ids are replaced by values in the
metadata
column.[required]
feature-table filter-samples¶
Filter samples from table based on frequency and/or metadata. Any features with a frequency of zero after sample filtering will also be removed. See the filtering tutorial on https://
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table from which samples should be filtered.[required]
Parameters¶
- min_frequency:
Int
The minimum total frequency that a sample must have to be retained.[default:
0
]- max_frequency:
Int
The maximum total frequency that a sample can have to be retained. If no value is provided this will default to infinity (i.e., no maximum frequency filter will be applied).[optional]
- min_features:
Int
The minimum number of features that a sample must have to be retained.[default:
0
]- max_features:
Int
The maximum number of features that a sample can have to be retained. If no value is provided this will default to infinity (i.e., no maximum feature filter will be applied).[optional]
- metadata:
Metadata
Sample metadata used with
where
parameter when selecting samples to retain, or withexclude_ids
when selecting samples to discard.[optional]- where:
Str
SQLite WHERE clause specifying sample metadata criteria that must be met to be included in the filtered feature table. If not provided, all samples in
metadata
that are also in the feature table will be retained.[optional]- exclude_ids:
Bool
If true, the samples selected by
metadata
orwhere
parameters will be excluded from the filtered table instead of being retained.[default:False
]- filter_empty_features:
Bool
If true, features which are not present in any retained samples are dropped.[default:
True
]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting feature table filtered by sample.[required]
Examples¶
filter_to_subject1¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /1 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1
feature_table_filter_samples_to_subject1(use)
filter_to_skin¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[body-site] IN ("left palm", "right palm")' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site] IN ("left palm", "right palm")',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /2 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /2 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[body-site] IN ("left palm", "right palm")
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site] IN ("left palm", "right palm")',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_skin
feature_table_filter_samples_to_skin(use)
filter_to_subject1_gut¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1" AND [body-site]="gut"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND [body-site]="gut"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /3 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /3 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1" AND [body-site]="gut"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND [body-site]="gut"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1_gut
feature_table_filter_samples_to_subject1_gut(use)
filter_to_gut_or_abx¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[body-site]="gut" OR [reported-antibiotic-usage]="Yes"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site]="gut" OR [reported-antibiotic-usage]="Yes"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /4 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /4 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[body-site]="gut" OR [reported-antibiotic-usage]="Yes"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site]="gut" OR [reported-antibiotic-usage]="Yes"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_gut_or_abx
feature_table_filter_samples_to_gut_or_abx(use)
filter_to_subject1_not_gut¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1" AND NOT [body-site]="gut"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND NOT [body-site]="gut"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /5 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /5 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1" AND NOT [body-site]="gut"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND NOT [body-site]="gut"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1_not_gut
feature_table_filter_samples_to_subject1_not_gut(use)
filter_min_features¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--p-min-features 10 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
min_features=10,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /6 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_features" to
10
- Set "min_features" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
min_features=10L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_min_features
feature_table_filter_samples_min_features(use)
filter_min_frequency¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--p-min-frequency 1500 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
min_frequency=1500,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /7 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_frequency" to
1500
- Set "min_frequency" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
min_frequency=1500L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_min_frequency
feature_table_filter_samples_min_frequency(use)
feature-table filter-features-conditionally¶
Filter features based on the relative abundance in a certain portion of samples (i.e., features must have a relative abundance of at least abundance
in at least prevalence
number of samples). Any samples with a frequency of zero after feature filtering will also be removed.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table from which features should be filtered.[required]
Parameters¶
- abundance:
Float
%
Range
(0, 1)
The minimum relative abundance for a feature to be retained.[required]
- prevalence:
Float
%
Range
(0, 1)
The minimum portion of samples that a feature must have a relative abundance of at least
abundance
to be retained.[required]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting feature table filtered by feature.[required]
Examples¶
feature_table_filter_features_conditionally¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
# Retain only features with at least 1%% abundance in at least 34%% of
# samples.
qiime feature-table filter-features-conditionally \
--i-table feature-table.qza \
--p-abundance 0.01 \
--p-prevalence 0.34 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# Retain only features with at least 1%% abundance in at least 34%% of samples.
filtered_table, = feature_table_actions.filter_features_conditionally(
table=feature_table,
abundance=0.01,
prevalence=0.34,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -features -conditionally /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
Retain only features with at least 1%% abundance in at least 34%% of samples.
- Using the
qiime2 feature-table filter-features-conditionally
tool: - Set "table" to
#: feature-table.qza
- Set "abundance" to
0.01
- Set "prevalence" to
0.34
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# Retain only features with at least 1%% abundance in at least 34%% of samples.
action_results <- feature_table_actions$filter_features_conditionally(
table=feature_table,
abundance=0.01,
prevalence=0.34,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_features_conditionally
feature_table_filter_features_conditionally(use)
feature-table filter-features¶
Filter features from table based on frequency and/or metadata. Any samples with a frequency of zero after feature filtering will also be removed. See the filtering tutorial on https://
Inputs¶
- table:
FeatureTable[Frequency]
The feature table from which features should be filtered.[required]
Parameters¶
- min_frequency:
Int
The minimum total frequency that a feature must have to be retained.[default:
0
]- max_frequency:
Int
The maximum total frequency that a feature can have to be retained. If no value is provided this will default to infinity (i.e., no maximum frequency filter will be applied).[optional]
- min_samples:
Int
The minimum number of samples that a feature must be observed in to be retained.[default:
0
]- max_samples:
Int
The maximum number of samples that a feature can be observed in to be retained. If no value is provided this will default to infinity (i.e., no maximum sample filter will be applied).[optional]
- metadata:
Metadata
Feature metadata used with
where
parameter when selecting features to retain, or withexclude_ids
when selecting features to discard.[optional]- where:
Str
SQLite WHERE clause specifying feature metadata criteria that must be met to be included in the filtered feature table. If not provided, all features in
metadata
that are also in the feature table will be retained.[optional]- exclude_ids:
Bool
If true, the features selected by
metadata
orwhere
parameters will be excluded from the filtered table instead of being retained.[default:False
]- filter_empty_samples:
Bool
If true, drop any samples where none of the retained features are present.[default:
True
]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency]
The resulting feature table filtered by feature.[required]
Examples¶
filter_features_min_samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
qiime feature-table filter-features \
--i-table feature-table.qza \
--p-min-samples 2 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_features(
table=feature_table,
min_samples=2,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -features /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-features
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_samples" to
2
- Set "min_samples" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_features(
table=feature_table,
min_samples=2L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_features_min_samples
feature_table_filter_features_min_samples(use)
feature-table filter-seqs¶
Filter features from sequences based on a feature table or metadata. See the filtering tutorial on https://
Inputs¶
- data:
FeatureData[Sequence¹ | AlignedSequence²]
The sequences from which features should be filtered.[required]
- table:
FeatureTable[Frequency]
Table containing feature ids used for id-based filtering.[optional]
Parameters¶
- metadata:
Metadata
Feature metadata used for id-based filtering, with
where
parameter when selecting features to retain, or withexclude_ids
when selecting features to discard.[optional]- where:
Str
SQLite WHERE clause specifying feature metadata criteria that must be met to be included in the filtered feature table. If not provided, all features in
metadata
that are also in the sequences will be retained.[optional]- exclude_ids:
Bool
If true, the features selected by the
metadata
(with or without thewhere
parameter) ortable
parameter will be excluded from the filtered sequences instead of being retained.[default:False
]
Outputs¶
- filtered_data:
FeatureData[Sequence¹ | AlignedSequence²]
The resulting filtered sequences.[required]
feature-table split¶
Splits one feature table into many feature tables, where splits are defined by values in metadata column.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The table to split.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
A column defining the groups. Each unique value will define a split feature table.[required]
- filter_empty_features:
Bool
If true, features which are not present in a split feature table are dropped.[default:
True
]
Outputs¶
- tables:
Collection
[
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
]
Directory where feature tables split based on metadata values should be written.[required]
feature-table tabulate-feature-frequencies¶
Tabulate sample count and total frequency per feature.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence | RelativeFrequency]
The input feature table.[required]
Outputs¶
- feature_frequencies:
ImmutableMetadata
Per-sample and total frequencies per feature.[required]
Examples¶
feature_table_tabulate_feature_frequencies¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
qiime feature-table tabulate-feature-frequencies \
--i-table feature-table.qza \
--o-feature-frequencies feature-frequencies.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
feature_frequencies, = feature_table_actions.tabulate_feature_frequencies(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -feature -frequencies /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-feature-frequencies
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_feature_frequencies(
table=feature_table,
)
feature_frequencies <- action_results$feature_frequencies
from q2_feature_table._examples import feature_table_tabulate_feature_freqs
feature_table_tabulate_feature_freqs(use)
feature-table tabulate-sample-frequencies¶
Tabulate feature count and total frequency per sample.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence | RelativeFrequency]
The input feature table.[required]
Outputs¶
- sample_frequencies:
ImmutableMetadata
Observed feature count and total frequencies per sample.[required]
Examples¶
feature_table_tabulate_sample_frequencies¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
qiime feature-table tabulate-sample-frequencies \
--i-table feature-table.qza \
--o-sample-frequencies sample-frequencies.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
sample_frequencies, = feature_table_actions.tabulate_sample_frequencies(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -sample -frequencies /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-sample-frequencies
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_sample_frequencies(
table=feature_table,
)
sample_frequencies <- action_results$sample_frequencies
from q2_feature_table._examples import feature_table_tabulate_sample_freqs
feature_table_tabulate_sample_freqs(use)
feature-table summarize¶
Generate visual and tabular summaries of a feature table.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence]
The feature table to be summarized.[required]
Parameters¶
- sample_metadata:
Metadata
The sample metadata.[optional]
Outputs¶
- visualization:
Visualization
<no description>[required]
Examples¶
feature_table_summarize¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
qiime feature-table summarize \
--i-table feature-table.qza \
--o-visualization table.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
table_viz, = feature_table_actions.summarize(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /summarize /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table summarize
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table summarize [...] : visualization.qzv
table.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$summarize(
table=feature_table,
)
table_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_summarize
feature_table_summarize(use)
feature-table tabulate-seqs¶
Generate tabular view of feature identifier to sequence mapping, including links to BLAST each sequence against the NCBI nt database.
Citations¶
Coordinators, 2017; Johnson et al., 2008
Inputs¶
- data:
FeatureData[Sequence | AlignedSequence]
The feature sequences to be tabulated.[required]
- taxonomy:
Collection
[
FeatureData[Taxonomy]
]
The taxonomic classifications of the tabulated features.[optional]
Parameters¶
- metadata:
Metadata
Any additional metadata for the tabulated features.[optional]
- merge_method:
Str
%
Choices
('strict', 'union', 'intersect')
Method that joins data sets[default:
'strict'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
Examples¶
feature_table_tabulate_seqs¶
wget -O 'rep-seqs.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs.qza \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
fn = 'rep-seqs.qza'
request.urlretrieve(url, fn)
rep_seqs = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /1 /rep -seqs .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs.qza
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
fn <- 'rep-seqs.qza'
request$urlretrieve(url, fn)
rep_seqs <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs,
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs
feature_table_tabulate_seqs(use)
feature_table_tabulate_seqs_single_taxon¶
wget -O 'rep-seqs-single-taxon.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
wget -O 'single-taxonomy.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs-single-taxon.qza \
--i-taxonomy single-taxonomy.qza \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
fn = 'rep-seqs-single-taxon.qza'
request.urlretrieve(url, fn)
rep_seqs_single_taxon = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
fn = 'single-taxonomy.qza'
request.urlretrieve(url, fn)
single_taxonomy = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs_single_taxon,
taxonomy=[single_taxonomy],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs-single-taxon.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /2 /rep -seqs -single -taxon .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
single-taxonomy.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /2 /single -taxonomy .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs-single-taxon.qza
- Expand the
additional options
section- Set "taxonomy" to
#: ['single-taxonomy.qza']
- Set "taxonomy" to
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
fn <- 'rep-seqs-single-taxon.qza'
request$urlretrieve(url, fn)
rep_seqs_single_taxon <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
fn <- 'single-taxonomy.qza'
request$urlretrieve(url, fn)
single_taxonomy <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs_single_taxon,
taxonomy=list(single_taxonomy),
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs_single_taxon
feature_table_tabulate_seqs_single_taxon(use)
feature_table_tabulate_seqs_multi_taxon¶
wget -O 'rep-seqs-multi-taxon.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs-multi-taxon.qza \
--i-taxonomy multi-taxonomy/ \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
fn = 'rep-seqs-multi-taxon.qza'
request.urlretrieve(url, fn)
rep_seqs_multi_taxon = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs_multi_taxon,
taxonomy=multi_taxonomy_artifact_collection,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs-multi-taxon.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /3 /rep -seqs -multi -taxon .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs-multi-taxon.qza
- Expand the
additional options
section- Set "taxonomy" to
#: multi-taxonomy/
- Set "taxonomy" to
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
fn <- 'rep-seqs-multi-taxon.qza'
request$urlretrieve(url, fn)
rep_seqs_multi_taxon <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs_multi_taxon,
taxonomy=multi_taxonomy_artifact_collection,
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs_multi_taxon
feature_table_tabulate_seqs_multi_taxon(use)
feature-table core-features¶
Identify "core" features, which are features observed in a user-defined fraction of the samples. Since the core features are a function of the fraction of samples that the feature must be observed in to be considered core, this is computed over a range of fractions defined by the min_fraction
, max_fraction
, and steps
parameters.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to use in core features calculations.[required]
Parameters¶
- min_fraction:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
The minimum fraction of samples that a feature must be observed in for that feature to be considered a core feature.[default:
0.5
]- max_fraction:
Float
%
Range
(0.0, 1.0, inclusive_end=True)
The maximum fraction of samples that a feature must be observed in for that feature to be considered a core feature.[default:
1.0
]- steps:
Int
%
Range
(2, None)
The number of steps to take between
min_fraction
andmax_fraction
for core features calculations. This parameter has no effect ifmin_fraction
andmax_fraction
are the same value.[default:11
]
Outputs¶
- visualization:
Visualization
<no description>[required]
feature-table heatmap¶
Generate a heatmap representation of a feature table with optional clustering on both the sample and feature axes.
Tip: To generate a heatmap containing taxonomic annotations, use qiime taxa collapse
to collapse the feature table at the desired taxonomic level.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to visualize.[required]
Parameters¶
- sample_metadata:
MetadataColumn
[
Categorical
]
Annotate the sample IDs with these sample metadata values. When metadata is present and
cluster
='feature', samples will be sorted by the metadata values.[optional]- feature_metadata:
MetadataColumn
[
Categorical
]
Annotate the feature IDs with these feature metadata values. When metadata is present and
cluster
='sample', features will be sorted by the metadata values.[optional]- normalize:
Bool
Normalize the feature table by adding a psuedocount of 1 and then taking the log10 of the table.[default:
True
]- title:
Str
Optional custom plot title.[optional]
- metric:
Str
%
Choices
('braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule')
Metrics exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'euclidean'
]- method:
Str
%
Choices
('average', 'centroid', 'complete', 'median', 'single', 'ward', 'weighted')
Clustering methods exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'average'
]- cluster:
Str
%
Choices
('both', 'features', 'none', 'samples')
Specify which axes to cluster.[default:
'both'
]- color_scheme:
Str
%
Choices
('Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Vega10', 'Vega10_r', 'Vega20', 'Vega20_r', 'Vega20b', 'Vega20b_r', 'Vega20c', 'Vega20c_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'mako', 'mako_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'rocket', 'rocket_r', 'seismic', 'seismic_r', 'spectral', 'spectral_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'viridis', 'viridis_r', 'vlag', 'vlag_r', 'winter', 'winter_r')
The matplotlib colorscheme to generate the heatmap with.[default:
'rocket'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
feature-table summarize-plus¶
Generate visual and tabular summaries of a feature table. Tabulate sample and feature frequencies.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence]
The feature table to be summarized.[required]
Parameters¶
- metadata:
Metadata
The sample metadata.[optional]
Outputs¶
- feature_frequencies:
ImmutableMetadata
Per-sample and total frequencies per feature.[required]
- sample_frequencies:
ImmutableMetadata
Observed feature count and total frequencies per sample.[required]
- summary:
Visualization
Visual summary of feature table[required]
Examples¶
feature_table_summarize_plus¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
qiime feature-table summarize-plus \
--i-table feature-table.qza \
--o-feature-frequencies feature-frequencies.qza \
--o-sample-frequencies sample-frequencies.qza \
--o-summary visual summary.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
feature_frequencies, sample_frequencies, visual_summary_viz = feature_table_actions.summarize_plus(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /summarize -plus /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table summarize-plus
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
- Once completed, for each new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table summarize-plus [...] : feature_frequencies.qza
feature-frequencies.qza
#: qiime2 feature-table summarize-plus [...] : sample_frequencies.qza
sample-frequencies.qza
#: qiime2 feature-table summarize-plus [...] : summary.qzv
visual summary.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$summarize_plus(
table=feature_table,
)
feature_frequencies <- action_results$feature_frequencies
sample_frequencies <- action_results$sample_frequencies
visual_summary_viz <- action_results$summary
from q2_feature_table._examples import feature_table_summarize_plus
feature_table_summarize_plus(use)
This is a QIIME 2 plugin supporting operations on sample by feature tables, such as filtering, merging, and transforming tables.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -feature -table - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
Name | Type | Short Description |
---|---|---|
rarefy | method | Rarefy table |
subsample-ids | method | Subsample table |
presence-absence | method | Convert to presence/absence |
relative-frequency | method | Convert to relative frequencies |
transpose | method | Transpose a feature table. |
group | method | Group samples or features by a metadata column |
merge | method | Combine multiple tables |
merge-seqs | method | Combine collections of feature sequences |
merge-taxa | method | Combine collections of feature taxonomies |
rename-ids | method | Renames sample or feature ids in a table |
filter-samples | method | Filter samples from table |
filter-features-conditionally | method | Filter features from a table based on abundance and prevalence |
filter-features | method | Filter features from table |
filter-seqs | method | Filter features from sequences |
split | method | Split one feature table into many |
tabulate-feature-frequencies | method | Tabulate feature frequencies |
tabulate-sample-frequencies | method | Tabulate sample frequencies |
summarize | visualizer | Summarize table |
tabulate-seqs | visualizer | View sequence associated with each feature |
core-features | visualizer | Identify core features in table |
heatmap | visualizer | Generate a heatmap representation of a feature table |
summarize-plus | pipeline | Summarize table plus |
feature-table rarefy¶
Subsample frequencies from all samples so that the sum of frequencies in each sample is equal to sampling-depth.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be rarefied.[required]
Parameters¶
- sampling_depth:
Int
%
Range
(1, None)
The total frequency that each sample should be rarefied to. Samples where the sum of frequencies is less than the sampling depth will be not be included in the resulting table.[required]
- with_replacement:
Bool
Rarefy with replacement by sampling from the multinomial distribution instead of rarefying without replacement.[default:
False
]
Outputs¶
- rarefied_table:
FeatureTable[Frequency]
The resulting rarefied feature table.[required]
feature-table subsample-ids¶
Randomly pick samples or features, without replacement, from the table.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be sampled.[required]
Parameters¶
- subsampling_depth:
Int
%
Range
(1, None)
The total number of samples or features to be randomly sampled. Samples or features that are reduced to a zero sum will not be included in the resulting table.[required]
- axis:
Str
%
Choices
('sample', 'feature')
The axis to sample over. If "sample" then samples will be randomly selected to be retained. If "feature" then a random set of features will be selected to be retained.[required]
Outputs¶
- sampled_table:
FeatureTable[Frequency]
The resulting subsampled feature table.[required]
feature-table presence-absence¶
Convert frequencies to binary values indicating presence or absence of a feature in a sample.
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency]
The feature table to be converted into presence/absence abundances.[required]
Outputs¶
- presence_absence_table:
FeatureTable[PresenceAbsence]
The resulting presence/absence feature table.[required]
feature-table relative-frequency¶
Convert frequencies to relative frequencies by dividing each frequency in a sample by the sum of frequencies in that sample.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be converted into relative frequencies.[required]
Outputs¶
- relative_frequency_table:
FeatureTable[RelativeFrequency]
The resulting relative frequency feature table.[required]
feature-table transpose¶
Transpose the rows and columns (typically samples and features) of a feature table.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table to be transposed.[required]
Outputs¶
- transposed_feature_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting transposed feature table.[required]
feature-table group¶
Group samples or features in a feature table using metadata to define the mapping of IDs to a group.
Inputs¶
- table:
FeatureTable[Frequency]
The table to group samples or features on.[required]
Parameters¶
- axis:
Str
%
Choices
('feature', 'sample')
Along which axis to group. Each ID in the given axis must exist in
metadata
.[required]- metadata:
MetadataColumn
[
Categorical
]
A column defining the groups. Each unique value will become a new ID for the table on the given
axis
.[required]- mode:
Str
%
Choices
('mean-ceiling', 'median-ceiling', 'sum')
How to combine samples or features within a group.
sum
will sum the frequencies across all samples or features within a group;mean-ceiling
will take the ceiling of the mean of these frequencies;median-ceiling
will take the ceiling of the median of these frequencies.[required]
Outputs¶
- grouped_table:
FeatureTable[Frequency]
A table that has been grouped along the given
axis
. IDs on that axis are replaced by values in themetadata
column.[required]
Examples¶
group_samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
# Combine samples from the same body-site into single sample. Feature
# frequencies will be the median across the samples being combined, rounded
# up to the nearest whole number.
qiime feature-table group \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--m-metadata-column body-site \
--p-mode median-ceiling \
--p-axis sample \
--o-grouped-table body-site-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
body_site_mdc = sample_metadata_md.get_column('body-site')
# Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
body_site_table, = feature_table_actions.group(
table=feature_table,
metadata=body_site_mdc,
mode='median-ceiling',
axis='sample',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /group /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /group /1 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
- Using the
qiime2 feature-table group
tool: - Set "table" to
#: feature-table.qza
- Set "axis" to
sample
- For "metadata":
- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Set "Column Name" to
body-site
- Leave as
- Set "mode" to
median-ceiling
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table group [...] : grouped_table.qza
body-site-table.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
body_site_mdc <- sample_metadata_md$get_column('body-site')
# Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
action_results <- feature_table_actions$group(
table=feature_table,
metadata=body_site_mdc,
mode='median-ceiling',
axis='sample',
)
body_site_table <- action_results$grouped_table
from q2_feature_table._examples import feature_table_group_samples
feature_table_group_samples(use)
feature-table merge¶
Combines feature tables using the overlap_method
provided.
Inputs¶
- tables:
List
[
FeatureTable[Frequency]
|
FeatureTable[RelativeFrequency]
|
FeatureTable[PresenceAbsence]
]
The collection of feature tables to be merged.[required]
Parameters¶
- overlap_method:
Str
%
Choices
('average', 'error_on_overlapping_feature', 'error_on_overlapping_sample', 'sum')
|
Str
%
Choices
('average', 'error_on_overlapping_feature', 'error_on_overlapping_sample')
|
Str
%
Choices
('error_on_overlapping_feature', 'error_on_overlapping_sample', 'union')
Method for handling overlapping ids.[default:
'error_on_overlapping_sample'
]
Outputs¶
- merged_table:
FeatureTable[Frequency]
|
FeatureTable[RelativeFrequency]
|
FeatureTable[PresenceAbsence]
The resulting merged feature table.[required]
Examples¶
feature_table_merge_two_tables¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
qiime feature-table merge \
--i-tables feature-table1.qza feature-table2.qza \
--o-merged-table merged-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
merged_table, = feature_table_actions.merge(
tables=[feature_table1, feature_table2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /1 /feature -table1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /1 /feature -table2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge
tool: - For "tables", use ctrl-(or command)-click to select the following inputs:
#: feature-table1.qza
#: feature-table2.qza
- Press the
Execute
button.
- For "tables", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge(
tables=list(feature_table1, feature_table2),
)
merged_table <- action_results$merged_table
from q2_feature_table._examples import feature_table_merge_two_tables
feature_table_merge_two_tables(use)
feature_table_merge_three_tables¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
wget -O 'feature-table3.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
qiime feature-table merge \
--i-tables feature-table1.qza feature-table2.qza feature-table3.qza \
--p-overlap-method sum \
--o-merged-table merged-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
fn = 'feature-table3.qza'
request.urlretrieve(url, fn)
feature_table3 = Artifact.load(fn)
merged_table, = feature_table_actions.merge(
tables=[feature_table1, feature_table2, feature_table3],
overlap_method='sum',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table3.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table3 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge
tool: - For "tables", use ctrl-(or command)-click to select the following inputs:
#: feature-table1.qza
#: feature-table2.qza
#: feature-table3.qza
- Expand the
additional options
section- Set "overlap_method" to
sum
- Set "overlap_method" to
- Press the
Execute
button.
- For "tables", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
fn <- 'feature-table3.qza'
request$urlretrieve(url, fn)
feature_table3 <- Artifact$load(fn)
action_results <- feature_table_actions$merge(
tables=list(feature_table1, feature_table2, feature_table3),
overlap_method='sum',
)
merged_table <- action_results$merged_table
from q2_feature_table._examples import feature_table_merge_three_tables
feature_table_merge_three_tables(use)
feature-table merge-seqs¶
Combines feature data objects which may or may not contain data for the same features. If different feature data is present for the same feature id in the inputs, the data from the first will be propagated to the result.
Inputs¶
- data:
List
[
FeatureData[Sequence]
]
The collection of feature sequences to be merged.[required]
Outputs¶
- merged_data:
FeatureData[Sequence]
The resulting collection of feature sequences containing all feature sequences provided.[required]
Examples¶
feature_table_merge_seqs¶
wget -O 'seqs1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
wget -O 'seqs2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
qiime feature-table merge-seqs \
--i-data seqs1.qza seqs2.qza \
--o-merged-data merged-data.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
fn = 'seqs1.qza'
request.urlretrieve(url, fn)
seqs1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
fn = 'seqs2.qza'
request.urlretrieve(url, fn)
seqs2 = Artifact.load(fn)
merged_data, = feature_table_actions.merge_seqs(
data=[seqs1, seqs2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
seqs1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -seqs /1 /seqs1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
seqs2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -seqs /1 /seqs2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge-seqs
tool: - For "data", use ctrl-(or command)-click to select the following inputs:
#: seqs1.qza
#: seqs2.qza
- Press the
Execute
button.
- For "data", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
fn <- 'seqs1.qza'
request$urlretrieve(url, fn)
seqs1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
fn <- 'seqs2.qza'
request$urlretrieve(url, fn)
seqs2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge_seqs(
data=list(seqs1, seqs2),
)
merged_data <- action_results$merged_data
from q2_feature_table._examples import feature_table_merge_seqs
feature_table_merge_seqs(use)
feature-table merge-taxa¶
Combines a pair of feature data objects which may or may not contain data for the same features. If different feature data is present for the same feature id in the inputs, the data from the first will be propagated to the result.
Inputs¶
- data:
List
[
FeatureData[Taxonomy]
]
The collection of feature taxonomies to be merged.[required]
Outputs¶
- merged_data:
FeatureData[Taxonomy]
The resulting collection of feature taxonomies containing all feature taxonomies provided.[required]
Examples¶
feature_table_merge_taxa¶
wget -O 'tax1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
wget -O 'tax2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
qiime feature-table merge-taxa \
--i-data tax1.qza tax2.qza \
--o-merged-data merged-data.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
fn = 'tax1.qza'
request.urlretrieve(url, fn)
tax1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
fn = 'tax2.qza'
request.urlretrieve(url, fn)
tax2 = Artifact.load(fn)
merged_data, = feature_table_actions.merge_taxa(
data=[tax1, tax2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
tax1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -taxa /1 /tax1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
tax2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -taxa /1 /tax2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge-taxa
tool: - For "data", use ctrl-(or command)-click to select the following inputs:
#: tax1.qza
#: tax2.qza
- Press the
Execute
button.
- For "data", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
fn <- 'tax1.qza'
request$urlretrieve(url, fn)
tax1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
fn <- 'tax2.qza'
request$urlretrieve(url, fn)
tax2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge_taxa(
data=list(tax1, tax2),
)
merged_data <- action_results$merged_data
from q2_feature_table._examples import feature_table_merge_taxa
feature_table_merge_taxa(use)
feature-table rename-ids¶
Renames the sample or feature ids in a feature table using metadata to define the new ids.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The table to be renamed[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
A metadata column defining the new ids. Each original id must map to a new unique id. If strict mode is used, then every id in the original table must have a new id.[required]
- axis:
Str
%
Choices
('feature', 'sample')
Along which axis to rename the ids.[default:
'sample'
]- strict:
Bool
Whether the naming needs to be strict (each id in the table must have a new id). Otherwise, only the ids described in
metadata
will be renamed and the others will keep their original id names.[default:False
]
Outputs¶
- renamed_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
A table which has new ids, where the ids are replaced by values in the
metadata
column.[required]
feature-table filter-samples¶
Filter samples from table based on frequency and/or metadata. Any features with a frequency of zero after sample filtering will also be removed. See the filtering tutorial on https://
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table from which samples should be filtered.[required]
Parameters¶
- min_frequency:
Int
The minimum total frequency that a sample must have to be retained.[default:
0
]- max_frequency:
Int
The maximum total frequency that a sample can have to be retained. If no value is provided this will default to infinity (i.e., no maximum frequency filter will be applied).[optional]
- min_features:
Int
The minimum number of features that a sample must have to be retained.[default:
0
]- max_features:
Int
The maximum number of features that a sample can have to be retained. If no value is provided this will default to infinity (i.e., no maximum feature filter will be applied).[optional]
- metadata:
Metadata
Sample metadata used with
where
parameter when selecting samples to retain, or withexclude_ids
when selecting samples to discard.[optional]- where:
Str
SQLite WHERE clause specifying sample metadata criteria that must be met to be included in the filtered feature table. If not provided, all samples in
metadata
that are also in the feature table will be retained.[optional]- exclude_ids:
Bool
If true, the samples selected by
metadata
orwhere
parameters will be excluded from the filtered table instead of being retained.[default:False
]- filter_empty_features:
Bool
If true, features which are not present in any retained samples are dropped.[default:
True
]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting feature table filtered by sample.[required]
Examples¶
filter_to_subject1¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /1 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1
feature_table_filter_samples_to_subject1(use)
filter_to_skin¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[body-site] IN ("left palm", "right palm")' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site] IN ("left palm", "right palm")',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /2 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /2 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[body-site] IN ("left palm", "right palm")
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site] IN ("left palm", "right palm")',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_skin
feature_table_filter_samples_to_skin(use)
filter_to_subject1_gut¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1" AND [body-site]="gut"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND [body-site]="gut"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /3 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /3 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1" AND [body-site]="gut"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND [body-site]="gut"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1_gut
feature_table_filter_samples_to_subject1_gut(use)
filter_to_gut_or_abx¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[body-site]="gut" OR [reported-antibiotic-usage]="Yes"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site]="gut" OR [reported-antibiotic-usage]="Yes"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /4 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /4 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[body-site]="gut" OR [reported-antibiotic-usage]="Yes"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site]="gut" OR [reported-antibiotic-usage]="Yes"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_gut_or_abx
feature_table_filter_samples_to_gut_or_abx(use)
filter_to_subject1_not_gut¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1" AND NOT [body-site]="gut"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND NOT [body-site]="gut"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /5 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /5 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1" AND NOT [body-site]="gut"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND NOT [body-site]="gut"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1_not_gut
feature_table_filter_samples_to_subject1_not_gut(use)
filter_min_features¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--p-min-features 10 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
min_features=10,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /6 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_features" to
10
- Set "min_features" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
min_features=10L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_min_features
feature_table_filter_samples_min_features(use)
filter_min_frequency¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--p-min-frequency 1500 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
min_frequency=1500,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /7 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_frequency" to
1500
- Set "min_frequency" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
min_frequency=1500L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_min_frequency
feature_table_filter_samples_min_frequency(use)
feature-table filter-features-conditionally¶
Filter features based on the relative abundance in a certain portion of samples (i.e., features must have a relative abundance of at least abundance
in at least prevalence
number of samples). Any samples with a frequency of zero after feature filtering will also be removed.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table from which features should be filtered.[required]
Parameters¶
- abundance:
Float
%
Range
(0, 1)
The minimum relative abundance for a feature to be retained.[required]
- prevalence:
Float
%
Range
(0, 1)
The minimum portion of samples that a feature must have a relative abundance of at least
abundance
to be retained.[required]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting feature table filtered by feature.[required]
Examples¶
feature_table_filter_features_conditionally¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
# Retain only features with at least 1%% abundance in at least 34%% of
# samples.
qiime feature-table filter-features-conditionally \
--i-table feature-table.qza \
--p-abundance 0.01 \
--p-prevalence 0.34 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# Retain only features with at least 1%% abundance in at least 34%% of samples.
filtered_table, = feature_table_actions.filter_features_conditionally(
table=feature_table,
abundance=0.01,
prevalence=0.34,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -features -conditionally /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
Retain only features with at least 1%% abundance in at least 34%% of samples.
- Using the
qiime2 feature-table filter-features-conditionally
tool: - Set "table" to
#: feature-table.qza
- Set "abundance" to
0.01
- Set "prevalence" to
0.34
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# Retain only features with at least 1%% abundance in at least 34%% of samples.
action_results <- feature_table_actions$filter_features_conditionally(
table=feature_table,
abundance=0.01,
prevalence=0.34,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_features_conditionally
feature_table_filter_features_conditionally(use)
feature-table filter-features¶
Filter features from table based on frequency and/or metadata. Any samples with a frequency of zero after feature filtering will also be removed. See the filtering tutorial on https://
Inputs¶
- table:
FeatureTable[Frequency]
The feature table from which features should be filtered.[required]
Parameters¶
- min_frequency:
Int
The minimum total frequency that a feature must have to be retained.[default:
0
]- max_frequency:
Int
The maximum total frequency that a feature can have to be retained. If no value is provided this will default to infinity (i.e., no maximum frequency filter will be applied).[optional]
- min_samples:
Int
The minimum number of samples that a feature must be observed in to be retained.[default:
0
]- max_samples:
Int
The maximum number of samples that a feature can be observed in to be retained. If no value is provided this will default to infinity (i.e., no maximum sample filter will be applied).[optional]
- metadata:
Metadata
Feature metadata used with
where
parameter when selecting features to retain, or withexclude_ids
when selecting features to discard.[optional]- where:
Str
SQLite WHERE clause specifying feature metadata criteria that must be met to be included in the filtered feature table. If not provided, all features in
metadata
that are also in the feature table will be retained.[optional]- exclude_ids:
Bool
If true, the features selected by
metadata
orwhere
parameters will be excluded from the filtered table instead of being retained.[default:False
]- filter_empty_samples:
Bool
If true, drop any samples where none of the retained features are present.[default:
True
]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency]
The resulting feature table filtered by feature.[required]
Examples¶
filter_features_min_samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
qiime feature-table filter-features \
--i-table feature-table.qza \
--p-min-samples 2 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_features(
table=feature_table,
min_samples=2,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -features /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-features
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_samples" to
2
- Set "min_samples" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_features(
table=feature_table,
min_samples=2L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_features_min_samples
feature_table_filter_features_min_samples(use)
feature-table filter-seqs¶
Filter features from sequences based on a feature table or metadata. See the filtering tutorial on https://
Inputs¶
- data:
FeatureData[Sequence¹ | AlignedSequence²]
The sequences from which features should be filtered.[required]
- table:
FeatureTable[Frequency]
Table containing feature ids used for id-based filtering.[optional]
Parameters¶
- metadata:
Metadata
Feature metadata used for id-based filtering, with
where
parameter when selecting features to retain, or withexclude_ids
when selecting features to discard.[optional]- where:
Str
SQLite WHERE clause specifying feature metadata criteria that must be met to be included in the filtered feature table. If not provided, all features in
metadata
that are also in the sequences will be retained.[optional]- exclude_ids:
Bool
If true, the features selected by the
metadata
(with or without thewhere
parameter) ortable
parameter will be excluded from the filtered sequences instead of being retained.[default:False
]
Outputs¶
- filtered_data:
FeatureData[Sequence¹ | AlignedSequence²]
The resulting filtered sequences.[required]
feature-table split¶
Splits one feature table into many feature tables, where splits are defined by values in metadata column.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The table to split.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
A column defining the groups. Each unique value will define a split feature table.[required]
- filter_empty_features:
Bool
If true, features which are not present in a split feature table are dropped.[default:
True
]
Outputs¶
- tables:
Collection
[
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
]
Directory where feature tables split based on metadata values should be written.[required]
feature-table tabulate-feature-frequencies¶
Tabulate sample count and total frequency per feature.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence | RelativeFrequency]
The input feature table.[required]
Outputs¶
- feature_frequencies:
ImmutableMetadata
Per-sample and total frequencies per feature.[required]
Examples¶
feature_table_tabulate_feature_frequencies¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
qiime feature-table tabulate-feature-frequencies \
--i-table feature-table.qza \
--o-feature-frequencies feature-frequencies.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
feature_frequencies, = feature_table_actions.tabulate_feature_frequencies(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -feature -frequencies /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-feature-frequencies
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_feature_frequencies(
table=feature_table,
)
feature_frequencies <- action_results$feature_frequencies
from q2_feature_table._examples import feature_table_tabulate_feature_freqs
feature_table_tabulate_feature_freqs(use)
feature-table tabulate-sample-frequencies¶
Tabulate feature count and total frequency per sample.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence | RelativeFrequency]
The input feature table.[required]
Outputs¶
- sample_frequencies:
ImmutableMetadata
Observed feature count and total frequencies per sample.[required]
Examples¶
feature_table_tabulate_sample_frequencies¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
qiime feature-table tabulate-sample-frequencies \
--i-table feature-table.qza \
--o-sample-frequencies sample-frequencies.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
sample_frequencies, = feature_table_actions.tabulate_sample_frequencies(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -sample -frequencies /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-sample-frequencies
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_sample_frequencies(
table=feature_table,
)
sample_frequencies <- action_results$sample_frequencies
from q2_feature_table._examples import feature_table_tabulate_sample_freqs
feature_table_tabulate_sample_freqs(use)
feature-table summarize¶
Generate visual and tabular summaries of a feature table.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence]
The feature table to be summarized.[required]
Parameters¶
- sample_metadata:
Metadata
The sample metadata.[optional]
Outputs¶
- visualization:
Visualization
<no description>[required]
Examples¶
feature_table_summarize¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
qiime feature-table summarize \
--i-table feature-table.qza \
--o-visualization table.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
table_viz, = feature_table_actions.summarize(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /summarize /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table summarize
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table summarize [...] : visualization.qzv
table.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$summarize(
table=feature_table,
)
table_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_summarize
feature_table_summarize(use)
feature-table tabulate-seqs¶
Generate tabular view of feature identifier to sequence mapping, including links to BLAST each sequence against the NCBI nt database.
Citations¶
Coordinators, 2017; Johnson et al., 2008
Inputs¶
- data:
FeatureData[Sequence | AlignedSequence]
The feature sequences to be tabulated.[required]
- taxonomy:
Collection
[
FeatureData[Taxonomy]
]
The taxonomic classifications of the tabulated features.[optional]
Parameters¶
- metadata:
Metadata
Any additional metadata for the tabulated features.[optional]
- merge_method:
Str
%
Choices
('strict', 'union', 'intersect')
Method that joins data sets[default:
'strict'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
Examples¶
feature_table_tabulate_seqs¶
wget -O 'rep-seqs.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs.qza \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
fn = 'rep-seqs.qza'
request.urlretrieve(url, fn)
rep_seqs = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /1 /rep -seqs .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs.qza
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
fn <- 'rep-seqs.qza'
request$urlretrieve(url, fn)
rep_seqs <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs,
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs
feature_table_tabulate_seqs(use)
feature_table_tabulate_seqs_single_taxon¶
wget -O 'rep-seqs-single-taxon.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
wget -O 'single-taxonomy.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs-single-taxon.qza \
--i-taxonomy single-taxonomy.qza \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
fn = 'rep-seqs-single-taxon.qza'
request.urlretrieve(url, fn)
rep_seqs_single_taxon = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
fn = 'single-taxonomy.qza'
request.urlretrieve(url, fn)
single_taxonomy = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs_single_taxon,
taxonomy=[single_taxonomy],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs-single-taxon.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /2 /rep -seqs -single -taxon .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
single-taxonomy.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /2 /single -taxonomy .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs-single-taxon.qza
- Expand the
additional options
section- Set "taxonomy" to
#: ['single-taxonomy.qza']
- Set "taxonomy" to
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
fn <- 'rep-seqs-single-taxon.qza'
request$urlretrieve(url, fn)
rep_seqs_single_taxon <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
fn <- 'single-taxonomy.qza'
request$urlretrieve(url, fn)
single_taxonomy <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs_single_taxon,
taxonomy=list(single_taxonomy),
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs_single_taxon
feature_table_tabulate_seqs_single_taxon(use)
feature_table_tabulate_seqs_multi_taxon¶
wget -O 'rep-seqs-multi-taxon.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs-multi-taxon.qza \
--i-taxonomy multi-taxonomy/ \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
fn = 'rep-seqs-multi-taxon.qza'
request.urlretrieve(url, fn)
rep_seqs_multi_taxon = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs_multi_taxon,
taxonomy=multi_taxonomy_artifact_collection,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs-multi-taxon.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /3 /rep -seqs -multi -taxon .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs-multi-taxon.qza
- Expand the
additional options
section- Set "taxonomy" to
#: multi-taxonomy/
- Set "taxonomy" to
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
fn <- 'rep-seqs-multi-taxon.qza'
request$urlretrieve(url, fn)
rep_seqs_multi_taxon <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs_multi_taxon,
taxonomy=multi_taxonomy_artifact_collection,
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs_multi_taxon
feature_table_tabulate_seqs_multi_taxon(use)
feature-table core-features¶
Identify "core" features, which are features observed in a user-defined fraction of the samples. Since the core features are a function of the fraction of samples that the feature must be observed in to be considered core, this is computed over a range of fractions defined by the min_fraction
, max_fraction
, and steps
parameters.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to use in core features calculations.[required]
Parameters¶
- min_fraction:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
The minimum fraction of samples that a feature must be observed in for that feature to be considered a core feature.[default:
0.5
]- max_fraction:
Float
%
Range
(0.0, 1.0, inclusive_end=True)
The maximum fraction of samples that a feature must be observed in for that feature to be considered a core feature.[default:
1.0
]- steps:
Int
%
Range
(2, None)
The number of steps to take between
min_fraction
andmax_fraction
for core features calculations. This parameter has no effect ifmin_fraction
andmax_fraction
are the same value.[default:11
]
Outputs¶
- visualization:
Visualization
<no description>[required]
feature-table heatmap¶
Generate a heatmap representation of a feature table with optional clustering on both the sample and feature axes.
Tip: To generate a heatmap containing taxonomic annotations, use qiime taxa collapse
to collapse the feature table at the desired taxonomic level.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to visualize.[required]
Parameters¶
- sample_metadata:
MetadataColumn
[
Categorical
]
Annotate the sample IDs with these sample metadata values. When metadata is present and
cluster
='feature', samples will be sorted by the metadata values.[optional]- feature_metadata:
MetadataColumn
[
Categorical
]
Annotate the feature IDs with these feature metadata values. When metadata is present and
cluster
='sample', features will be sorted by the metadata values.[optional]- normalize:
Bool
Normalize the feature table by adding a psuedocount of 1 and then taking the log10 of the table.[default:
True
]- title:
Str
Optional custom plot title.[optional]
- metric:
Str
%
Choices
('braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule')
Metrics exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'euclidean'
]- method:
Str
%
Choices
('average', 'centroid', 'complete', 'median', 'single', 'ward', 'weighted')
Clustering methods exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'average'
]- cluster:
Str
%
Choices
('both', 'features', 'none', 'samples')
Specify which axes to cluster.[default:
'both'
]- color_scheme:
Str
%
Choices
('Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Vega10', 'Vega10_r', 'Vega20', 'Vega20_r', 'Vega20b', 'Vega20b_r', 'Vega20c', 'Vega20c_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'mako', 'mako_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'rocket', 'rocket_r', 'seismic', 'seismic_r', 'spectral', 'spectral_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'viridis', 'viridis_r', 'vlag', 'vlag_r', 'winter', 'winter_r')
The matplotlib colorscheme to generate the heatmap with.[default:
'rocket'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
feature-table summarize-plus¶
Generate visual and tabular summaries of a feature table. Tabulate sample and feature frequencies.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence]
The feature table to be summarized.[required]
Parameters¶
- metadata:
Metadata
The sample metadata.[optional]
Outputs¶
- feature_frequencies:
ImmutableMetadata
Per-sample and total frequencies per feature.[required]
- sample_frequencies:
ImmutableMetadata
Observed feature count and total frequencies per sample.[required]
- summary:
Visualization
Visual summary of feature table[required]
Examples¶
feature_table_summarize_plus¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
qiime feature-table summarize-plus \
--i-table feature-table.qza \
--o-feature-frequencies feature-frequencies.qza \
--o-sample-frequencies sample-frequencies.qza \
--o-summary visual summary.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
feature_frequencies, sample_frequencies, visual_summary_viz = feature_table_actions.summarize_plus(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /summarize -plus /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table summarize-plus
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
- Once completed, for each new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table summarize-plus [...] : feature_frequencies.qza
feature-frequencies.qza
#: qiime2 feature-table summarize-plus [...] : sample_frequencies.qza
sample-frequencies.qza
#: qiime2 feature-table summarize-plus [...] : summary.qzv
visual summary.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$summarize_plus(
table=feature_table,
)
feature_frequencies <- action_results$feature_frequencies
sample_frequencies <- action_results$sample_frequencies
visual_summary_viz <- action_results$summary
from q2_feature_table._examples import feature_table_summarize_plus
feature_table_summarize_plus(use)
This is a QIIME 2 plugin supporting operations on sample by feature tables, such as filtering, merging, and transforming tables.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -feature -table - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
Name | Type | Short Description |
---|---|---|
rarefy | method | Rarefy table |
subsample-ids | method | Subsample table |
presence-absence | method | Convert to presence/absence |
relative-frequency | method | Convert to relative frequencies |
transpose | method | Transpose a feature table. |
group | method | Group samples or features by a metadata column |
merge | method | Combine multiple tables |
merge-seqs | method | Combine collections of feature sequences |
merge-taxa | method | Combine collections of feature taxonomies |
rename-ids | method | Renames sample or feature ids in a table |
filter-samples | method | Filter samples from table |
filter-features-conditionally | method | Filter features from a table based on abundance and prevalence |
filter-features | method | Filter features from table |
filter-seqs | method | Filter features from sequences |
split | method | Split one feature table into many |
tabulate-feature-frequencies | method | Tabulate feature frequencies |
tabulate-sample-frequencies | method | Tabulate sample frequencies |
summarize | visualizer | Summarize table |
tabulate-seqs | visualizer | View sequence associated with each feature |
core-features | visualizer | Identify core features in table |
heatmap | visualizer | Generate a heatmap representation of a feature table |
summarize-plus | pipeline | Summarize table plus |
feature-table rarefy¶
Subsample frequencies from all samples so that the sum of frequencies in each sample is equal to sampling-depth.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be rarefied.[required]
Parameters¶
- sampling_depth:
Int
%
Range
(1, None)
The total frequency that each sample should be rarefied to. Samples where the sum of frequencies is less than the sampling depth will be not be included in the resulting table.[required]
- with_replacement:
Bool
Rarefy with replacement by sampling from the multinomial distribution instead of rarefying without replacement.[default:
False
]
Outputs¶
- rarefied_table:
FeatureTable[Frequency]
The resulting rarefied feature table.[required]
feature-table subsample-ids¶
Randomly pick samples or features, without replacement, from the table.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be sampled.[required]
Parameters¶
- subsampling_depth:
Int
%
Range
(1, None)
The total number of samples or features to be randomly sampled. Samples or features that are reduced to a zero sum will not be included in the resulting table.[required]
- axis:
Str
%
Choices
('sample', 'feature')
The axis to sample over. If "sample" then samples will be randomly selected to be retained. If "feature" then a random set of features will be selected to be retained.[required]
Outputs¶
- sampled_table:
FeatureTable[Frequency]
The resulting subsampled feature table.[required]
feature-table presence-absence¶
Convert frequencies to binary values indicating presence or absence of a feature in a sample.
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency]
The feature table to be converted into presence/absence abundances.[required]
Outputs¶
- presence_absence_table:
FeatureTable[PresenceAbsence]
The resulting presence/absence feature table.[required]
feature-table relative-frequency¶
Convert frequencies to relative frequencies by dividing each frequency in a sample by the sum of frequencies in that sample.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be converted into relative frequencies.[required]
Outputs¶
- relative_frequency_table:
FeatureTable[RelativeFrequency]
The resulting relative frequency feature table.[required]
feature-table transpose¶
Transpose the rows and columns (typically samples and features) of a feature table.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table to be transposed.[required]
Outputs¶
- transposed_feature_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting transposed feature table.[required]
feature-table group¶
Group samples or features in a feature table using metadata to define the mapping of IDs to a group.
Inputs¶
- table:
FeatureTable[Frequency]
The table to group samples or features on.[required]
Parameters¶
- axis:
Str
%
Choices
('feature', 'sample')
Along which axis to group. Each ID in the given axis must exist in
metadata
.[required]- metadata:
MetadataColumn
[
Categorical
]
A column defining the groups. Each unique value will become a new ID for the table on the given
axis
.[required]- mode:
Str
%
Choices
('mean-ceiling', 'median-ceiling', 'sum')
How to combine samples or features within a group.
sum
will sum the frequencies across all samples or features within a group;mean-ceiling
will take the ceiling of the mean of these frequencies;median-ceiling
will take the ceiling of the median of these frequencies.[required]
Outputs¶
- grouped_table:
FeatureTable[Frequency]
A table that has been grouped along the given
axis
. IDs on that axis are replaced by values in themetadata
column.[required]
Examples¶
group_samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
# Combine samples from the same body-site into single sample. Feature
# frequencies will be the median across the samples being combined, rounded
# up to the nearest whole number.
qiime feature-table group \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--m-metadata-column body-site \
--p-mode median-ceiling \
--p-axis sample \
--o-grouped-table body-site-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
body_site_mdc = sample_metadata_md.get_column('body-site')
# Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
body_site_table, = feature_table_actions.group(
table=feature_table,
metadata=body_site_mdc,
mode='median-ceiling',
axis='sample',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /group /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /group /1 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
- Using the
qiime2 feature-table group
tool: - Set "table" to
#: feature-table.qza
- Set "axis" to
sample
- For "metadata":
- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Set "Column Name" to
body-site
- Leave as
- Set "mode" to
median-ceiling
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table group [...] : grouped_table.qza
body-site-table.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
body_site_mdc <- sample_metadata_md$get_column('body-site')
# Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
action_results <- feature_table_actions$group(
table=feature_table,
metadata=body_site_mdc,
mode='median-ceiling',
axis='sample',
)
body_site_table <- action_results$grouped_table
from q2_feature_table._examples import feature_table_group_samples
feature_table_group_samples(use)
feature-table merge¶
Combines feature tables using the overlap_method
provided.
Inputs¶
- tables:
List
[
FeatureTable[Frequency]
|
FeatureTable[RelativeFrequency]
|
FeatureTable[PresenceAbsence]
]
The collection of feature tables to be merged.[required]
Parameters¶
- overlap_method:
Str
%
Choices
('average', 'error_on_overlapping_feature', 'error_on_overlapping_sample', 'sum')
|
Str
%
Choices
('average', 'error_on_overlapping_feature', 'error_on_overlapping_sample')
|
Str
%
Choices
('error_on_overlapping_feature', 'error_on_overlapping_sample', 'union')
Method for handling overlapping ids.[default:
'error_on_overlapping_sample'
]
Outputs¶
- merged_table:
FeatureTable[Frequency]
|
FeatureTable[RelativeFrequency]
|
FeatureTable[PresenceAbsence]
The resulting merged feature table.[required]
Examples¶
feature_table_merge_two_tables¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
qiime feature-table merge \
--i-tables feature-table1.qza feature-table2.qza \
--o-merged-table merged-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
merged_table, = feature_table_actions.merge(
tables=[feature_table1, feature_table2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /1 /feature -table1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /1 /feature -table2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge
tool: - For "tables", use ctrl-(or command)-click to select the following inputs:
#: feature-table1.qza
#: feature-table2.qza
- Press the
Execute
button.
- For "tables", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge(
tables=list(feature_table1, feature_table2),
)
merged_table <- action_results$merged_table
from q2_feature_table._examples import feature_table_merge_two_tables
feature_table_merge_two_tables(use)
feature_table_merge_three_tables¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
wget -O 'feature-table3.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
qiime feature-table merge \
--i-tables feature-table1.qza feature-table2.qza feature-table3.qza \
--p-overlap-method sum \
--o-merged-table merged-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
fn = 'feature-table3.qza'
request.urlretrieve(url, fn)
feature_table3 = Artifact.load(fn)
merged_table, = feature_table_actions.merge(
tables=[feature_table1, feature_table2, feature_table3],
overlap_method='sum',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table3.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table3 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge
tool: - For "tables", use ctrl-(or command)-click to select the following inputs:
#: feature-table1.qza
#: feature-table2.qza
#: feature-table3.qza
- Expand the
additional options
section- Set "overlap_method" to
sum
- Set "overlap_method" to
- Press the
Execute
button.
- For "tables", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
fn <- 'feature-table3.qza'
request$urlretrieve(url, fn)
feature_table3 <- Artifact$load(fn)
action_results <- feature_table_actions$merge(
tables=list(feature_table1, feature_table2, feature_table3),
overlap_method='sum',
)
merged_table <- action_results$merged_table
from q2_feature_table._examples import feature_table_merge_three_tables
feature_table_merge_three_tables(use)
feature-table merge-seqs¶
Combines feature data objects which may or may not contain data for the same features. If different feature data is present for the same feature id in the inputs, the data from the first will be propagated to the result.
Inputs¶
- data:
List
[
FeatureData[Sequence]
]
The collection of feature sequences to be merged.[required]
Outputs¶
- merged_data:
FeatureData[Sequence]
The resulting collection of feature sequences containing all feature sequences provided.[required]
Examples¶
feature_table_merge_seqs¶
wget -O 'seqs1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
wget -O 'seqs2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
qiime feature-table merge-seqs \
--i-data seqs1.qza seqs2.qza \
--o-merged-data merged-data.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
fn = 'seqs1.qza'
request.urlretrieve(url, fn)
seqs1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
fn = 'seqs2.qza'
request.urlretrieve(url, fn)
seqs2 = Artifact.load(fn)
merged_data, = feature_table_actions.merge_seqs(
data=[seqs1, seqs2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
seqs1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -seqs /1 /seqs1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
seqs2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -seqs /1 /seqs2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge-seqs
tool: - For "data", use ctrl-(or command)-click to select the following inputs:
#: seqs1.qza
#: seqs2.qza
- Press the
Execute
button.
- For "data", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
fn <- 'seqs1.qza'
request$urlretrieve(url, fn)
seqs1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
fn <- 'seqs2.qza'
request$urlretrieve(url, fn)
seqs2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge_seqs(
data=list(seqs1, seqs2),
)
merged_data <- action_results$merged_data
from q2_feature_table._examples import feature_table_merge_seqs
feature_table_merge_seqs(use)
feature-table merge-taxa¶
Combines a pair of feature data objects which may or may not contain data for the same features. If different feature data is present for the same feature id in the inputs, the data from the first will be propagated to the result.
Inputs¶
- data:
List
[
FeatureData[Taxonomy]
]
The collection of feature taxonomies to be merged.[required]
Outputs¶
- merged_data:
FeatureData[Taxonomy]
The resulting collection of feature taxonomies containing all feature taxonomies provided.[required]
Examples¶
feature_table_merge_taxa¶
wget -O 'tax1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
wget -O 'tax2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
qiime feature-table merge-taxa \
--i-data tax1.qza tax2.qza \
--o-merged-data merged-data.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
fn = 'tax1.qza'
request.urlretrieve(url, fn)
tax1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
fn = 'tax2.qza'
request.urlretrieve(url, fn)
tax2 = Artifact.load(fn)
merged_data, = feature_table_actions.merge_taxa(
data=[tax1, tax2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
tax1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -taxa /1 /tax1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
tax2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -taxa /1 /tax2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge-taxa
tool: - For "data", use ctrl-(or command)-click to select the following inputs:
#: tax1.qza
#: tax2.qza
- Press the
Execute
button.
- For "data", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
fn <- 'tax1.qza'
request$urlretrieve(url, fn)
tax1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
fn <- 'tax2.qza'
request$urlretrieve(url, fn)
tax2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge_taxa(
data=list(tax1, tax2),
)
merged_data <- action_results$merged_data
from q2_feature_table._examples import feature_table_merge_taxa
feature_table_merge_taxa(use)
feature-table rename-ids¶
Renames the sample or feature ids in a feature table using metadata to define the new ids.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The table to be renamed[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
A metadata column defining the new ids. Each original id must map to a new unique id. If strict mode is used, then every id in the original table must have a new id.[required]
- axis:
Str
%
Choices
('feature', 'sample')
Along which axis to rename the ids.[default:
'sample'
]- strict:
Bool
Whether the naming needs to be strict (each id in the table must have a new id). Otherwise, only the ids described in
metadata
will be renamed and the others will keep their original id names.[default:False
]
Outputs¶
- renamed_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
A table which has new ids, where the ids are replaced by values in the
metadata
column.[required]
feature-table filter-samples¶
Filter samples from table based on frequency and/or metadata. Any features with a frequency of zero after sample filtering will also be removed. See the filtering tutorial on https://
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table from which samples should be filtered.[required]
Parameters¶
- min_frequency:
Int
The minimum total frequency that a sample must have to be retained.[default:
0
]- max_frequency:
Int
The maximum total frequency that a sample can have to be retained. If no value is provided this will default to infinity (i.e., no maximum frequency filter will be applied).[optional]
- min_features:
Int
The minimum number of features that a sample must have to be retained.[default:
0
]- max_features:
Int
The maximum number of features that a sample can have to be retained. If no value is provided this will default to infinity (i.e., no maximum feature filter will be applied).[optional]
- metadata:
Metadata
Sample metadata used with
where
parameter when selecting samples to retain, or withexclude_ids
when selecting samples to discard.[optional]- where:
Str
SQLite WHERE clause specifying sample metadata criteria that must be met to be included in the filtered feature table. If not provided, all samples in
metadata
that are also in the feature table will be retained.[optional]- exclude_ids:
Bool
If true, the samples selected by
metadata
orwhere
parameters will be excluded from the filtered table instead of being retained.[default:False
]- filter_empty_features:
Bool
If true, features which are not present in any retained samples are dropped.[default:
True
]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting feature table filtered by sample.[required]
Examples¶
filter_to_subject1¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /1 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1
feature_table_filter_samples_to_subject1(use)
filter_to_skin¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[body-site] IN ("left palm", "right palm")' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site] IN ("left palm", "right palm")',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /2 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /2 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[body-site] IN ("left palm", "right palm")
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site] IN ("left palm", "right palm")',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_skin
feature_table_filter_samples_to_skin(use)
filter_to_subject1_gut¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1" AND [body-site]="gut"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND [body-site]="gut"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /3 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /3 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1" AND [body-site]="gut"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND [body-site]="gut"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1_gut
feature_table_filter_samples_to_subject1_gut(use)
filter_to_gut_or_abx¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[body-site]="gut" OR [reported-antibiotic-usage]="Yes"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site]="gut" OR [reported-antibiotic-usage]="Yes"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /4 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /4 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[body-site]="gut" OR [reported-antibiotic-usage]="Yes"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site]="gut" OR [reported-antibiotic-usage]="Yes"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_gut_or_abx
feature_table_filter_samples_to_gut_or_abx(use)
filter_to_subject1_not_gut¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1" AND NOT [body-site]="gut"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND NOT [body-site]="gut"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /5 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /5 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1" AND NOT [body-site]="gut"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND NOT [body-site]="gut"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1_not_gut
feature_table_filter_samples_to_subject1_not_gut(use)
filter_min_features¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--p-min-features 10 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
min_features=10,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /6 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_features" to
10
- Set "min_features" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
min_features=10L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_min_features
feature_table_filter_samples_min_features(use)
filter_min_frequency¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--p-min-frequency 1500 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
min_frequency=1500,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /7 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_frequency" to
1500
- Set "min_frequency" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
min_frequency=1500L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_min_frequency
feature_table_filter_samples_min_frequency(use)
feature-table filter-features-conditionally¶
Filter features based on the relative abundance in a certain portion of samples (i.e., features must have a relative abundance of at least abundance
in at least prevalence
number of samples). Any samples with a frequency of zero after feature filtering will also be removed.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table from which features should be filtered.[required]
Parameters¶
- abundance:
Float
%
Range
(0, 1)
The minimum relative abundance for a feature to be retained.[required]
- prevalence:
Float
%
Range
(0, 1)
The minimum portion of samples that a feature must have a relative abundance of at least
abundance
to be retained.[required]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting feature table filtered by feature.[required]
Examples¶
feature_table_filter_features_conditionally¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
# Retain only features with at least 1%% abundance in at least 34%% of
# samples.
qiime feature-table filter-features-conditionally \
--i-table feature-table.qza \
--p-abundance 0.01 \
--p-prevalence 0.34 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# Retain only features with at least 1%% abundance in at least 34%% of samples.
filtered_table, = feature_table_actions.filter_features_conditionally(
table=feature_table,
abundance=0.01,
prevalence=0.34,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -features -conditionally /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
Retain only features with at least 1%% abundance in at least 34%% of samples.
- Using the
qiime2 feature-table filter-features-conditionally
tool: - Set "table" to
#: feature-table.qza
- Set "abundance" to
0.01
- Set "prevalence" to
0.34
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# Retain only features with at least 1%% abundance in at least 34%% of samples.
action_results <- feature_table_actions$filter_features_conditionally(
table=feature_table,
abundance=0.01,
prevalence=0.34,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_features_conditionally
feature_table_filter_features_conditionally(use)
feature-table filter-features¶
Filter features from table based on frequency and/or metadata. Any samples with a frequency of zero after feature filtering will also be removed. See the filtering tutorial on https://
Inputs¶
- table:
FeatureTable[Frequency]
The feature table from which features should be filtered.[required]
Parameters¶
- min_frequency:
Int
The minimum total frequency that a feature must have to be retained.[default:
0
]- max_frequency:
Int
The maximum total frequency that a feature can have to be retained. If no value is provided this will default to infinity (i.e., no maximum frequency filter will be applied).[optional]
- min_samples:
Int
The minimum number of samples that a feature must be observed in to be retained.[default:
0
]- max_samples:
Int
The maximum number of samples that a feature can be observed in to be retained. If no value is provided this will default to infinity (i.e., no maximum sample filter will be applied).[optional]
- metadata:
Metadata
Feature metadata used with
where
parameter when selecting features to retain, or withexclude_ids
when selecting features to discard.[optional]- where:
Str
SQLite WHERE clause specifying feature metadata criteria that must be met to be included in the filtered feature table. If not provided, all features in
metadata
that are also in the feature table will be retained.[optional]- exclude_ids:
Bool
If true, the features selected by
metadata
orwhere
parameters will be excluded from the filtered table instead of being retained.[default:False
]- filter_empty_samples:
Bool
If true, drop any samples where none of the retained features are present.[default:
True
]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency]
The resulting feature table filtered by feature.[required]
Examples¶
filter_features_min_samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
qiime feature-table filter-features \
--i-table feature-table.qza \
--p-min-samples 2 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_features(
table=feature_table,
min_samples=2,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -features /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-features
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_samples" to
2
- Set "min_samples" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_features(
table=feature_table,
min_samples=2L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_features_min_samples
feature_table_filter_features_min_samples(use)
feature-table filter-seqs¶
Filter features from sequences based on a feature table or metadata. See the filtering tutorial on https://
Inputs¶
- data:
FeatureData[Sequence¹ | AlignedSequence²]
The sequences from which features should be filtered.[required]
- table:
FeatureTable[Frequency]
Table containing feature ids used for id-based filtering.[optional]
Parameters¶
- metadata:
Metadata
Feature metadata used for id-based filtering, with
where
parameter when selecting features to retain, or withexclude_ids
when selecting features to discard.[optional]- where:
Str
SQLite WHERE clause specifying feature metadata criteria that must be met to be included in the filtered feature table. If not provided, all features in
metadata
that are also in the sequences will be retained.[optional]- exclude_ids:
Bool
If true, the features selected by the
metadata
(with or without thewhere
parameter) ortable
parameter will be excluded from the filtered sequences instead of being retained.[default:False
]
Outputs¶
- filtered_data:
FeatureData[Sequence¹ | AlignedSequence²]
The resulting filtered sequences.[required]
feature-table split¶
Splits one feature table into many feature tables, where splits are defined by values in metadata column.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The table to split.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
A column defining the groups. Each unique value will define a split feature table.[required]
- filter_empty_features:
Bool
If true, features which are not present in a split feature table are dropped.[default:
True
]
Outputs¶
- tables:
Collection
[
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
]
Directory where feature tables split based on metadata values should be written.[required]
feature-table tabulate-feature-frequencies¶
Tabulate sample count and total frequency per feature.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence | RelativeFrequency]
The input feature table.[required]
Outputs¶
- feature_frequencies:
ImmutableMetadata
Per-sample and total frequencies per feature.[required]
Examples¶
feature_table_tabulate_feature_frequencies¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
qiime feature-table tabulate-feature-frequencies \
--i-table feature-table.qza \
--o-feature-frequencies feature-frequencies.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
feature_frequencies, = feature_table_actions.tabulate_feature_frequencies(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -feature -frequencies /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-feature-frequencies
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_feature_frequencies(
table=feature_table,
)
feature_frequencies <- action_results$feature_frequencies
from q2_feature_table._examples import feature_table_tabulate_feature_freqs
feature_table_tabulate_feature_freqs(use)
feature-table tabulate-sample-frequencies¶
Tabulate feature count and total frequency per sample.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence | RelativeFrequency]
The input feature table.[required]
Outputs¶
- sample_frequencies:
ImmutableMetadata
Observed feature count and total frequencies per sample.[required]
Examples¶
feature_table_tabulate_sample_frequencies¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
qiime feature-table tabulate-sample-frequencies \
--i-table feature-table.qza \
--o-sample-frequencies sample-frequencies.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
sample_frequencies, = feature_table_actions.tabulate_sample_frequencies(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -sample -frequencies /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-sample-frequencies
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_sample_frequencies(
table=feature_table,
)
sample_frequencies <- action_results$sample_frequencies
from q2_feature_table._examples import feature_table_tabulate_sample_freqs
feature_table_tabulate_sample_freqs(use)
feature-table summarize¶
Generate visual and tabular summaries of a feature table.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence]
The feature table to be summarized.[required]
Parameters¶
- sample_metadata:
Metadata
The sample metadata.[optional]
Outputs¶
- visualization:
Visualization
<no description>[required]
Examples¶
feature_table_summarize¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
qiime feature-table summarize \
--i-table feature-table.qza \
--o-visualization table.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
table_viz, = feature_table_actions.summarize(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /summarize /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table summarize
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table summarize [...] : visualization.qzv
table.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$summarize(
table=feature_table,
)
table_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_summarize
feature_table_summarize(use)
feature-table tabulate-seqs¶
Generate tabular view of feature identifier to sequence mapping, including links to BLAST each sequence against the NCBI nt database.
Citations¶
Coordinators, 2017; Johnson et al., 2008
Inputs¶
- data:
FeatureData[Sequence | AlignedSequence]
The feature sequences to be tabulated.[required]
- taxonomy:
Collection
[
FeatureData[Taxonomy]
]
The taxonomic classifications of the tabulated features.[optional]
Parameters¶
- metadata:
Metadata
Any additional metadata for the tabulated features.[optional]
- merge_method:
Str
%
Choices
('strict', 'union', 'intersect')
Method that joins data sets[default:
'strict'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
Examples¶
feature_table_tabulate_seqs¶
wget -O 'rep-seqs.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs.qza \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
fn = 'rep-seqs.qza'
request.urlretrieve(url, fn)
rep_seqs = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /1 /rep -seqs .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs.qza
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
fn <- 'rep-seqs.qza'
request$urlretrieve(url, fn)
rep_seqs <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs,
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs
feature_table_tabulate_seqs(use)
feature_table_tabulate_seqs_single_taxon¶
wget -O 'rep-seqs-single-taxon.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
wget -O 'single-taxonomy.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs-single-taxon.qza \
--i-taxonomy single-taxonomy.qza \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
fn = 'rep-seqs-single-taxon.qza'
request.urlretrieve(url, fn)
rep_seqs_single_taxon = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
fn = 'single-taxonomy.qza'
request.urlretrieve(url, fn)
single_taxonomy = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs_single_taxon,
taxonomy=[single_taxonomy],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs-single-taxon.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /2 /rep -seqs -single -taxon .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
single-taxonomy.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /2 /single -taxonomy .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs-single-taxon.qza
- Expand the
additional options
section- Set "taxonomy" to
#: ['single-taxonomy.qza']
- Set "taxonomy" to
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
fn <- 'rep-seqs-single-taxon.qza'
request$urlretrieve(url, fn)
rep_seqs_single_taxon <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
fn <- 'single-taxonomy.qza'
request$urlretrieve(url, fn)
single_taxonomy <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs_single_taxon,
taxonomy=list(single_taxonomy),
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs_single_taxon
feature_table_tabulate_seqs_single_taxon(use)
feature_table_tabulate_seqs_multi_taxon¶
wget -O 'rep-seqs-multi-taxon.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs-multi-taxon.qza \
--i-taxonomy multi-taxonomy/ \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
fn = 'rep-seqs-multi-taxon.qza'
request.urlretrieve(url, fn)
rep_seqs_multi_taxon = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs_multi_taxon,
taxonomy=multi_taxonomy_artifact_collection,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs-multi-taxon.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /3 /rep -seqs -multi -taxon .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs-multi-taxon.qza
- Expand the
additional options
section- Set "taxonomy" to
#: multi-taxonomy/
- Set "taxonomy" to
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
fn <- 'rep-seqs-multi-taxon.qza'
request$urlretrieve(url, fn)
rep_seqs_multi_taxon <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs_multi_taxon,
taxonomy=multi_taxonomy_artifact_collection,
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs_multi_taxon
feature_table_tabulate_seqs_multi_taxon(use)
feature-table core-features¶
Identify "core" features, which are features observed in a user-defined fraction of the samples. Since the core features are a function of the fraction of samples that the feature must be observed in to be considered core, this is computed over a range of fractions defined by the min_fraction
, max_fraction
, and steps
parameters.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to use in core features calculations.[required]
Parameters¶
- min_fraction:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
The minimum fraction of samples that a feature must be observed in for that feature to be considered a core feature.[default:
0.5
]- max_fraction:
Float
%
Range
(0.0, 1.0, inclusive_end=True)
The maximum fraction of samples that a feature must be observed in for that feature to be considered a core feature.[default:
1.0
]- steps:
Int
%
Range
(2, None)
The number of steps to take between
min_fraction
andmax_fraction
for core features calculations. This parameter has no effect ifmin_fraction
andmax_fraction
are the same value.[default:11
]
Outputs¶
- visualization:
Visualization
<no description>[required]
feature-table heatmap¶
Generate a heatmap representation of a feature table with optional clustering on both the sample and feature axes.
Tip: To generate a heatmap containing taxonomic annotations, use qiime taxa collapse
to collapse the feature table at the desired taxonomic level.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to visualize.[required]
Parameters¶
- sample_metadata:
MetadataColumn
[
Categorical
]
Annotate the sample IDs with these sample metadata values. When metadata is present and
cluster
='feature', samples will be sorted by the metadata values.[optional]- feature_metadata:
MetadataColumn
[
Categorical
]
Annotate the feature IDs with these feature metadata values. When metadata is present and
cluster
='sample', features will be sorted by the metadata values.[optional]- normalize:
Bool
Normalize the feature table by adding a psuedocount of 1 and then taking the log10 of the table.[default:
True
]- title:
Str
Optional custom plot title.[optional]
- metric:
Str
%
Choices
('braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule')
Metrics exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'euclidean'
]- method:
Str
%
Choices
('average', 'centroid', 'complete', 'median', 'single', 'ward', 'weighted')
Clustering methods exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'average'
]- cluster:
Str
%
Choices
('both', 'features', 'none', 'samples')
Specify which axes to cluster.[default:
'both'
]- color_scheme:
Str
%
Choices
('Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Vega10', 'Vega10_r', 'Vega20', 'Vega20_r', 'Vega20b', 'Vega20b_r', 'Vega20c', 'Vega20c_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'mako', 'mako_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'rocket', 'rocket_r', 'seismic', 'seismic_r', 'spectral', 'spectral_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'viridis', 'viridis_r', 'vlag', 'vlag_r', 'winter', 'winter_r')
The matplotlib colorscheme to generate the heatmap with.[default:
'rocket'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
feature-table summarize-plus¶
Generate visual and tabular summaries of a feature table. Tabulate sample and feature frequencies.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence]
The feature table to be summarized.[required]
Parameters¶
- metadata:
Metadata
The sample metadata.[optional]
Outputs¶
- feature_frequencies:
ImmutableMetadata
Per-sample and total frequencies per feature.[required]
- sample_frequencies:
ImmutableMetadata
Observed feature count and total frequencies per sample.[required]
- summary:
Visualization
Visual summary of feature table[required]
Examples¶
feature_table_summarize_plus¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
qiime feature-table summarize-plus \
--i-table feature-table.qza \
--o-feature-frequencies feature-frequencies.qza \
--o-sample-frequencies sample-frequencies.qza \
--o-summary visual summary.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
feature_frequencies, sample_frequencies, visual_summary_viz = feature_table_actions.summarize_plus(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /summarize -plus /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table summarize-plus
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
- Once completed, for each new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table summarize-plus [...] : feature_frequencies.qza
feature-frequencies.qza
#: qiime2 feature-table summarize-plus [...] : sample_frequencies.qza
sample-frequencies.qza
#: qiime2 feature-table summarize-plus [...] : summary.qzv
visual summary.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$summarize_plus(
table=feature_table,
)
feature_frequencies <- action_results$feature_frequencies
sample_frequencies <- action_results$sample_frequencies
visual_summary_viz <- action_results$summary
from q2_feature_table._examples import feature_table_summarize_plus
feature_table_summarize_plus(use)
This is a QIIME 2 plugin supporting operations on sample by feature tables, such as filtering, merging, and transforming tables.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -feature -table - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
Name | Type | Short Description |
---|---|---|
rarefy | method | Rarefy table |
subsample-ids | method | Subsample table |
presence-absence | method | Convert to presence/absence |
relative-frequency | method | Convert to relative frequencies |
transpose | method | Transpose a feature table. |
group | method | Group samples or features by a metadata column |
merge | method | Combine multiple tables |
merge-seqs | method | Combine collections of feature sequences |
merge-taxa | method | Combine collections of feature taxonomies |
rename-ids | method | Renames sample or feature ids in a table |
filter-samples | method | Filter samples from table |
filter-features-conditionally | method | Filter features from a table based on abundance and prevalence |
filter-features | method | Filter features from table |
filter-seqs | method | Filter features from sequences |
split | method | Split one feature table into many |
tabulate-feature-frequencies | method | Tabulate feature frequencies |
tabulate-sample-frequencies | method | Tabulate sample frequencies |
summarize | visualizer | Summarize table |
tabulate-seqs | visualizer | View sequence associated with each feature |
core-features | visualizer | Identify core features in table |
heatmap | visualizer | Generate a heatmap representation of a feature table |
summarize-plus | pipeline | Summarize table plus |
feature-table rarefy¶
Subsample frequencies from all samples so that the sum of frequencies in each sample is equal to sampling-depth.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be rarefied.[required]
Parameters¶
- sampling_depth:
Int
%
Range
(1, None)
The total frequency that each sample should be rarefied to. Samples where the sum of frequencies is less than the sampling depth will be not be included in the resulting table.[required]
- with_replacement:
Bool
Rarefy with replacement by sampling from the multinomial distribution instead of rarefying without replacement.[default:
False
]
Outputs¶
- rarefied_table:
FeatureTable[Frequency]
The resulting rarefied feature table.[required]
feature-table subsample-ids¶
Randomly pick samples or features, without replacement, from the table.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be sampled.[required]
Parameters¶
- subsampling_depth:
Int
%
Range
(1, None)
The total number of samples or features to be randomly sampled. Samples or features that are reduced to a zero sum will not be included in the resulting table.[required]
- axis:
Str
%
Choices
('sample', 'feature')
The axis to sample over. If "sample" then samples will be randomly selected to be retained. If "feature" then a random set of features will be selected to be retained.[required]
Outputs¶
- sampled_table:
FeatureTable[Frequency]
The resulting subsampled feature table.[required]
feature-table presence-absence¶
Convert frequencies to binary values indicating presence or absence of a feature in a sample.
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency]
The feature table to be converted into presence/absence abundances.[required]
Outputs¶
- presence_absence_table:
FeatureTable[PresenceAbsence]
The resulting presence/absence feature table.[required]
feature-table relative-frequency¶
Convert frequencies to relative frequencies by dividing each frequency in a sample by the sum of frequencies in that sample.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be converted into relative frequencies.[required]
Outputs¶
- relative_frequency_table:
FeatureTable[RelativeFrequency]
The resulting relative frequency feature table.[required]
feature-table transpose¶
Transpose the rows and columns (typically samples and features) of a feature table.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table to be transposed.[required]
Outputs¶
- transposed_feature_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting transposed feature table.[required]
feature-table group¶
Group samples or features in a feature table using metadata to define the mapping of IDs to a group.
Inputs¶
- table:
FeatureTable[Frequency]
The table to group samples or features on.[required]
Parameters¶
- axis:
Str
%
Choices
('feature', 'sample')
Along which axis to group. Each ID in the given axis must exist in
metadata
.[required]- metadata:
MetadataColumn
[
Categorical
]
A column defining the groups. Each unique value will become a new ID for the table on the given
axis
.[required]- mode:
Str
%
Choices
('mean-ceiling', 'median-ceiling', 'sum')
How to combine samples or features within a group.
sum
will sum the frequencies across all samples or features within a group;mean-ceiling
will take the ceiling of the mean of these frequencies;median-ceiling
will take the ceiling of the median of these frequencies.[required]
Outputs¶
- grouped_table:
FeatureTable[Frequency]
A table that has been grouped along the given
axis
. IDs on that axis are replaced by values in themetadata
column.[required]
Examples¶
group_samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
# Combine samples from the same body-site into single sample. Feature
# frequencies will be the median across the samples being combined, rounded
# up to the nearest whole number.
qiime feature-table group \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--m-metadata-column body-site \
--p-mode median-ceiling \
--p-axis sample \
--o-grouped-table body-site-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
body_site_mdc = sample_metadata_md.get_column('body-site')
# Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
body_site_table, = feature_table_actions.group(
table=feature_table,
metadata=body_site_mdc,
mode='median-ceiling',
axis='sample',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /group /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /group /1 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
- Using the
qiime2 feature-table group
tool: - Set "table" to
#: feature-table.qza
- Set "axis" to
sample
- For "metadata":
- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Set "Column Name" to
body-site
- Leave as
- Set "mode" to
median-ceiling
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table group [...] : grouped_table.qza
body-site-table.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
body_site_mdc <- sample_metadata_md$get_column('body-site')
# Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
action_results <- feature_table_actions$group(
table=feature_table,
metadata=body_site_mdc,
mode='median-ceiling',
axis='sample',
)
body_site_table <- action_results$grouped_table
from q2_feature_table._examples import feature_table_group_samples
feature_table_group_samples(use)
feature-table merge¶
Combines feature tables using the overlap_method
provided.
Inputs¶
- tables:
List
[
FeatureTable[Frequency]
|
FeatureTable[RelativeFrequency]
|
FeatureTable[PresenceAbsence]
]
The collection of feature tables to be merged.[required]
Parameters¶
- overlap_method:
Str
%
Choices
('average', 'error_on_overlapping_feature', 'error_on_overlapping_sample', 'sum')
|
Str
%
Choices
('average', 'error_on_overlapping_feature', 'error_on_overlapping_sample')
|
Str
%
Choices
('error_on_overlapping_feature', 'error_on_overlapping_sample', 'union')
Method for handling overlapping ids.[default:
'error_on_overlapping_sample'
]
Outputs¶
- merged_table:
FeatureTable[Frequency]
|
FeatureTable[RelativeFrequency]
|
FeatureTable[PresenceAbsence]
The resulting merged feature table.[required]
Examples¶
feature_table_merge_two_tables¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
qiime feature-table merge \
--i-tables feature-table1.qza feature-table2.qza \
--o-merged-table merged-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
merged_table, = feature_table_actions.merge(
tables=[feature_table1, feature_table2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /1 /feature -table1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /1 /feature -table2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge
tool: - For "tables", use ctrl-(or command)-click to select the following inputs:
#: feature-table1.qza
#: feature-table2.qza
- Press the
Execute
button.
- For "tables", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge(
tables=list(feature_table1, feature_table2),
)
merged_table <- action_results$merged_table
from q2_feature_table._examples import feature_table_merge_two_tables
feature_table_merge_two_tables(use)
feature_table_merge_three_tables¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
wget -O 'feature-table3.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
qiime feature-table merge \
--i-tables feature-table1.qza feature-table2.qza feature-table3.qza \
--p-overlap-method sum \
--o-merged-table merged-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
fn = 'feature-table3.qza'
request.urlretrieve(url, fn)
feature_table3 = Artifact.load(fn)
merged_table, = feature_table_actions.merge(
tables=[feature_table1, feature_table2, feature_table3],
overlap_method='sum',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table3.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table3 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge
tool: - For "tables", use ctrl-(or command)-click to select the following inputs:
#: feature-table1.qza
#: feature-table2.qza
#: feature-table3.qza
- Expand the
additional options
section- Set "overlap_method" to
sum
- Set "overlap_method" to
- Press the
Execute
button.
- For "tables", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
fn <- 'feature-table3.qza'
request$urlretrieve(url, fn)
feature_table3 <- Artifact$load(fn)
action_results <- feature_table_actions$merge(
tables=list(feature_table1, feature_table2, feature_table3),
overlap_method='sum',
)
merged_table <- action_results$merged_table
from q2_feature_table._examples import feature_table_merge_three_tables
feature_table_merge_three_tables(use)
feature-table merge-seqs¶
Combines feature data objects which may or may not contain data for the same features. If different feature data is present for the same feature id in the inputs, the data from the first will be propagated to the result.
Inputs¶
- data:
List
[
FeatureData[Sequence]
]
The collection of feature sequences to be merged.[required]
Outputs¶
- merged_data:
FeatureData[Sequence]
The resulting collection of feature sequences containing all feature sequences provided.[required]
Examples¶
feature_table_merge_seqs¶
wget -O 'seqs1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
wget -O 'seqs2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
qiime feature-table merge-seqs \
--i-data seqs1.qza seqs2.qza \
--o-merged-data merged-data.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
fn = 'seqs1.qza'
request.urlretrieve(url, fn)
seqs1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
fn = 'seqs2.qza'
request.urlretrieve(url, fn)
seqs2 = Artifact.load(fn)
merged_data, = feature_table_actions.merge_seqs(
data=[seqs1, seqs2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
seqs1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -seqs /1 /seqs1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
seqs2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -seqs /1 /seqs2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge-seqs
tool: - For "data", use ctrl-(or command)-click to select the following inputs:
#: seqs1.qza
#: seqs2.qza
- Press the
Execute
button.
- For "data", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
fn <- 'seqs1.qza'
request$urlretrieve(url, fn)
seqs1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
fn <- 'seqs2.qza'
request$urlretrieve(url, fn)
seqs2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge_seqs(
data=list(seqs1, seqs2),
)
merged_data <- action_results$merged_data
from q2_feature_table._examples import feature_table_merge_seqs
feature_table_merge_seqs(use)
feature-table merge-taxa¶
Combines a pair of feature data objects which may or may not contain data for the same features. If different feature data is present for the same feature id in the inputs, the data from the first will be propagated to the result.
Inputs¶
- data:
List
[
FeatureData[Taxonomy]
]
The collection of feature taxonomies to be merged.[required]
Outputs¶
- merged_data:
FeatureData[Taxonomy]
The resulting collection of feature taxonomies containing all feature taxonomies provided.[required]
Examples¶
feature_table_merge_taxa¶
wget -O 'tax1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
wget -O 'tax2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
qiime feature-table merge-taxa \
--i-data tax1.qza tax2.qza \
--o-merged-data merged-data.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
fn = 'tax1.qza'
request.urlretrieve(url, fn)
tax1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
fn = 'tax2.qza'
request.urlretrieve(url, fn)
tax2 = Artifact.load(fn)
merged_data, = feature_table_actions.merge_taxa(
data=[tax1, tax2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
tax1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -taxa /1 /tax1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
tax2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -taxa /1 /tax2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge-taxa
tool: - For "data", use ctrl-(or command)-click to select the following inputs:
#: tax1.qza
#: tax2.qza
- Press the
Execute
button.
- For "data", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
fn <- 'tax1.qza'
request$urlretrieve(url, fn)
tax1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
fn <- 'tax2.qza'
request$urlretrieve(url, fn)
tax2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge_taxa(
data=list(tax1, tax2),
)
merged_data <- action_results$merged_data
from q2_feature_table._examples import feature_table_merge_taxa
feature_table_merge_taxa(use)
feature-table rename-ids¶
Renames the sample or feature ids in a feature table using metadata to define the new ids.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The table to be renamed[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
A metadata column defining the new ids. Each original id must map to a new unique id. If strict mode is used, then every id in the original table must have a new id.[required]
- axis:
Str
%
Choices
('feature', 'sample')
Along which axis to rename the ids.[default:
'sample'
]- strict:
Bool
Whether the naming needs to be strict (each id in the table must have a new id). Otherwise, only the ids described in
metadata
will be renamed and the others will keep their original id names.[default:False
]
Outputs¶
- renamed_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
A table which has new ids, where the ids are replaced by values in the
metadata
column.[required]
feature-table filter-samples¶
Filter samples from table based on frequency and/or metadata. Any features with a frequency of zero after sample filtering will also be removed. See the filtering tutorial on https://
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table from which samples should be filtered.[required]
Parameters¶
- min_frequency:
Int
The minimum total frequency that a sample must have to be retained.[default:
0
]- max_frequency:
Int
The maximum total frequency that a sample can have to be retained. If no value is provided this will default to infinity (i.e., no maximum frequency filter will be applied).[optional]
- min_features:
Int
The minimum number of features that a sample must have to be retained.[default:
0
]- max_features:
Int
The maximum number of features that a sample can have to be retained. If no value is provided this will default to infinity (i.e., no maximum feature filter will be applied).[optional]
- metadata:
Metadata
Sample metadata used with
where
parameter when selecting samples to retain, or withexclude_ids
when selecting samples to discard.[optional]- where:
Str
SQLite WHERE clause specifying sample metadata criteria that must be met to be included in the filtered feature table. If not provided, all samples in
metadata
that are also in the feature table will be retained.[optional]- exclude_ids:
Bool
If true, the samples selected by
metadata
orwhere
parameters will be excluded from the filtered table instead of being retained.[default:False
]- filter_empty_features:
Bool
If true, features which are not present in any retained samples are dropped.[default:
True
]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting feature table filtered by sample.[required]
Examples¶
filter_to_subject1¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /1 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1
feature_table_filter_samples_to_subject1(use)
filter_to_skin¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[body-site] IN ("left palm", "right palm")' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site] IN ("left palm", "right palm")',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /2 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /2 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[body-site] IN ("left palm", "right palm")
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site] IN ("left palm", "right palm")',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_skin
feature_table_filter_samples_to_skin(use)
filter_to_subject1_gut¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1" AND [body-site]="gut"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND [body-site]="gut"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /3 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /3 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1" AND [body-site]="gut"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND [body-site]="gut"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1_gut
feature_table_filter_samples_to_subject1_gut(use)
filter_to_gut_or_abx¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[body-site]="gut" OR [reported-antibiotic-usage]="Yes"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site]="gut" OR [reported-antibiotic-usage]="Yes"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /4 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /4 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[body-site]="gut" OR [reported-antibiotic-usage]="Yes"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site]="gut" OR [reported-antibiotic-usage]="Yes"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_gut_or_abx
feature_table_filter_samples_to_gut_or_abx(use)
filter_to_subject1_not_gut¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1" AND NOT [body-site]="gut"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND NOT [body-site]="gut"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /5 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /5 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1" AND NOT [body-site]="gut"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND NOT [body-site]="gut"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1_not_gut
feature_table_filter_samples_to_subject1_not_gut(use)
filter_min_features¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--p-min-features 10 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
min_features=10,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /6 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_features" to
10
- Set "min_features" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
min_features=10L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_min_features
feature_table_filter_samples_min_features(use)
filter_min_frequency¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--p-min-frequency 1500 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
min_frequency=1500,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /7 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_frequency" to
1500
- Set "min_frequency" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
min_frequency=1500L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_min_frequency
feature_table_filter_samples_min_frequency(use)
feature-table filter-features-conditionally¶
Filter features based on the relative abundance in a certain portion of samples (i.e., features must have a relative abundance of at least abundance
in at least prevalence
number of samples). Any samples with a frequency of zero after feature filtering will also be removed.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table from which features should be filtered.[required]
Parameters¶
- abundance:
Float
%
Range
(0, 1)
The minimum relative abundance for a feature to be retained.[required]
- prevalence:
Float
%
Range
(0, 1)
The minimum portion of samples that a feature must have a relative abundance of at least
abundance
to be retained.[required]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting feature table filtered by feature.[required]
Examples¶
feature_table_filter_features_conditionally¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
# Retain only features with at least 1%% abundance in at least 34%% of
# samples.
qiime feature-table filter-features-conditionally \
--i-table feature-table.qza \
--p-abundance 0.01 \
--p-prevalence 0.34 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# Retain only features with at least 1%% abundance in at least 34%% of samples.
filtered_table, = feature_table_actions.filter_features_conditionally(
table=feature_table,
abundance=0.01,
prevalence=0.34,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -features -conditionally /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
Retain only features with at least 1%% abundance in at least 34%% of samples.
- Using the
qiime2 feature-table filter-features-conditionally
tool: - Set "table" to
#: feature-table.qza
- Set "abundance" to
0.01
- Set "prevalence" to
0.34
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# Retain only features with at least 1%% abundance in at least 34%% of samples.
action_results <- feature_table_actions$filter_features_conditionally(
table=feature_table,
abundance=0.01,
prevalence=0.34,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_features_conditionally
feature_table_filter_features_conditionally(use)
feature-table filter-features¶
Filter features from table based on frequency and/or metadata. Any samples with a frequency of zero after feature filtering will also be removed. See the filtering tutorial on https://
Inputs¶
- table:
FeatureTable[Frequency]
The feature table from which features should be filtered.[required]
Parameters¶
- min_frequency:
Int
The minimum total frequency that a feature must have to be retained.[default:
0
]- max_frequency:
Int
The maximum total frequency that a feature can have to be retained. If no value is provided this will default to infinity (i.e., no maximum frequency filter will be applied).[optional]
- min_samples:
Int
The minimum number of samples that a feature must be observed in to be retained.[default:
0
]- max_samples:
Int
The maximum number of samples that a feature can be observed in to be retained. If no value is provided this will default to infinity (i.e., no maximum sample filter will be applied).[optional]
- metadata:
Metadata
Feature metadata used with
where
parameter when selecting features to retain, or withexclude_ids
when selecting features to discard.[optional]- where:
Str
SQLite WHERE clause specifying feature metadata criteria that must be met to be included in the filtered feature table. If not provided, all features in
metadata
that are also in the feature table will be retained.[optional]- exclude_ids:
Bool
If true, the features selected by
metadata
orwhere
parameters will be excluded from the filtered table instead of being retained.[default:False
]- filter_empty_samples:
Bool
If true, drop any samples where none of the retained features are present.[default:
True
]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency]
The resulting feature table filtered by feature.[required]
Examples¶
filter_features_min_samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
qiime feature-table filter-features \
--i-table feature-table.qza \
--p-min-samples 2 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_features(
table=feature_table,
min_samples=2,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -features /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-features
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_samples" to
2
- Set "min_samples" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_features(
table=feature_table,
min_samples=2L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_features_min_samples
feature_table_filter_features_min_samples(use)
feature-table filter-seqs¶
Filter features from sequences based on a feature table or metadata. See the filtering tutorial on https://
Inputs¶
- data:
FeatureData[Sequence¹ | AlignedSequence²]
The sequences from which features should be filtered.[required]
- table:
FeatureTable[Frequency]
Table containing feature ids used for id-based filtering.[optional]
Parameters¶
- metadata:
Metadata
Feature metadata used for id-based filtering, with
where
parameter when selecting features to retain, or withexclude_ids
when selecting features to discard.[optional]- where:
Str
SQLite WHERE clause specifying feature metadata criteria that must be met to be included in the filtered feature table. If not provided, all features in
metadata
that are also in the sequences will be retained.[optional]- exclude_ids:
Bool
If true, the features selected by the
metadata
(with or without thewhere
parameter) ortable
parameter will be excluded from the filtered sequences instead of being retained.[default:False
]
Outputs¶
- filtered_data:
FeatureData[Sequence¹ | AlignedSequence²]
The resulting filtered sequences.[required]
feature-table split¶
Splits one feature table into many feature tables, where splits are defined by values in metadata column.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The table to split.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
A column defining the groups. Each unique value will define a split feature table.[required]
- filter_empty_features:
Bool
If true, features which are not present in a split feature table are dropped.[default:
True
]
Outputs¶
- tables:
Collection
[
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
]
Directory where feature tables split based on metadata values should be written.[required]
feature-table tabulate-feature-frequencies¶
Tabulate sample count and total frequency per feature.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence | RelativeFrequency]
The input feature table.[required]
Outputs¶
- feature_frequencies:
ImmutableMetadata
Per-sample and total frequencies per feature.[required]
Examples¶
feature_table_tabulate_feature_frequencies¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
qiime feature-table tabulate-feature-frequencies \
--i-table feature-table.qza \
--o-feature-frequencies feature-frequencies.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
feature_frequencies, = feature_table_actions.tabulate_feature_frequencies(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -feature -frequencies /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-feature-frequencies
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_feature_frequencies(
table=feature_table,
)
feature_frequencies <- action_results$feature_frequencies
from q2_feature_table._examples import feature_table_tabulate_feature_freqs
feature_table_tabulate_feature_freqs(use)
feature-table tabulate-sample-frequencies¶
Tabulate feature count and total frequency per sample.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence | RelativeFrequency]
The input feature table.[required]
Outputs¶
- sample_frequencies:
ImmutableMetadata
Observed feature count and total frequencies per sample.[required]
Examples¶
feature_table_tabulate_sample_frequencies¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
qiime feature-table tabulate-sample-frequencies \
--i-table feature-table.qza \
--o-sample-frequencies sample-frequencies.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
sample_frequencies, = feature_table_actions.tabulate_sample_frequencies(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -sample -frequencies /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-sample-frequencies
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_sample_frequencies(
table=feature_table,
)
sample_frequencies <- action_results$sample_frequencies
from q2_feature_table._examples import feature_table_tabulate_sample_freqs
feature_table_tabulate_sample_freqs(use)
feature-table summarize¶
Generate visual and tabular summaries of a feature table.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence]
The feature table to be summarized.[required]
Parameters¶
- sample_metadata:
Metadata
The sample metadata.[optional]
Outputs¶
- visualization:
Visualization
<no description>[required]
Examples¶
feature_table_summarize¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
qiime feature-table summarize \
--i-table feature-table.qza \
--o-visualization table.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
table_viz, = feature_table_actions.summarize(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /summarize /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table summarize
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table summarize [...] : visualization.qzv
table.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$summarize(
table=feature_table,
)
table_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_summarize
feature_table_summarize(use)
feature-table tabulate-seqs¶
Generate tabular view of feature identifier to sequence mapping, including links to BLAST each sequence against the NCBI nt database.
Citations¶
Coordinators, 2017; Johnson et al., 2008
Inputs¶
- data:
FeatureData[Sequence | AlignedSequence]
The feature sequences to be tabulated.[required]
- taxonomy:
Collection
[
FeatureData[Taxonomy]
]
The taxonomic classifications of the tabulated features.[optional]
Parameters¶
- metadata:
Metadata
Any additional metadata for the tabulated features.[optional]
- merge_method:
Str
%
Choices
('strict', 'union', 'intersect')
Method that joins data sets[default:
'strict'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
Examples¶
feature_table_tabulate_seqs¶
wget -O 'rep-seqs.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs.qza \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
fn = 'rep-seqs.qza'
request.urlretrieve(url, fn)
rep_seqs = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /1 /rep -seqs .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs.qza
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
fn <- 'rep-seqs.qza'
request$urlretrieve(url, fn)
rep_seqs <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs,
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs
feature_table_tabulate_seqs(use)
feature_table_tabulate_seqs_single_taxon¶
wget -O 'rep-seqs-single-taxon.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
wget -O 'single-taxonomy.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs-single-taxon.qza \
--i-taxonomy single-taxonomy.qza \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
fn = 'rep-seqs-single-taxon.qza'
request.urlretrieve(url, fn)
rep_seqs_single_taxon = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
fn = 'single-taxonomy.qza'
request.urlretrieve(url, fn)
single_taxonomy = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs_single_taxon,
taxonomy=[single_taxonomy],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs-single-taxon.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /2 /rep -seqs -single -taxon .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
single-taxonomy.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /2 /single -taxonomy .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs-single-taxon.qza
- Expand the
additional options
section- Set "taxonomy" to
#: ['single-taxonomy.qza']
- Set "taxonomy" to
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
fn <- 'rep-seqs-single-taxon.qza'
request$urlretrieve(url, fn)
rep_seqs_single_taxon <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
fn <- 'single-taxonomy.qza'
request$urlretrieve(url, fn)
single_taxonomy <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs_single_taxon,
taxonomy=list(single_taxonomy),
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs_single_taxon
feature_table_tabulate_seqs_single_taxon(use)
feature_table_tabulate_seqs_multi_taxon¶
wget -O 'rep-seqs-multi-taxon.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs-multi-taxon.qza \
--i-taxonomy multi-taxonomy/ \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
fn = 'rep-seqs-multi-taxon.qza'
request.urlretrieve(url, fn)
rep_seqs_multi_taxon = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs_multi_taxon,
taxonomy=multi_taxonomy_artifact_collection,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs-multi-taxon.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /3 /rep -seqs -multi -taxon .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs-multi-taxon.qza
- Expand the
additional options
section- Set "taxonomy" to
#: multi-taxonomy/
- Set "taxonomy" to
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
fn <- 'rep-seqs-multi-taxon.qza'
request$urlretrieve(url, fn)
rep_seqs_multi_taxon <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs_multi_taxon,
taxonomy=multi_taxonomy_artifact_collection,
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs_multi_taxon
feature_table_tabulate_seqs_multi_taxon(use)
feature-table core-features¶
Identify "core" features, which are features observed in a user-defined fraction of the samples. Since the core features are a function of the fraction of samples that the feature must be observed in to be considered core, this is computed over a range of fractions defined by the min_fraction
, max_fraction
, and steps
parameters.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to use in core features calculations.[required]
Parameters¶
- min_fraction:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
The minimum fraction of samples that a feature must be observed in for that feature to be considered a core feature.[default:
0.5
]- max_fraction:
Float
%
Range
(0.0, 1.0, inclusive_end=True)
The maximum fraction of samples that a feature must be observed in for that feature to be considered a core feature.[default:
1.0
]- steps:
Int
%
Range
(2, None)
The number of steps to take between
min_fraction
andmax_fraction
for core features calculations. This parameter has no effect ifmin_fraction
andmax_fraction
are the same value.[default:11
]
Outputs¶
- visualization:
Visualization
<no description>[required]
feature-table heatmap¶
Generate a heatmap representation of a feature table with optional clustering on both the sample and feature axes.
Tip: To generate a heatmap containing taxonomic annotations, use qiime taxa collapse
to collapse the feature table at the desired taxonomic level.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to visualize.[required]
Parameters¶
- sample_metadata:
MetadataColumn
[
Categorical
]
Annotate the sample IDs with these sample metadata values. When metadata is present and
cluster
='feature', samples will be sorted by the metadata values.[optional]- feature_metadata:
MetadataColumn
[
Categorical
]
Annotate the feature IDs with these feature metadata values. When metadata is present and
cluster
='sample', features will be sorted by the metadata values.[optional]- normalize:
Bool
Normalize the feature table by adding a psuedocount of 1 and then taking the log10 of the table.[default:
True
]- title:
Str
Optional custom plot title.[optional]
- metric:
Str
%
Choices
('braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule')
Metrics exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'euclidean'
]- method:
Str
%
Choices
('average', 'centroid', 'complete', 'median', 'single', 'ward', 'weighted')
Clustering methods exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'average'
]- cluster:
Str
%
Choices
('both', 'features', 'none', 'samples')
Specify which axes to cluster.[default:
'both'
]- color_scheme:
Str
%
Choices
('Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Vega10', 'Vega10_r', 'Vega20', 'Vega20_r', 'Vega20b', 'Vega20b_r', 'Vega20c', 'Vega20c_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'mako', 'mako_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'rocket', 'rocket_r', 'seismic', 'seismic_r', 'spectral', 'spectral_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'viridis', 'viridis_r', 'vlag', 'vlag_r', 'winter', 'winter_r')
The matplotlib colorscheme to generate the heatmap with.[default:
'rocket'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
feature-table summarize-plus¶
Generate visual and tabular summaries of a feature table. Tabulate sample and feature frequencies.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence]
The feature table to be summarized.[required]
Parameters¶
- metadata:
Metadata
The sample metadata.[optional]
Outputs¶
- feature_frequencies:
ImmutableMetadata
Per-sample and total frequencies per feature.[required]
- sample_frequencies:
ImmutableMetadata
Observed feature count and total frequencies per sample.[required]
- summary:
Visualization
Visual summary of feature table[required]
Examples¶
feature_table_summarize_plus¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
qiime feature-table summarize-plus \
--i-table feature-table.qza \
--o-feature-frequencies feature-frequencies.qza \
--o-sample-frequencies sample-frequencies.qza \
--o-summary visual summary.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
feature_frequencies, sample_frequencies, visual_summary_viz = feature_table_actions.summarize_plus(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /summarize -plus /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table summarize-plus
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
- Once completed, for each new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table summarize-plus [...] : feature_frequencies.qza
feature-frequencies.qza
#: qiime2 feature-table summarize-plus [...] : sample_frequencies.qza
sample-frequencies.qza
#: qiime2 feature-table summarize-plus [...] : summary.qzv
visual summary.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$summarize_plus(
table=feature_table,
)
feature_frequencies <- action_results$feature_frequencies
sample_frequencies <- action_results$sample_frequencies
visual_summary_viz <- action_results$summary
from q2_feature_table._examples import feature_table_summarize_plus
feature_table_summarize_plus(use)
This is a QIIME 2 plugin supporting operations on sample by feature tables, such as filtering, merging, and transforming tables.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -feature -table - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
Name | Type | Short Description |
---|---|---|
rarefy | method | Rarefy table |
subsample-ids | method | Subsample table |
presence-absence | method | Convert to presence/absence |
relative-frequency | method | Convert to relative frequencies |
transpose | method | Transpose a feature table. |
group | method | Group samples or features by a metadata column |
merge | method | Combine multiple tables |
merge-seqs | method | Combine collections of feature sequences |
merge-taxa | method | Combine collections of feature taxonomies |
rename-ids | method | Renames sample or feature ids in a table |
filter-samples | method | Filter samples from table |
filter-features-conditionally | method | Filter features from a table based on abundance and prevalence |
filter-features | method | Filter features from table |
filter-seqs | method | Filter features from sequences |
split | method | Split one feature table into many |
tabulate-feature-frequencies | method | Tabulate feature frequencies |
tabulate-sample-frequencies | method | Tabulate sample frequencies |
summarize | visualizer | Summarize table |
tabulate-seqs | visualizer | View sequence associated with each feature |
core-features | visualizer | Identify core features in table |
heatmap | visualizer | Generate a heatmap representation of a feature table |
summarize-plus | pipeline | Summarize table plus |
feature-table rarefy¶
Subsample frequencies from all samples so that the sum of frequencies in each sample is equal to sampling-depth.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be rarefied.[required]
Parameters¶
- sampling_depth:
Int
%
Range
(1, None)
The total frequency that each sample should be rarefied to. Samples where the sum of frequencies is less than the sampling depth will be not be included in the resulting table.[required]
- with_replacement:
Bool
Rarefy with replacement by sampling from the multinomial distribution instead of rarefying without replacement.[default:
False
]
Outputs¶
- rarefied_table:
FeatureTable[Frequency]
The resulting rarefied feature table.[required]
feature-table subsample-ids¶
Randomly pick samples or features, without replacement, from the table.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be sampled.[required]
Parameters¶
- subsampling_depth:
Int
%
Range
(1, None)
The total number of samples or features to be randomly sampled. Samples or features that are reduced to a zero sum will not be included in the resulting table.[required]
- axis:
Str
%
Choices
('sample', 'feature')
The axis to sample over. If "sample" then samples will be randomly selected to be retained. If "feature" then a random set of features will be selected to be retained.[required]
Outputs¶
- sampled_table:
FeatureTable[Frequency]
The resulting subsampled feature table.[required]
feature-table presence-absence¶
Convert frequencies to binary values indicating presence or absence of a feature in a sample.
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency]
The feature table to be converted into presence/absence abundances.[required]
Outputs¶
- presence_absence_table:
FeatureTable[PresenceAbsence]
The resulting presence/absence feature table.[required]
feature-table relative-frequency¶
Convert frequencies to relative frequencies by dividing each frequency in a sample by the sum of frequencies in that sample.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be converted into relative frequencies.[required]
Outputs¶
- relative_frequency_table:
FeatureTable[RelativeFrequency]
The resulting relative frequency feature table.[required]
feature-table transpose¶
Transpose the rows and columns (typically samples and features) of a feature table.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table to be transposed.[required]
Outputs¶
- transposed_feature_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting transposed feature table.[required]
feature-table group¶
Group samples or features in a feature table using metadata to define the mapping of IDs to a group.
Inputs¶
- table:
FeatureTable[Frequency]
The table to group samples or features on.[required]
Parameters¶
- axis:
Str
%
Choices
('feature', 'sample')
Along which axis to group. Each ID in the given axis must exist in
metadata
.[required]- metadata:
MetadataColumn
[
Categorical
]
A column defining the groups. Each unique value will become a new ID for the table on the given
axis
.[required]- mode:
Str
%
Choices
('mean-ceiling', 'median-ceiling', 'sum')
How to combine samples or features within a group.
sum
will sum the frequencies across all samples or features within a group;mean-ceiling
will take the ceiling of the mean of these frequencies;median-ceiling
will take the ceiling of the median of these frequencies.[required]
Outputs¶
- grouped_table:
FeatureTable[Frequency]
A table that has been grouped along the given
axis
. IDs on that axis are replaced by values in themetadata
column.[required]
Examples¶
group_samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
# Combine samples from the same body-site into single sample. Feature
# frequencies will be the median across the samples being combined, rounded
# up to the nearest whole number.
qiime feature-table group \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--m-metadata-column body-site \
--p-mode median-ceiling \
--p-axis sample \
--o-grouped-table body-site-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
body_site_mdc = sample_metadata_md.get_column('body-site')
# Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
body_site_table, = feature_table_actions.group(
table=feature_table,
metadata=body_site_mdc,
mode='median-ceiling',
axis='sample',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /group /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /group /1 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
- Using the
qiime2 feature-table group
tool: - Set "table" to
#: feature-table.qza
- Set "axis" to
sample
- For "metadata":
- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Set "Column Name" to
body-site
- Leave as
- Set "mode" to
median-ceiling
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table group [...] : grouped_table.qza
body-site-table.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
body_site_mdc <- sample_metadata_md$get_column('body-site')
# Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
action_results <- feature_table_actions$group(
table=feature_table,
metadata=body_site_mdc,
mode='median-ceiling',
axis='sample',
)
body_site_table <- action_results$grouped_table
from q2_feature_table._examples import feature_table_group_samples
feature_table_group_samples(use)
feature-table merge¶
Combines feature tables using the overlap_method
provided.
Inputs¶
- tables:
List
[
FeatureTable[Frequency]
|
FeatureTable[RelativeFrequency]
|
FeatureTable[PresenceAbsence]
]
The collection of feature tables to be merged.[required]
Parameters¶
- overlap_method:
Str
%
Choices
('average', 'error_on_overlapping_feature', 'error_on_overlapping_sample', 'sum')
|
Str
%
Choices
('average', 'error_on_overlapping_feature', 'error_on_overlapping_sample')
|
Str
%
Choices
('error_on_overlapping_feature', 'error_on_overlapping_sample', 'union')
Method for handling overlapping ids.[default:
'error_on_overlapping_sample'
]
Outputs¶
- merged_table:
FeatureTable[Frequency]
|
FeatureTable[RelativeFrequency]
|
FeatureTable[PresenceAbsence]
The resulting merged feature table.[required]
Examples¶
feature_table_merge_two_tables¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
qiime feature-table merge \
--i-tables feature-table1.qza feature-table2.qza \
--o-merged-table merged-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
merged_table, = feature_table_actions.merge(
tables=[feature_table1, feature_table2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /1 /feature -table1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /1 /feature -table2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge
tool: - For "tables", use ctrl-(or command)-click to select the following inputs:
#: feature-table1.qza
#: feature-table2.qza
- Press the
Execute
button.
- For "tables", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge(
tables=list(feature_table1, feature_table2),
)
merged_table <- action_results$merged_table
from q2_feature_table._examples import feature_table_merge_two_tables
feature_table_merge_two_tables(use)
feature_table_merge_three_tables¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
wget -O 'feature-table3.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
qiime feature-table merge \
--i-tables feature-table1.qza feature-table2.qza feature-table3.qza \
--p-overlap-method sum \
--o-merged-table merged-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
fn = 'feature-table3.qza'
request.urlretrieve(url, fn)
feature_table3 = Artifact.load(fn)
merged_table, = feature_table_actions.merge(
tables=[feature_table1, feature_table2, feature_table3],
overlap_method='sum',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table3.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table3 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge
tool: - For "tables", use ctrl-(or command)-click to select the following inputs:
#: feature-table1.qza
#: feature-table2.qza
#: feature-table3.qza
- Expand the
additional options
section- Set "overlap_method" to
sum
- Set "overlap_method" to
- Press the
Execute
button.
- For "tables", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
fn <- 'feature-table3.qza'
request$urlretrieve(url, fn)
feature_table3 <- Artifact$load(fn)
action_results <- feature_table_actions$merge(
tables=list(feature_table1, feature_table2, feature_table3),
overlap_method='sum',
)
merged_table <- action_results$merged_table
from q2_feature_table._examples import feature_table_merge_three_tables
feature_table_merge_three_tables(use)
feature-table merge-seqs¶
Combines feature data objects which may or may not contain data for the same features. If different feature data is present for the same feature id in the inputs, the data from the first will be propagated to the result.
Inputs¶
- data:
List
[
FeatureData[Sequence]
]
The collection of feature sequences to be merged.[required]
Outputs¶
- merged_data:
FeatureData[Sequence]
The resulting collection of feature sequences containing all feature sequences provided.[required]
Examples¶
feature_table_merge_seqs¶
wget -O 'seqs1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
wget -O 'seqs2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
qiime feature-table merge-seqs \
--i-data seqs1.qza seqs2.qza \
--o-merged-data merged-data.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
fn = 'seqs1.qza'
request.urlretrieve(url, fn)
seqs1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
fn = 'seqs2.qza'
request.urlretrieve(url, fn)
seqs2 = Artifact.load(fn)
merged_data, = feature_table_actions.merge_seqs(
data=[seqs1, seqs2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
seqs1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -seqs /1 /seqs1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
seqs2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -seqs /1 /seqs2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge-seqs
tool: - For "data", use ctrl-(or command)-click to select the following inputs:
#: seqs1.qza
#: seqs2.qza
- Press the
Execute
button.
- For "data", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
fn <- 'seqs1.qza'
request$urlretrieve(url, fn)
seqs1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
fn <- 'seqs2.qza'
request$urlretrieve(url, fn)
seqs2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge_seqs(
data=list(seqs1, seqs2),
)
merged_data <- action_results$merged_data
from q2_feature_table._examples import feature_table_merge_seqs
feature_table_merge_seqs(use)
feature-table merge-taxa¶
Combines a pair of feature data objects which may or may not contain data for the same features. If different feature data is present for the same feature id in the inputs, the data from the first will be propagated to the result.
Inputs¶
- data:
List
[
FeatureData[Taxonomy]
]
The collection of feature taxonomies to be merged.[required]
Outputs¶
- merged_data:
FeatureData[Taxonomy]
The resulting collection of feature taxonomies containing all feature taxonomies provided.[required]
Examples¶
feature_table_merge_taxa¶
wget -O 'tax1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
wget -O 'tax2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
qiime feature-table merge-taxa \
--i-data tax1.qza tax2.qza \
--o-merged-data merged-data.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
fn = 'tax1.qza'
request.urlretrieve(url, fn)
tax1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
fn = 'tax2.qza'
request.urlretrieve(url, fn)
tax2 = Artifact.load(fn)
merged_data, = feature_table_actions.merge_taxa(
data=[tax1, tax2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
tax1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -taxa /1 /tax1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
tax2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -taxa /1 /tax2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge-taxa
tool: - For "data", use ctrl-(or command)-click to select the following inputs:
#: tax1.qza
#: tax2.qza
- Press the
Execute
button.
- For "data", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
fn <- 'tax1.qza'
request$urlretrieve(url, fn)
tax1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
fn <- 'tax2.qza'
request$urlretrieve(url, fn)
tax2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge_taxa(
data=list(tax1, tax2),
)
merged_data <- action_results$merged_data
from q2_feature_table._examples import feature_table_merge_taxa
feature_table_merge_taxa(use)
feature-table rename-ids¶
Renames the sample or feature ids in a feature table using metadata to define the new ids.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The table to be renamed[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
A metadata column defining the new ids. Each original id must map to a new unique id. If strict mode is used, then every id in the original table must have a new id.[required]
- axis:
Str
%
Choices
('feature', 'sample')
Along which axis to rename the ids.[default:
'sample'
]- strict:
Bool
Whether the naming needs to be strict (each id in the table must have a new id). Otherwise, only the ids described in
metadata
will be renamed and the others will keep their original id names.[default:False
]
Outputs¶
- renamed_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
A table which has new ids, where the ids are replaced by values in the
metadata
column.[required]
feature-table filter-samples¶
Filter samples from table based on frequency and/or metadata. Any features with a frequency of zero after sample filtering will also be removed. See the filtering tutorial on https://
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table from which samples should be filtered.[required]
Parameters¶
- min_frequency:
Int
The minimum total frequency that a sample must have to be retained.[default:
0
]- max_frequency:
Int
The maximum total frequency that a sample can have to be retained. If no value is provided this will default to infinity (i.e., no maximum frequency filter will be applied).[optional]
- min_features:
Int
The minimum number of features that a sample must have to be retained.[default:
0
]- max_features:
Int
The maximum number of features that a sample can have to be retained. If no value is provided this will default to infinity (i.e., no maximum feature filter will be applied).[optional]
- metadata:
Metadata
Sample metadata used with
where
parameter when selecting samples to retain, or withexclude_ids
when selecting samples to discard.[optional]- where:
Str
SQLite WHERE clause specifying sample metadata criteria that must be met to be included in the filtered feature table. If not provided, all samples in
metadata
that are also in the feature table will be retained.[optional]- exclude_ids:
Bool
If true, the samples selected by
metadata
orwhere
parameters will be excluded from the filtered table instead of being retained.[default:False
]- filter_empty_features:
Bool
If true, features which are not present in any retained samples are dropped.[default:
True
]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting feature table filtered by sample.[required]
Examples¶
filter_to_subject1¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /1 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1
feature_table_filter_samples_to_subject1(use)
filter_to_skin¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[body-site] IN ("left palm", "right palm")' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site] IN ("left palm", "right palm")',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /2 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /2 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[body-site] IN ("left palm", "right palm")
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site] IN ("left palm", "right palm")',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_skin
feature_table_filter_samples_to_skin(use)
filter_to_subject1_gut¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1" AND [body-site]="gut"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND [body-site]="gut"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /3 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /3 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1" AND [body-site]="gut"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND [body-site]="gut"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1_gut
feature_table_filter_samples_to_subject1_gut(use)
filter_to_gut_or_abx¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[body-site]="gut" OR [reported-antibiotic-usage]="Yes"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site]="gut" OR [reported-antibiotic-usage]="Yes"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /4 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /4 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[body-site]="gut" OR [reported-antibiotic-usage]="Yes"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site]="gut" OR [reported-antibiotic-usage]="Yes"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_gut_or_abx
feature_table_filter_samples_to_gut_or_abx(use)
filter_to_subject1_not_gut¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1" AND NOT [body-site]="gut"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND NOT [body-site]="gut"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /5 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /5 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1" AND NOT [body-site]="gut"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND NOT [body-site]="gut"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1_not_gut
feature_table_filter_samples_to_subject1_not_gut(use)
filter_min_features¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--p-min-features 10 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
min_features=10,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /6 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_features" to
10
- Set "min_features" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
min_features=10L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_min_features
feature_table_filter_samples_min_features(use)
filter_min_frequency¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--p-min-frequency 1500 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
min_frequency=1500,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /7 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_frequency" to
1500
- Set "min_frequency" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
min_frequency=1500L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_min_frequency
feature_table_filter_samples_min_frequency(use)
feature-table filter-features-conditionally¶
Filter features based on the relative abundance in a certain portion of samples (i.e., features must have a relative abundance of at least abundance
in at least prevalence
number of samples). Any samples with a frequency of zero after feature filtering will also be removed.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table from which features should be filtered.[required]
Parameters¶
- abundance:
Float
%
Range
(0, 1)
The minimum relative abundance for a feature to be retained.[required]
- prevalence:
Float
%
Range
(0, 1)
The minimum portion of samples that a feature must have a relative abundance of at least
abundance
to be retained.[required]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting feature table filtered by feature.[required]
Examples¶
feature_table_filter_features_conditionally¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
# Retain only features with at least 1%% abundance in at least 34%% of
# samples.
qiime feature-table filter-features-conditionally \
--i-table feature-table.qza \
--p-abundance 0.01 \
--p-prevalence 0.34 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# Retain only features with at least 1%% abundance in at least 34%% of samples.
filtered_table, = feature_table_actions.filter_features_conditionally(
table=feature_table,
abundance=0.01,
prevalence=0.34,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -features -conditionally /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
Retain only features with at least 1%% abundance in at least 34%% of samples.
- Using the
qiime2 feature-table filter-features-conditionally
tool: - Set "table" to
#: feature-table.qza
- Set "abundance" to
0.01
- Set "prevalence" to
0.34
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# Retain only features with at least 1%% abundance in at least 34%% of samples.
action_results <- feature_table_actions$filter_features_conditionally(
table=feature_table,
abundance=0.01,
prevalence=0.34,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_features_conditionally
feature_table_filter_features_conditionally(use)
feature-table filter-features¶
Filter features from table based on frequency and/or metadata. Any samples with a frequency of zero after feature filtering will also be removed. See the filtering tutorial on https://
Inputs¶
- table:
FeatureTable[Frequency]
The feature table from which features should be filtered.[required]
Parameters¶
- min_frequency:
Int
The minimum total frequency that a feature must have to be retained.[default:
0
]- max_frequency:
Int
The maximum total frequency that a feature can have to be retained. If no value is provided this will default to infinity (i.e., no maximum frequency filter will be applied).[optional]
- min_samples:
Int
The minimum number of samples that a feature must be observed in to be retained.[default:
0
]- max_samples:
Int
The maximum number of samples that a feature can be observed in to be retained. If no value is provided this will default to infinity (i.e., no maximum sample filter will be applied).[optional]
- metadata:
Metadata
Feature metadata used with
where
parameter when selecting features to retain, or withexclude_ids
when selecting features to discard.[optional]- where:
Str
SQLite WHERE clause specifying feature metadata criteria that must be met to be included in the filtered feature table. If not provided, all features in
metadata
that are also in the feature table will be retained.[optional]- exclude_ids:
Bool
If true, the features selected by
metadata
orwhere
parameters will be excluded from the filtered table instead of being retained.[default:False
]- filter_empty_samples:
Bool
If true, drop any samples where none of the retained features are present.[default:
True
]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency]
The resulting feature table filtered by feature.[required]
Examples¶
filter_features_min_samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
qiime feature-table filter-features \
--i-table feature-table.qza \
--p-min-samples 2 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_features(
table=feature_table,
min_samples=2,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -features /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-features
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_samples" to
2
- Set "min_samples" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_features(
table=feature_table,
min_samples=2L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_features_min_samples
feature_table_filter_features_min_samples(use)
feature-table filter-seqs¶
Filter features from sequences based on a feature table or metadata. See the filtering tutorial on https://
Inputs¶
- data:
FeatureData[Sequence¹ | AlignedSequence²]
The sequences from which features should be filtered.[required]
- table:
FeatureTable[Frequency]
Table containing feature ids used for id-based filtering.[optional]
Parameters¶
- metadata:
Metadata
Feature metadata used for id-based filtering, with
where
parameter when selecting features to retain, or withexclude_ids
when selecting features to discard.[optional]- where:
Str
SQLite WHERE clause specifying feature metadata criteria that must be met to be included in the filtered feature table. If not provided, all features in
metadata
that are also in the sequences will be retained.[optional]- exclude_ids:
Bool
If true, the features selected by the
metadata
(with or without thewhere
parameter) ortable
parameter will be excluded from the filtered sequences instead of being retained.[default:False
]
Outputs¶
- filtered_data:
FeatureData[Sequence¹ | AlignedSequence²]
The resulting filtered sequences.[required]
feature-table split¶
Splits one feature table into many feature tables, where splits are defined by values in metadata column.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The table to split.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
A column defining the groups. Each unique value will define a split feature table.[required]
- filter_empty_features:
Bool
If true, features which are not present in a split feature table are dropped.[default:
True
]
Outputs¶
- tables:
Collection
[
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
]
Directory where feature tables split based on metadata values should be written.[required]
feature-table tabulate-feature-frequencies¶
Tabulate sample count and total frequency per feature.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence | RelativeFrequency]
The input feature table.[required]
Outputs¶
- feature_frequencies:
ImmutableMetadata
Per-sample and total frequencies per feature.[required]
Examples¶
feature_table_tabulate_feature_frequencies¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
qiime feature-table tabulate-feature-frequencies \
--i-table feature-table.qza \
--o-feature-frequencies feature-frequencies.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
feature_frequencies, = feature_table_actions.tabulate_feature_frequencies(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -feature -frequencies /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-feature-frequencies
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_feature_frequencies(
table=feature_table,
)
feature_frequencies <- action_results$feature_frequencies
from q2_feature_table._examples import feature_table_tabulate_feature_freqs
feature_table_tabulate_feature_freqs(use)
feature-table tabulate-sample-frequencies¶
Tabulate feature count and total frequency per sample.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence | RelativeFrequency]
The input feature table.[required]
Outputs¶
- sample_frequencies:
ImmutableMetadata
Observed feature count and total frequencies per sample.[required]
Examples¶
feature_table_tabulate_sample_frequencies¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
qiime feature-table tabulate-sample-frequencies \
--i-table feature-table.qza \
--o-sample-frequencies sample-frequencies.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
sample_frequencies, = feature_table_actions.tabulate_sample_frequencies(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -sample -frequencies /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-sample-frequencies
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_sample_frequencies(
table=feature_table,
)
sample_frequencies <- action_results$sample_frequencies
from q2_feature_table._examples import feature_table_tabulate_sample_freqs
feature_table_tabulate_sample_freqs(use)
feature-table summarize¶
Generate visual and tabular summaries of a feature table.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence]
The feature table to be summarized.[required]
Parameters¶
- sample_metadata:
Metadata
The sample metadata.[optional]
Outputs¶
- visualization:
Visualization
<no description>[required]
Examples¶
feature_table_summarize¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
qiime feature-table summarize \
--i-table feature-table.qza \
--o-visualization table.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
table_viz, = feature_table_actions.summarize(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /summarize /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table summarize
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table summarize [...] : visualization.qzv
table.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$summarize(
table=feature_table,
)
table_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_summarize
feature_table_summarize(use)
feature-table tabulate-seqs¶
Generate tabular view of feature identifier to sequence mapping, including links to BLAST each sequence against the NCBI nt database.
Citations¶
Coordinators, 2017; Johnson et al., 2008
Inputs¶
- data:
FeatureData[Sequence | AlignedSequence]
The feature sequences to be tabulated.[required]
- taxonomy:
Collection
[
FeatureData[Taxonomy]
]
The taxonomic classifications of the tabulated features.[optional]
Parameters¶
- metadata:
Metadata
Any additional metadata for the tabulated features.[optional]
- merge_method:
Str
%
Choices
('strict', 'union', 'intersect')
Method that joins data sets[default:
'strict'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
Examples¶
feature_table_tabulate_seqs¶
wget -O 'rep-seqs.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs.qza \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
fn = 'rep-seqs.qza'
request.urlretrieve(url, fn)
rep_seqs = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /1 /rep -seqs .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs.qza
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
fn <- 'rep-seqs.qza'
request$urlretrieve(url, fn)
rep_seqs <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs,
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs
feature_table_tabulate_seqs(use)
feature_table_tabulate_seqs_single_taxon¶
wget -O 'rep-seqs-single-taxon.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
wget -O 'single-taxonomy.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs-single-taxon.qza \
--i-taxonomy single-taxonomy.qza \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
fn = 'rep-seqs-single-taxon.qza'
request.urlretrieve(url, fn)
rep_seqs_single_taxon = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
fn = 'single-taxonomy.qza'
request.urlretrieve(url, fn)
single_taxonomy = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs_single_taxon,
taxonomy=[single_taxonomy],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs-single-taxon.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /2 /rep -seqs -single -taxon .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
single-taxonomy.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /2 /single -taxonomy .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs-single-taxon.qza
- Expand the
additional options
section- Set "taxonomy" to
#: ['single-taxonomy.qza']
- Set "taxonomy" to
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
fn <- 'rep-seqs-single-taxon.qza'
request$urlretrieve(url, fn)
rep_seqs_single_taxon <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
fn <- 'single-taxonomy.qza'
request$urlretrieve(url, fn)
single_taxonomy <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs_single_taxon,
taxonomy=list(single_taxonomy),
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs_single_taxon
feature_table_tabulate_seqs_single_taxon(use)
feature_table_tabulate_seqs_multi_taxon¶
wget -O 'rep-seqs-multi-taxon.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs-multi-taxon.qza \
--i-taxonomy multi-taxonomy/ \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
fn = 'rep-seqs-multi-taxon.qza'
request.urlretrieve(url, fn)
rep_seqs_multi_taxon = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs_multi_taxon,
taxonomy=multi_taxonomy_artifact_collection,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs-multi-taxon.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /3 /rep -seqs -multi -taxon .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs-multi-taxon.qza
- Expand the
additional options
section- Set "taxonomy" to
#: multi-taxonomy/
- Set "taxonomy" to
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
fn <- 'rep-seqs-multi-taxon.qza'
request$urlretrieve(url, fn)
rep_seqs_multi_taxon <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs_multi_taxon,
taxonomy=multi_taxonomy_artifact_collection,
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs_multi_taxon
feature_table_tabulate_seqs_multi_taxon(use)
feature-table core-features¶
Identify "core" features, which are features observed in a user-defined fraction of the samples. Since the core features are a function of the fraction of samples that the feature must be observed in to be considered core, this is computed over a range of fractions defined by the min_fraction
, max_fraction
, and steps
parameters.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to use in core features calculations.[required]
Parameters¶
- min_fraction:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
The minimum fraction of samples that a feature must be observed in for that feature to be considered a core feature.[default:
0.5
]- max_fraction:
Float
%
Range
(0.0, 1.0, inclusive_end=True)
The maximum fraction of samples that a feature must be observed in for that feature to be considered a core feature.[default:
1.0
]- steps:
Int
%
Range
(2, None)
The number of steps to take between
min_fraction
andmax_fraction
for core features calculations. This parameter has no effect ifmin_fraction
andmax_fraction
are the same value.[default:11
]
Outputs¶
- visualization:
Visualization
<no description>[required]
feature-table heatmap¶
Generate a heatmap representation of a feature table with optional clustering on both the sample and feature axes.
Tip: To generate a heatmap containing taxonomic annotations, use qiime taxa collapse
to collapse the feature table at the desired taxonomic level.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to visualize.[required]
Parameters¶
- sample_metadata:
MetadataColumn
[
Categorical
]
Annotate the sample IDs with these sample metadata values. When metadata is present and
cluster
='feature', samples will be sorted by the metadata values.[optional]- feature_metadata:
MetadataColumn
[
Categorical
]
Annotate the feature IDs with these feature metadata values. When metadata is present and
cluster
='sample', features will be sorted by the metadata values.[optional]- normalize:
Bool
Normalize the feature table by adding a psuedocount of 1 and then taking the log10 of the table.[default:
True
]- title:
Str
Optional custom plot title.[optional]
- metric:
Str
%
Choices
('braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule')
Metrics exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'euclidean'
]- method:
Str
%
Choices
('average', 'centroid', 'complete', 'median', 'single', 'ward', 'weighted')
Clustering methods exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'average'
]- cluster:
Str
%
Choices
('both', 'features', 'none', 'samples')
Specify which axes to cluster.[default:
'both'
]- color_scheme:
Str
%
Choices
('Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Vega10', 'Vega10_r', 'Vega20', 'Vega20_r', 'Vega20b', 'Vega20b_r', 'Vega20c', 'Vega20c_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'mako', 'mako_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'rocket', 'rocket_r', 'seismic', 'seismic_r', 'spectral', 'spectral_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'viridis', 'viridis_r', 'vlag', 'vlag_r', 'winter', 'winter_r')
The matplotlib colorscheme to generate the heatmap with.[default:
'rocket'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
feature-table summarize-plus¶
Generate visual and tabular summaries of a feature table. Tabulate sample and feature frequencies.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence]
The feature table to be summarized.[required]
Parameters¶
- metadata:
Metadata
The sample metadata.[optional]
Outputs¶
- feature_frequencies:
ImmutableMetadata
Per-sample and total frequencies per feature.[required]
- sample_frequencies:
ImmutableMetadata
Observed feature count and total frequencies per sample.[required]
- summary:
Visualization
Visual summary of feature table[required]
Examples¶
feature_table_summarize_plus¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
qiime feature-table summarize-plus \
--i-table feature-table.qza \
--o-feature-frequencies feature-frequencies.qza \
--o-sample-frequencies sample-frequencies.qza \
--o-summary visual summary.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
feature_frequencies, sample_frequencies, visual_summary_viz = feature_table_actions.summarize_plus(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /summarize -plus /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table summarize-plus
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
- Once completed, for each new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table summarize-plus [...] : feature_frequencies.qza
feature-frequencies.qza
#: qiime2 feature-table summarize-plus [...] : sample_frequencies.qza
sample-frequencies.qza
#: qiime2 feature-table summarize-plus [...] : summary.qzv
visual summary.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$summarize_plus(
table=feature_table,
)
feature_frequencies <- action_results$feature_frequencies
sample_frequencies <- action_results$sample_frequencies
visual_summary_viz <- action_results$summary
from q2_feature_table._examples import feature_table_summarize_plus
feature_table_summarize_plus(use)
This is a QIIME 2 plugin supporting operations on sample by feature tables, such as filtering, merging, and transforming tables.
- version:
2024.10.0
- website: https://
github .com /qiime2 /q2 -feature -table - user support:
- Please post to the QIIME 2 forum for help with this plugin: https://
forum .qiime2 .org
Actions¶
Name | Type | Short Description |
---|---|---|
rarefy | method | Rarefy table |
subsample-ids | method | Subsample table |
presence-absence | method | Convert to presence/absence |
relative-frequency | method | Convert to relative frequencies |
transpose | method | Transpose a feature table. |
group | method | Group samples or features by a metadata column |
merge | method | Combine multiple tables |
merge-seqs | method | Combine collections of feature sequences |
merge-taxa | method | Combine collections of feature taxonomies |
rename-ids | method | Renames sample or feature ids in a table |
filter-samples | method | Filter samples from table |
filter-features-conditionally | method | Filter features from a table based on abundance and prevalence |
filter-features | method | Filter features from table |
filter-seqs | method | Filter features from sequences |
split | method | Split one feature table into many |
tabulate-feature-frequencies | method | Tabulate feature frequencies |
tabulate-sample-frequencies | method | Tabulate sample frequencies |
summarize | visualizer | Summarize table |
tabulate-seqs | visualizer | View sequence associated with each feature |
core-features | visualizer | Identify core features in table |
heatmap | visualizer | Generate a heatmap representation of a feature table |
summarize-plus | pipeline | Summarize table plus |
feature-table rarefy¶
Subsample frequencies from all samples so that the sum of frequencies in each sample is equal to sampling-depth.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be rarefied.[required]
Parameters¶
- sampling_depth:
Int
%
Range
(1, None)
The total frequency that each sample should be rarefied to. Samples where the sum of frequencies is less than the sampling depth will be not be included in the resulting table.[required]
- with_replacement:
Bool
Rarefy with replacement by sampling from the multinomial distribution instead of rarefying without replacement.[default:
False
]
Outputs¶
- rarefied_table:
FeatureTable[Frequency]
The resulting rarefied feature table.[required]
feature-table subsample-ids¶
Randomly pick samples or features, without replacement, from the table.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be sampled.[required]
Parameters¶
- subsampling_depth:
Int
%
Range
(1, None)
The total number of samples or features to be randomly sampled. Samples or features that are reduced to a zero sum will not be included in the resulting table.[required]
- axis:
Str
%
Choices
('sample', 'feature')
The axis to sample over. If "sample" then samples will be randomly selected to be retained. If "feature" then a random set of features will be selected to be retained.[required]
Outputs¶
- sampled_table:
FeatureTable[Frequency]
The resulting subsampled feature table.[required]
feature-table presence-absence¶
Convert frequencies to binary values indicating presence or absence of a feature in a sample.
Inputs¶
- table:
FeatureTable[Frequency | RelativeFrequency]
The feature table to be converted into presence/absence abundances.[required]
Outputs¶
- presence_absence_table:
FeatureTable[PresenceAbsence]
The resulting presence/absence feature table.[required]
feature-table relative-frequency¶
Convert frequencies to relative frequencies by dividing each frequency in a sample by the sum of frequencies in that sample.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to be converted into relative frequencies.[required]
Outputs¶
- relative_frequency_table:
FeatureTable[RelativeFrequency]
The resulting relative frequency feature table.[required]
feature-table transpose¶
Transpose the rows and columns (typically samples and features) of a feature table.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table to be transposed.[required]
Outputs¶
- transposed_feature_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting transposed feature table.[required]
feature-table group¶
Group samples or features in a feature table using metadata to define the mapping of IDs to a group.
Inputs¶
- table:
FeatureTable[Frequency]
The table to group samples or features on.[required]
Parameters¶
- axis:
Str
%
Choices
('feature', 'sample')
Along which axis to group. Each ID in the given axis must exist in
metadata
.[required]- metadata:
MetadataColumn
[
Categorical
]
A column defining the groups. Each unique value will become a new ID for the table on the given
axis
.[required]- mode:
Str
%
Choices
('mean-ceiling', 'median-ceiling', 'sum')
How to combine samples or features within a group.
sum
will sum the frequencies across all samples or features within a group;mean-ceiling
will take the ceiling of the mean of these frequencies;median-ceiling
will take the ceiling of the median of these frequencies.[required]
Outputs¶
- grouped_table:
FeatureTable[Frequency]
A table that has been grouped along the given
axis
. IDs on that axis are replaced by values in themetadata
column.[required]
Examples¶
group_samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
# Combine samples from the same body-site into single sample. Feature
# frequencies will be the median across the samples being combined, rounded
# up to the nearest whole number.
qiime feature-table group \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--m-metadata-column body-site \
--p-mode median-ceiling \
--p-axis sample \
--o-grouped-table body-site-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
body_site_mdc = sample_metadata_md.get_column('body-site')
# Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
body_site_table, = feature_table_actions.group(
table=feature_table,
metadata=body_site_mdc,
mode='median-ceiling',
axis='sample',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /group /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /group /1 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
- Using the
qiime2 feature-table group
tool: - Set "table" to
#: feature-table.qza
- Set "axis" to
sample
- For "metadata":
- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Set "Column Name" to
body-site
- Leave as
- Set "mode" to
median-ceiling
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table group [...] : grouped_table.qza
body-site-table.qza
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/group/1/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
body_site_mdc <- sample_metadata_md$get_column('body-site')
# Combine samples from the same body-site into single sample. Feature frequencies will be the median across the samples being combined, rounded up to the nearest whole number.
action_results <- feature_table_actions$group(
table=feature_table,
metadata=body_site_mdc,
mode='median-ceiling',
axis='sample',
)
body_site_table <- action_results$grouped_table
from q2_feature_table._examples import feature_table_group_samples
feature_table_group_samples(use)
feature-table merge¶
Combines feature tables using the overlap_method
provided.
Inputs¶
- tables:
List
[
FeatureTable[Frequency]
|
FeatureTable[RelativeFrequency]
|
FeatureTable[PresenceAbsence]
]
The collection of feature tables to be merged.[required]
Parameters¶
- overlap_method:
Str
%
Choices
('average', 'error_on_overlapping_feature', 'error_on_overlapping_sample', 'sum')
|
Str
%
Choices
('average', 'error_on_overlapping_feature', 'error_on_overlapping_sample')
|
Str
%
Choices
('error_on_overlapping_feature', 'error_on_overlapping_sample', 'union')
Method for handling overlapping ids.[default:
'error_on_overlapping_sample'
]
Outputs¶
- merged_table:
FeatureTable[Frequency]
|
FeatureTable[RelativeFrequency]
|
FeatureTable[PresenceAbsence]
The resulting merged feature table.[required]
Examples¶
feature_table_merge_two_tables¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
qiime feature-table merge \
--i-tables feature-table1.qza feature-table2.qza \
--o-merged-table merged-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
merged_table, = feature_table_actions.merge(
tables=[feature_table1, feature_table2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /1 /feature -table1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /1 /feature -table2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge
tool: - For "tables", use ctrl-(or command)-click to select the following inputs:
#: feature-table1.qza
#: feature-table2.qza
- Press the
Execute
button.
- For "tables", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/1/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge(
tables=list(feature_table1, feature_table2),
)
merged_table <- action_results$merged_table
from q2_feature_table._examples import feature_table_merge_two_tables
feature_table_merge_two_tables(use)
feature_table_merge_three_tables¶
wget -O 'feature-table1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
wget -O 'feature-table2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
wget -O 'feature-table3.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
qiime feature-table merge \
--i-tables feature-table1.qza feature-table2.qza feature-table3.qza \
--p-overlap-method sum \
--o-merged-table merged-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
fn = 'feature-table1.qza'
request.urlretrieve(url, fn)
feature_table1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
fn = 'feature-table2.qza'
request.urlretrieve(url, fn)
feature_table2 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
fn = 'feature-table3.qza'
request.urlretrieve(url, fn)
feature_table3 = Artifact.load(fn)
merged_table, = feature_table_actions.merge(
tables=[feature_table1, feature_table2, feature_table3],
overlap_method='sum',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table3.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge /2 /feature -table3 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge
tool: - For "tables", use ctrl-(or command)-click to select the following inputs:
#: feature-table1.qza
#: feature-table2.qza
#: feature-table3.qza
- Expand the
additional options
section- Set "overlap_method" to
sum
- Set "overlap_method" to
- Press the
Execute
button.
- For "tables", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table1.qza'
fn <- 'feature-table1.qza'
request$urlretrieve(url, fn)
feature_table1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table2.qza'
fn <- 'feature-table2.qza'
request$urlretrieve(url, fn)
feature_table2 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge/2/feature-table3.qza'
fn <- 'feature-table3.qza'
request$urlretrieve(url, fn)
feature_table3 <- Artifact$load(fn)
action_results <- feature_table_actions$merge(
tables=list(feature_table1, feature_table2, feature_table3),
overlap_method='sum',
)
merged_table <- action_results$merged_table
from q2_feature_table._examples import feature_table_merge_three_tables
feature_table_merge_three_tables(use)
feature-table merge-seqs¶
Combines feature data objects which may or may not contain data for the same features. If different feature data is present for the same feature id in the inputs, the data from the first will be propagated to the result.
Inputs¶
- data:
List
[
FeatureData[Sequence]
]
The collection of feature sequences to be merged.[required]
Outputs¶
- merged_data:
FeatureData[Sequence]
The resulting collection of feature sequences containing all feature sequences provided.[required]
Examples¶
feature_table_merge_seqs¶
wget -O 'seqs1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
wget -O 'seqs2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
qiime feature-table merge-seqs \
--i-data seqs1.qza seqs2.qza \
--o-merged-data merged-data.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
fn = 'seqs1.qza'
request.urlretrieve(url, fn)
seqs1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
fn = 'seqs2.qza'
request.urlretrieve(url, fn)
seqs2 = Artifact.load(fn)
merged_data, = feature_table_actions.merge_seqs(
data=[seqs1, seqs2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
seqs1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -seqs /1 /seqs1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
seqs2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -seqs /1 /seqs2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge-seqs
tool: - For "data", use ctrl-(or command)-click to select the following inputs:
#: seqs1.qza
#: seqs2.qza
- Press the
Execute
button.
- For "data", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs1.qza'
fn <- 'seqs1.qza'
request$urlretrieve(url, fn)
seqs1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-seqs/1/seqs2.qza'
fn <- 'seqs2.qza'
request$urlretrieve(url, fn)
seqs2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge_seqs(
data=list(seqs1, seqs2),
)
merged_data <- action_results$merged_data
from q2_feature_table._examples import feature_table_merge_seqs
feature_table_merge_seqs(use)
feature-table merge-taxa¶
Combines a pair of feature data objects which may or may not contain data for the same features. If different feature data is present for the same feature id in the inputs, the data from the first will be propagated to the result.
Inputs¶
- data:
List
[
FeatureData[Taxonomy]
]
The collection of feature taxonomies to be merged.[required]
Outputs¶
- merged_data:
FeatureData[Taxonomy]
The resulting collection of feature taxonomies containing all feature taxonomies provided.[required]
Examples¶
feature_table_merge_taxa¶
wget -O 'tax1.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
wget -O 'tax2.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
qiime feature-table merge-taxa \
--i-data tax1.qza tax2.qza \
--o-merged-data merged-data.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
fn = 'tax1.qza'
request.urlretrieve(url, fn)
tax1 = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
fn = 'tax2.qza'
request.urlretrieve(url, fn)
tax2 = Artifact.load(fn)
merged_data, = feature_table_actions.merge_taxa(
data=[tax1, tax2],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
tax1.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -taxa /1 /tax1 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
tax2.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /merge -taxa /1 /tax2 .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table merge-taxa
tool: - For "data", use ctrl-(or command)-click to select the following inputs:
#: tax1.qza
#: tax2.qza
- Press the
Execute
button.
- For "data", use ctrl-(or command)-click to select the following inputs:
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax1.qza'
fn <- 'tax1.qza'
request$urlretrieve(url, fn)
tax1 <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/merge-taxa/1/tax2.qza'
fn <- 'tax2.qza'
request$urlretrieve(url, fn)
tax2 <- Artifact$load(fn)
action_results <- feature_table_actions$merge_taxa(
data=list(tax1, tax2),
)
merged_data <- action_results$merged_data
from q2_feature_table._examples import feature_table_merge_taxa
feature_table_merge_taxa(use)
feature-table rename-ids¶
Renames the sample or feature ids in a feature table using metadata to define the new ids.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The table to be renamed[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
A metadata column defining the new ids. Each original id must map to a new unique id. If strict mode is used, then every id in the original table must have a new id.[required]
- axis:
Str
%
Choices
('feature', 'sample')
Along which axis to rename the ids.[default:
'sample'
]- strict:
Bool
Whether the naming needs to be strict (each id in the table must have a new id). Otherwise, only the ids described in
metadata
will be renamed and the others will keep their original id names.[default:False
]
Outputs¶
- renamed_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
A table which has new ids, where the ids are replaced by values in the
metadata
column.[required]
feature-table filter-samples¶
Filter samples from table based on frequency and/or metadata. Any features with a frequency of zero after sample filtering will also be removed. See the filtering tutorial on https://
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table from which samples should be filtered.[required]
Parameters¶
- min_frequency:
Int
The minimum total frequency that a sample must have to be retained.[default:
0
]- max_frequency:
Int
The maximum total frequency that a sample can have to be retained. If no value is provided this will default to infinity (i.e., no maximum frequency filter will be applied).[optional]
- min_features:
Int
The minimum number of features that a sample must have to be retained.[default:
0
]- max_features:
Int
The maximum number of features that a sample can have to be retained. If no value is provided this will default to infinity (i.e., no maximum feature filter will be applied).[optional]
- metadata:
Metadata
Sample metadata used with
where
parameter when selecting samples to retain, or withexclude_ids
when selecting samples to discard.[optional]- where:
Str
SQLite WHERE clause specifying sample metadata criteria that must be met to be included in the filtered feature table. If not provided, all samples in
metadata
that are also in the feature table will be retained.[optional]- exclude_ids:
Bool
If true, the samples selected by
metadata
orwhere
parameters will be excluded from the filtered table instead of being retained.[default:False
]- filter_empty_features:
Bool
If true, features which are not present in any retained samples are dropped.[default:
True
]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting feature table filtered by sample.[required]
Examples¶
filter_to_subject1¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /1 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/1/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1
feature_table_filter_samples_to_subject1(use)
filter_to_skin¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[body-site] IN ("left palm", "right palm")' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site] IN ("left palm", "right palm")',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /2 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /2 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[body-site] IN ("left palm", "right palm")
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/2/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site] IN ("left palm", "right palm")',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_skin
feature_table_filter_samples_to_skin(use)
filter_to_subject1_gut¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1" AND [body-site]="gut"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND [body-site]="gut"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /3 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /3 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1" AND [body-site]="gut"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/3/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND [body-site]="gut"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1_gut
feature_table_filter_samples_to_subject1_gut(use)
filter_to_gut_or_abx¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[body-site]="gut" OR [reported-antibiotic-usage]="Yes"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site]="gut" OR [reported-antibiotic-usage]="Yes"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /4 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /4 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[body-site]="gut" OR [reported-antibiotic-usage]="Yes"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/4/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[body-site]="gut" OR [reported-antibiotic-usage]="Yes"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_gut_or_abx
feature_table_filter_samples_to_gut_or_abx(use)
filter_to_subject1_not_gut¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
wget -O 'sample-metadata.tsv' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--m-metadata-file sample-metadata.tsv \
--p-where '[subject]="subject-1" AND NOT [body-site]="gut"' \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND NOT [body-site]="gut"',
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /5 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
sample-metadata.tsv
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /5 /sample -metadata .tsv - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- For "metadata":
- Press the
+ Insert metadata
button to set up the next steps.- Leave as
Metadata from TSV
- Set "Metadata Source" to
sample-metadata.tsv
- Leave as
- Press the
- Set "where" to
[subject]="subject-1" AND NOT [body-site]="gut"
- For "metadata":
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/5/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
metadata=sample_metadata_md,
where='[subject]="subject-1" AND NOT [body-site]="gut"',
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_to_subject1_not_gut
feature_table_filter_samples_to_subject1_not_gut(use)
filter_min_features¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--p-min-features 10 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
min_features=10,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /6 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_features" to
10
- Set "min_features" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/6/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
min_features=10L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_min_features
feature_table_filter_samples_min_features(use)
filter_min_frequency¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
qiime feature-table filter-samples \
--i-table feature-table.qza \
--p-min-frequency 1500 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_samples(
table=feature_table,
min_frequency=1500,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -samples /7 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-samples
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_frequency" to
1500
- Set "min_frequency" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-samples/7/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_samples(
table=feature_table,
min_frequency=1500L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_samples_min_frequency
feature_table_filter_samples_min_frequency(use)
feature-table filter-features-conditionally¶
Filter features based on the relative abundance in a certain portion of samples (i.e., features must have a relative abundance of at least abundance
in at least prevalence
number of samples). Any samples with a frequency of zero after feature filtering will also be removed.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The feature table from which features should be filtered.[required]
Parameters¶
- abundance:
Float
%
Range
(0, 1)
The minimum relative abundance for a feature to be retained.[required]
- prevalence:
Float
%
Range
(0, 1)
The minimum portion of samples that a feature must have a relative abundance of at least
abundance
to be retained.[required]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The resulting feature table filtered by feature.[required]
Examples¶
feature_table_filter_features_conditionally¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
# Retain only features with at least 1%% abundance in at least 34%% of
# samples.
qiime feature-table filter-features-conditionally \
--i-table feature-table.qza \
--p-abundance 0.01 \
--p-prevalence 0.34 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
# Retain only features with at least 1%% abundance in at least 34%% of samples.
filtered_table, = feature_table_actions.filter_features_conditionally(
table=feature_table,
abundance=0.01,
prevalence=0.34,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -features -conditionally /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
Retain only features with at least 1%% abundance in at least 34%% of samples.
- Using the
qiime2 feature-table filter-features-conditionally
tool: - Set "table" to
#: feature-table.qza
- Set "abundance" to
0.01
- Set "prevalence" to
0.34
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features-conditionally/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
# Retain only features with at least 1%% abundance in at least 34%% of samples.
action_results <- feature_table_actions$filter_features_conditionally(
table=feature_table,
abundance=0.01,
prevalence=0.34,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_features_conditionally
feature_table_filter_features_conditionally(use)
feature-table filter-features¶
Filter features from table based on frequency and/or metadata. Any samples with a frequency of zero after feature filtering will also be removed. See the filtering tutorial on https://
Inputs¶
- table:
FeatureTable[Frequency]
The feature table from which features should be filtered.[required]
Parameters¶
- min_frequency:
Int
The minimum total frequency that a feature must have to be retained.[default:
0
]- max_frequency:
Int
The maximum total frequency that a feature can have to be retained. If no value is provided this will default to infinity (i.e., no maximum frequency filter will be applied).[optional]
- min_samples:
Int
The minimum number of samples that a feature must be observed in to be retained.[default:
0
]- max_samples:
Int
The maximum number of samples that a feature can be observed in to be retained. If no value is provided this will default to infinity (i.e., no maximum sample filter will be applied).[optional]
- metadata:
Metadata
Feature metadata used with
where
parameter when selecting features to retain, or withexclude_ids
when selecting features to discard.[optional]- where:
Str
SQLite WHERE clause specifying feature metadata criteria that must be met to be included in the filtered feature table. If not provided, all features in
metadata
that are also in the feature table will be retained.[optional]- exclude_ids:
Bool
If true, the features selected by
metadata
orwhere
parameters will be excluded from the filtered table instead of being retained.[default:False
]- filter_empty_samples:
Bool
If true, drop any samples where none of the retained features are present.[default:
True
]- allow_empty_table:
Bool
If true, the filtered table may be empty. Default behavior is to raise an error if the filtered table is empty.[default:
False
]
Outputs¶
- filtered_table:
FeatureTable[Frequency]
The resulting feature table filtered by feature.[required]
Examples¶
filter_features_min_samples¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
qiime feature-table filter-features \
--i-table feature-table.qza \
--p-min-samples 2 \
--o-filtered-table filtered-table.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
filtered_table, = feature_table_actions.filter_features(
table=feature_table,
min_samples=2,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /filter -features /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table filter-features
tool: - Set "table" to
#: feature-table.qza
- Expand the
additional options
section- Set "min_samples" to
2
- Set "min_samples" to
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/filter-features/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$filter_features(
table=feature_table,
min_samples=2L,
)
filtered_table <- action_results$filtered_table
from q2_feature_table._examples import feature_table_filter_features_min_samples
feature_table_filter_features_min_samples(use)
feature-table filter-seqs¶
Filter features from sequences based on a feature table or metadata. See the filtering tutorial on https://
Inputs¶
- data:
FeatureData[Sequence¹ | AlignedSequence²]
The sequences from which features should be filtered.[required]
- table:
FeatureTable[Frequency]
Table containing feature ids used for id-based filtering.[optional]
Parameters¶
- metadata:
Metadata
Feature metadata used for id-based filtering, with
where
parameter when selecting features to retain, or withexclude_ids
when selecting features to discard.[optional]- where:
Str
SQLite WHERE clause specifying feature metadata criteria that must be met to be included in the filtered feature table. If not provided, all features in
metadata
that are also in the sequences will be retained.[optional]- exclude_ids:
Bool
If true, the features selected by the
metadata
(with or without thewhere
parameter) ortable
parameter will be excluded from the filtered sequences instead of being retained.[default:False
]
Outputs¶
- filtered_data:
FeatureData[Sequence¹ | AlignedSequence²]
The resulting filtered sequences.[required]
feature-table split¶
Splits one feature table into many feature tables, where splits are defined by values in metadata column.
Inputs¶
- table:
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
The table to split.[required]
Parameters¶
- metadata:
MetadataColumn
[
Categorical
]
A column defining the groups. Each unique value will define a split feature table.[required]
- filter_empty_features:
Bool
If true, features which are not present in a split feature table are dropped.[default:
True
]
Outputs¶
- tables:
Collection
[
FeatureTable[Frequency¹ | RelativeFrequency² | PresenceAbsence³ | Composition⁴]
]
Directory where feature tables split based on metadata values should be written.[required]
feature-table tabulate-feature-frequencies¶
Tabulate sample count and total frequency per feature.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence | RelativeFrequency]
The input feature table.[required]
Outputs¶
- feature_frequencies:
ImmutableMetadata
Per-sample and total frequencies per feature.[required]
Examples¶
feature_table_tabulate_feature_frequencies¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
qiime feature-table tabulate-feature-frequencies \
--i-table feature-table.qza \
--o-feature-frequencies feature-frequencies.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
feature_frequencies, = feature_table_actions.tabulate_feature_frequencies(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -feature -frequencies /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-feature-frequencies
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-feature-frequencies/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_feature_frequencies(
table=feature_table,
)
feature_frequencies <- action_results$feature_frequencies
from q2_feature_table._examples import feature_table_tabulate_feature_freqs
feature_table_tabulate_feature_freqs(use)
feature-table tabulate-sample-frequencies¶
Tabulate feature count and total frequency per sample.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence | RelativeFrequency]
The input feature table.[required]
Outputs¶
- sample_frequencies:
ImmutableMetadata
Observed feature count and total frequencies per sample.[required]
Examples¶
feature_table_tabulate_sample_frequencies¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
qiime feature-table tabulate-sample-frequencies \
--i-table feature-table.qza \
--o-sample-frequencies sample-frequencies.qza
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
sample_frequencies, = feature_table_actions.tabulate_sample_frequencies(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -sample -frequencies /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-sample-frequencies
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-sample-frequencies/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_sample_frequencies(
table=feature_table,
)
sample_frequencies <- action_results$sample_frequencies
from q2_feature_table._examples import feature_table_tabulate_sample_freqs
feature_table_tabulate_sample_freqs(use)
feature-table summarize¶
Generate visual and tabular summaries of a feature table.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence]
The feature table to be summarized.[required]
Parameters¶
- sample_metadata:
Metadata
The sample metadata.[optional]
Outputs¶
- visualization:
Visualization
<no description>[required]
Examples¶
feature_table_summarize¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
qiime feature-table summarize \
--i-table feature-table.qza \
--o-visualization table.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
table_viz, = feature_table_actions.summarize(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /summarize /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table summarize
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table summarize [...] : visualization.qzv
table.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$summarize(
table=feature_table,
)
table_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_summarize
feature_table_summarize(use)
feature-table tabulate-seqs¶
Generate tabular view of feature identifier to sequence mapping, including links to BLAST each sequence against the NCBI nt database.
Citations¶
Coordinators, 2017; Johnson et al., 2008
Inputs¶
- data:
FeatureData[Sequence | AlignedSequence]
The feature sequences to be tabulated.[required]
- taxonomy:
Collection
[
FeatureData[Taxonomy]
]
The taxonomic classifications of the tabulated features.[optional]
Parameters¶
- metadata:
Metadata
Any additional metadata for the tabulated features.[optional]
- merge_method:
Str
%
Choices
('strict', 'union', 'intersect')
Method that joins data sets[default:
'strict'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
Examples¶
feature_table_tabulate_seqs¶
wget -O 'rep-seqs.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs.qza \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
fn = 'rep-seqs.qza'
request.urlretrieve(url, fn)
rep_seqs = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /1 /rep -seqs .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs.qza
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/1/rep-seqs.qza'
fn <- 'rep-seqs.qza'
request$urlretrieve(url, fn)
rep_seqs <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs,
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs
feature_table_tabulate_seqs(use)
feature_table_tabulate_seqs_single_taxon¶
wget -O 'rep-seqs-single-taxon.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
wget -O 'single-taxonomy.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs-single-taxon.qza \
--i-taxonomy single-taxonomy.qza \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
fn = 'rep-seqs-single-taxon.qza'
request.urlretrieve(url, fn)
rep_seqs_single_taxon = Artifact.load(fn)
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
fn = 'single-taxonomy.qza'
request.urlretrieve(url, fn)
single_taxonomy = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs_single_taxon,
taxonomy=[single_taxonomy],
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs-single-taxon.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /2 /rep -seqs -single -taxon .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
single-taxonomy.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /2 /single -taxonomy .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs-single-taxon.qza
- Expand the
additional options
section- Set "taxonomy" to
#: ['single-taxonomy.qza']
- Set "taxonomy" to
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/rep-seqs-single-taxon.qza'
fn <- 'rep-seqs-single-taxon.qza'
request$urlretrieve(url, fn)
rep_seqs_single_taxon <- Artifact$load(fn)
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/2/single-taxonomy.qza'
fn <- 'single-taxonomy.qza'
request$urlretrieve(url, fn)
single_taxonomy <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs_single_taxon,
taxonomy=list(single_taxonomy),
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs_single_taxon
feature_table_tabulate_seqs_single_taxon(use)
feature_table_tabulate_seqs_multi_taxon¶
wget -O 'rep-seqs-multi-taxon.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
qiime feature-table tabulate-seqs \
--i-data rep-seqs-multi-taxon.qza \
--i-taxonomy multi-taxonomy/ \
--o-visualization rep-seqs.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
fn = 'rep-seqs-multi-taxon.qza'
request.urlretrieve(url, fn)
rep_seqs_multi_taxon = Artifact.load(fn)
rep_seqs_viz, = feature_table_actions.tabulate_seqs(
data=rep_seqs_multi_taxon,
taxonomy=multi_taxonomy_artifact_collection,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
rep-seqs-multi-taxon.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /tabulate -seqs /3 /rep -seqs -multi -taxon .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table tabulate-seqs
tool: - Set "data" to
#: rep-seqs-multi-taxon.qza
- Expand the
additional options
section- Set "taxonomy" to
#: multi-taxonomy/
- Set "taxonomy" to
- Press the
Execute
button.
- Set "data" to
- Once completed, for the new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table tabulate-seqs [...] : visualization.qzv
rep-seqs.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/tabulate-seqs/3/rep-seqs-multi-taxon.qza'
fn <- 'rep-seqs-multi-taxon.qza'
request$urlretrieve(url, fn)
rep_seqs_multi_taxon <- Artifact$load(fn)
action_results <- feature_table_actions$tabulate_seqs(
data=rep_seqs_multi_taxon,
taxonomy=multi_taxonomy_artifact_collection,
)
rep_seqs_viz <- action_results$visualization
from q2_feature_table._examples import feature_table_tabulate_seqs_multi_taxon
feature_table_tabulate_seqs_multi_taxon(use)
feature-table core-features¶
Identify "core" features, which are features observed in a user-defined fraction of the samples. Since the core features are a function of the fraction of samples that the feature must be observed in to be considered core, this is computed over a range of fractions defined by the min_fraction
, max_fraction
, and steps
parameters.
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to use in core features calculations.[required]
Parameters¶
- min_fraction:
Float
%
Range
(0.0, 1.0, inclusive_start=False)
The minimum fraction of samples that a feature must be observed in for that feature to be considered a core feature.[default:
0.5
]- max_fraction:
Float
%
Range
(0.0, 1.0, inclusive_end=True)
The maximum fraction of samples that a feature must be observed in for that feature to be considered a core feature.[default:
1.0
]- steps:
Int
%
Range
(2, None)
The number of steps to take between
min_fraction
andmax_fraction
for core features calculations. This parameter has no effect ifmin_fraction
andmax_fraction
are the same value.[default:11
]
Outputs¶
- visualization:
Visualization
<no description>[required]
feature-table heatmap¶
Generate a heatmap representation of a feature table with optional clustering on both the sample and feature axes.
Tip: To generate a heatmap containing taxonomic annotations, use qiime taxa collapse
to collapse the feature table at the desired taxonomic level.
Citations¶
Inputs¶
- table:
FeatureTable[Frequency]
The feature table to visualize.[required]
Parameters¶
- sample_metadata:
MetadataColumn
[
Categorical
]
Annotate the sample IDs with these sample metadata values. When metadata is present and
cluster
='feature', samples will be sorted by the metadata values.[optional]- feature_metadata:
MetadataColumn
[
Categorical
]
Annotate the feature IDs with these feature metadata values. When metadata is present and
cluster
='sample', features will be sorted by the metadata values.[optional]- normalize:
Bool
Normalize the feature table by adding a psuedocount of 1 and then taking the log10 of the table.[default:
True
]- title:
Str
Optional custom plot title.[optional]
- metric:
Str
%
Choices
('braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule')
Metrics exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'euclidean'
]- method:
Str
%
Choices
('average', 'centroid', 'complete', 'median', 'single', 'ward', 'weighted')
Clustering methods exposed by seaborn (see http://
seaborn .pydata .org /generated /seaborn .clustermap .html #seaborn .clustermap for more detail).[default: 'average'
]- cluster:
Str
%
Choices
('both', 'features', 'none', 'samples')
Specify which axes to cluster.[default:
'both'
]- color_scheme:
Str
%
Choices
('Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Vega10', 'Vega10_r', 'Vega20', 'Vega20_r', 'Vega20b', 'Vega20b_r', 'Vega20c', 'Vega20c_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma', 'magma_r', 'mako', 'mako_r', 'nipy_spectral', 'nipy_spectral_r', 'ocean', 'ocean_r', 'pink', 'pink_r', 'plasma', 'plasma_r', 'prism', 'prism_r', 'rainbow', 'rainbow_r', 'rocket', 'rocket_r', 'seismic', 'seismic_r', 'spectral', 'spectral_r', 'spring', 'spring_r', 'summer', 'summer_r', 'tab10', 'tab10_r', 'tab20', 'tab20_r', 'tab20b', 'tab20b_r', 'tab20c', 'tab20c_r', 'terrain', 'terrain_r', 'viridis', 'viridis_r', 'vlag', 'vlag_r', 'winter', 'winter_r')
The matplotlib colorscheme to generate the heatmap with.[default:
'rocket'
]
Outputs¶
- visualization:
Visualization
<no description>[required]
feature-table summarize-plus¶
Generate visual and tabular summaries of a feature table. Tabulate sample and feature frequencies.
Inputs¶
- table:
FeatureTable[Frequency | PresenceAbsence]
The feature table to be summarized.[required]
Parameters¶
- metadata:
Metadata
The sample metadata.[optional]
Outputs¶
- feature_frequencies:
ImmutableMetadata
Per-sample and total frequencies per feature.[required]
- sample_frequencies:
ImmutableMetadata
Observed feature count and total frequencies per sample.[required]
- summary:
Visualization
Visual summary of feature table[required]
Examples¶
feature_table_summarize_plus¶
wget -O 'feature-table.qza' \
'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
qiime feature-table summarize-plus \
--i-table feature-table.qza \
--o-feature-frequencies feature-frequencies.qza \
--o-sample-frequencies sample-frequencies.qza \
--o-summary visual summary.qzv
from qiime2 import Artifact
from urllib import request
import qiime2.plugins.feature_table.actions as feature_table_actions
url = 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
feature_frequencies, sample_frequencies, visual_summary_viz = feature_table_actions.summarize_plus(
table=feature_table,
)
- Using the
Upload Data
tool: - On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.- Set "Name" (first text-field) to:
feature-table.qza
- In the larger text-area, copy-and-paste: https://
amplicon -docs .qiime2 .org /en /latest /data /examples /feature -table /summarize -plus /1 /feature -table .qza - ("Type", "Genome", and "Settings" can be ignored)
- Set "Name" (first text-field) to:
- Press the
Start
button at the bottom.
- On the first tab (Regular), press the
- Using the
qiime2 feature-table summarize-plus
tool: - Set "table" to
#: feature-table.qza
- Press the
Execute
button.
- Set "table" to
- Once completed, for each new entry in your history, use the
Edit
button to set the name as follows: - (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name "Name" to set (be sure to press [Save]) #: qiime2 feature-table summarize-plus [...] : feature_frequencies.qza
feature-frequencies.qza
#: qiime2 feature-table summarize-plus [...] : sample_frequencies.qza
sample-frequencies.qza
#: qiime2 feature-table summarize-plus [...] : summary.qzv
visual summary.qzv
library(reticulate)
Artifact <- import("qiime2")$Artifact
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
request <- import("urllib")$request
url <- 'https://amplicon-docs.qiime2.org/en/latest/data/examples/feature-table/summarize-plus/1/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
action_results <- feature_table_actions$summarize_plus(
table=feature_table,
)
feature_frequencies <- action_results$feature_frequencies
sample_frequencies <- action_results$sample_frequencies
visual_summary_viz <- action_results$summary
from q2_feature_table._examples import feature_table_summarize_plus
feature_table_summarize_plus(use)
- Links
- Documentation
- Source Code
- Stars
- 2
- Last Commit
- 0ed9a00
- Available Distros
- 2024.10
- 2024.10/amplicon
- 2024.10/metagenome
- 2024.10/pathogenome
- 2024.5
- 2024.5/amplicon
- 2024.5/metagenome
- 2024.2
- 2024.2/amplicon
- 2023.9
- 2023.9/amplicon
- 2023.7
- 2023.7/core