Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMP: adds usage example for cluster-features-de-novo #101

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions q2_vsearch/_examples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2023, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------

from qiime2.plugins import ArtifactAPIUsage

rep_seqs_url = \
('https://s3-us-west-2.amazonaws.com/qiime2-data/2024.2/'
'tutorials/chimera/atacama-rep-seqs.qza')

table_url = \
('https://s3-us-west-2.amazonaws.com/qiime2-data/2024.2/'
'tutorials/chimera/atacama-table.qza')

use = ArtifactAPIUsage()


def cluster_features_de_novo(use):
rep_seqs = use.init_artifact_from_url('seqs1', rep_seqs_url)
table = use.init_artifact_from_url('table1', table_url)

perc_identity = 0.97
strand = 'plus'
threads = 1

clustered_table, clustered_sequences = use.action(
use.UsageAction('vsearch', 'cluster_features_de_novo'),
use.UsageInputs(sequences=rep_seqs, table=table,
perc_identity=perc_identity, strand=strand,
threads=threads),
use.UsageOutputNames(clustered_table='clustered_table',
clustered_sequences='clustered_sequences')
)

clustered_table.assert_output_type('FeatureTable[Frequency]')
clustered_sequences.assert_output_type('FeatureData[Sequence]')
5 changes: 4 additions & 1 deletion q2_vsearch/plugin_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import q2_vsearch._merge_pairs
import q2_vsearch._chimera
import q2_vsearch._stats
from q2_vsearch._examples import cluster_features_de_novo

from q2_vsearch._type import UchimeStats
from q2_vsearch._format import UchimeStatsFmt, UchimeStatsDirFmt
Expand Down Expand Up @@ -92,7 +93,9 @@
'were clustered in that sample. Feature identifiers and '
'sequences will be inherited from the centroid feature '
'of each cluster. See the vsearch documentation for details '
'on how sequence clustering is performed.')
'on how sequence clustering is performed.'),
examples={'cluster_features_de_novo':
cluster_features_de_novo}
)

plugin.methods.register_function(
Expand Down
16 changes: 16 additions & 0 deletions q2_vsearch/tests/test_examples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2023, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------

from qiime2.plugin.testing import TestPluginBase


class TestUsageExample(TestPluginBase):
package = 'q2_vsearch.tests'

def test_usage_cluster_features_de_novo(self):
self.execute_examples()
Loading