Skip to content

Commit

Permalink
MAINT: restore bulk methods through qiime2 independent method
Browse files Browse the repository at this point in the history
  • Loading branch information
wasade committed Oct 1, 2024
1 parent 2aad1bd commit 1f50cec
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 1 deletion.
90 changes: 90 additions & 0 deletions q2_gg2/_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import click
import qiime2
import pandas as pd
from q2_types.tree import NewickFormat
from q2_types.feature_data import DNAFASTAFormat
from ._methods import (
bulk_sequence_v4_asv_assessment as _bulk_sequence_v4_asv_assessment,
)
from ._methods import bulk_clade_v4_asv_assessment as _bulk_clade_v4_asv_assessment
from ._methods import clade_lookup as _clade_lookup


@click.group()
def cli():
pass


@cli.command()
@click.option("--i-taxonomy-as-tree", type=click.Path(exists=True), required=True)
@click.option("--p-output-filename", type=click.Path(exists=False), required=True)
@click.option("--p-version", type=str, required=True)
def clade_lookup(i_taxonomy_as_tree, p_output_filename, p_version):
taxonomy_as_tree = qiime2.Artifact.load(i_taxonomy_as_tree).view(NewickFormat)
_clade_lookup(taxonomy_as_tree, p_version, p_output_filename)


@cli.command()
@click.option("--i-phylogeny", type=click.Path(exists=True), required=True)
@click.option("--i-taxa", type=click.Path(exists=True), required=True)
@click.option("--i-full-length-v4", type=click.Path(exists=True), required=True)
@click.option("--i-sequences", type=click.Path(exists=True), required=True)
@click.option("--p-group", type=int, required=True)
@click.option("--p-output-filename", type=click.Path(exists=False), required=True)
@click.option("--p-version", type=str, required=True)
def bulk_clade_v4_asv_assessment(
i_phylogeny,
i_taxa,
i_full_length_v4,
i_sequences,
p_group,
p_output_filename,
p_version,
):
phylogeny = qiime2.Artifact.load(i_phylogeny).view(NewickFormat)
taxa = qiime2.Artifact.load(i_taxa).view(pd.DataFrame)
full_length_v4 = qiime2.Artifact.load(i_full_length_v4).view(DNAFASTAFormat)
sequences = qiime2.Artifact.load(i_sequences).view(DNAFASTAFormat)
_bulk_clade_v4_asv_assessment(
phylogeny,
taxa,
full_length_v4,
sequences,
p_version,
p_group,
p_output_filename,
)


@cli.command()
@click.option("--i-phylogeny", type=click.Path(exists=True), required=True)
@click.option("--i-taxa", type=click.Path(exists=True), required=True)
@click.option("--i-full-length-v4", type=click.Path(exists=True), required=True)
@click.option("--i-sequences", type=click.Path(exists=True), required=True)
@click.option("--o-characterization", type=click.Path(exists=False), required=True)
@click.option("--p-group", type=int, required=True)
@click.option("--p-output-filename", type=click.Path(exists=False), required=True)
@click.option("--p-version", type=str, required=True)
def bulk_sequence_v4_asv_assessment(
i_phylogeny,
i_taxa,
i_full_length_v4,
i_sequences,
o_characterization,
p_group,
p_output_filename,
p_version,
):
phylogeny = qiime2.Artifact.load(i_phylogeny).view(NewickFormat)
taxa = qiime2.Artifact.load(i_taxa).view(pd.DataFrame)
full_length_v4 = qiime2.Artifact.load(i_full_length_v4).view(DNAFASTAFormat)
sequences = qiime2.Artifact.load(i_sequences).view(DNAFASTAFormat)
_bulk_sequence_v4_asv_assessment(
phylogeny,
taxa,
full_length_v4,
sequences,
p_version,
p_group,
p_output_filename,
)
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
description="Support methods for interaction with Greengenes2",
entry_points={
"qiime2.plugins":
["q2-gg2=q2_gg2.plugin_setup:plugin"]
["q2-gg2=q2_gg2.plugin_setup:plugin"],
"console_scripts": "greengenes2=q2_gg2._cli:cli"
},
package_data={
'q2_gg2.tests': [],
Expand Down

0 comments on commit 1f50cec

Please sign in to comment.