generated from bokulich-lab/q2-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: add action to build custom Diamond database (#103)
* ENH: Build Diamond DB from fasta action * Added parameter compatibility * Linting corrections * Added parameters and optional input to build_diamond_db * Added example and citations for build_diamond_db * Added compatibility with optional input * Taxonomy typed run enabled * Add test for run with taxon information * Update name action name to build_custom_diamond_db * Refactor TaxonomyNCBI to NCBITaxonomy * remove file entry from citations * remove pdb from eggnog._methods * eggnog._method.py: moving relative imports to end of section * eggnog.tests.test_method.py: reorganize imports * refactor sequences to seqs * Refactoring seqs and method name. further updates * Refactor taxonomy_data to taxonomy * plugin_setup.py: Update `seqs` input description. * plugin_setup.py: update to `taxonomy` input_description * Another update to description on in the function registration * Set default threads to 1 * Another update to parameter description in the function registration * extend command inside * write in/out paths directly in comand * Move the db related code to its own files. New files for dbs New files for dbs in eggnog. Further adjustments. * Adjust paths from imports since change of db related code * set --log always to true * Update q2_moshpit/plugin_setup.py Co-authored-by: Michal Ziemski <mziemski@ethz.ch> --------- Co-authored-by: Michal Ziemski <mziemski@ethz.ch>
- Loading branch information
Showing
9 changed files
with
247 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# ---------------------------------------------------------------------------- | ||
# 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. | ||
# ---------------------------------------------------------------------------- | ||
|
||
url = \ | ||
'https://scop.berkeley.edu/downloads/scopeseq-2.07/astral-scopedom-seqres' | ||
'-gd-sel-gs-bib-40-2.07.fa' | ||
|
||
|
||
def diamond_makedb(use): | ||
fasta_input = use.init_artifact_from_url('sequences', url) | ||
|
||
_ = use.action( | ||
use.UsageAction('moshpit', 'build_custom_diamond_db'), | ||
use.UsageInputs( | ||
seqs=fasta_input, | ||
), | ||
use.UsageOutputNames( | ||
diamond_db='diamond_db', | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# ---------------------------------------------------------------------------- | ||
# Copyright (c) 2022, 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 typing import List | ||
|
||
|
||
def _parse_build_diamond_db_params(arg_key, arg_val) -> List[str]: | ||
"""Creates a list with argument and its value to be consumed by | ||
the `diamond makedb` command. | ||
Args: | ||
arg_key (str): Argument name. | ||
arg_val: Argument value. | ||
Returns: | ||
[converted_arg, arg_value]: List containing a prepared command line | ||
parameter and, optionally, its value. | ||
""" | ||
# Change "_" in arg_key for "-" | ||
arg_key = arg_key.replace("_", "-") | ||
|
||
if isinstance(arg_val, bool): | ||
return [f"--{arg_key}"] | ||
else: | ||
return [f"--{arg_key}", str(arg_val)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters