-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MRG] add taxonomy subcommand (#1543)
* provide a kind of ridiculous upgrade to lca index to better deal with identifiers/taxonomy * update load_taxonomy_assignments to be more flexible and pay attention to CLI * init structure for taxonomy subcommand * more init * syntax and add tax to init * init tax tests * working tax summarize command * fix main * init tests for new tax_utils * add ascending taxlist * init classify cmd * init tax cli testing * fix filename * change to function for classify threshold * add header * enable single gather result for summarize; mult for classify * add util script to take output of tax and format for krona viz (#1559) * get summarized working for summary and krona output * init test krona output * add write_summary function * get classify working again, both summary and krona output * test write_classification * init classify cli tests * init tests for load_taxonomy_assignments * enable force for getting past duplicated entries in taxonomy csv * handle and test missing taxonomy info * classify: handle, test empty gather results, gather results from csv * split identifiers by default * standardize spacing * comments * init add tax to docs * [MRG] add a function to take multiple sourmash tax summarize csvs and output a single "abundance" df (#1562) * add a function to take multiple sourmash tax summarize csvs and output a single 'abundance' df * add import dep. * rework format_tax_to_frac for easier testing and use; add tests * better name and docstring for agg_sumgather_csvs_by_lineage * init combine command * debugging code to help track down SBT duplicates/loss problem * fix, I think * remove unnecessary code * add test for duplicate signatures in SBT creation * see what happens when you run twice * add missing signatures, oops * initial refactoring that passes many tests * factor filename generation out of actual writing * refactor and cleanup * add more sigs to test, add note of concern L) * fix --append tests, too * refactor out save_exact in favor if save(..., overwrite=True) * fix some storage stuff in the tests * make test less confusing? * Update src/sourmash/sbt_storage.py Co-authored-by: Luiz Irber <[email protected]> * define list_sbts() on base Storage class * properly record duplicate signature names * move threshold arg parsing into cli/utils * init changes for multiquery input * use namedtuple for summarized gather results * init update for mult files * adjust for namedtuple output * mods for namedtuple * upd utils * add --from-file to summarize * working multifile summarize * --from-csv to --from-file * somewhat working classify again * updated classify * finish fixing combine test * make taxonomy_csv required * cleanup * more cleanup * use load_pathlist_from_file * test check_and_load_gather_csvs * properly restrict kwargs with * * allow lineage summary table output from summarize * require rank for krona, lineage summary output formats * add test for lineage summary output with format_lineage * add docstrings * punt cami to separate PR * raise ValueError on empty gather results * move notify * cleanup * remove tax combine; add tax label * verson of load_taxonomy that strictly uses headers * use new tax fn; enable mult taxonomy inputs * init tax docs * add classification status to classify output * add multi db gather test csv * fix typo * whoops, actually fix * handle accession in lineage csv header * fix line width * return available ranks from load_taxonomy_csv * [MRG] add test to confirm failure when summarizing on empty gather (#1560) * added summarize on empty gather.csv test * added empty taxonomy csv test * fix typo * Update test_tax.py * trouble shoot tests * troubleshooting empty gather test * fixed, maybe? (#1596) * trying to pull * cleaned up test_summarize_empty_gather_tax... * cleaned test_summarize_empty_gather * fixed test comments * removed comment * Update tests/test_tax.py Co-authored-by: Tessa Pierce Ward <[email protected]> * Update tests/test_tax.py Co-authored-by: Tessa Pierce Ward <[email protected]> * updated empty-gather test Co-authored-by: Tessa Pierce Ward <[email protected]> Co-authored-by: C. Titus Brown <[email protected]> * init standardize errs * add good valueerror for empty lineage csv file * better catch errs in __main__; test all cmds: empty gather, lineage files * check available ranks, bad gather headers, empty gather, etc * emit one (and only one) warning per 100% match * add all functions to __all__ ...is this desired? * change cli for better arg parsing; add examples to summarize docs * add mixed strain classify example and assoc data * doc formatting * more doc formatting * more tiny reformatting * Apply suggestions from code review Co-authored-by: C. Titus Brown <[email protected]> * add usage info for each subcommand; upd docs * minor cleanup and more informative warning * add checks for duplicated queries, better output for duplicated filenames; label --> annotate * better catch/print for valueerrors; pyflakes fixes * summary --> csv_summary * upd docs * two-sample lineage summary example * rename commands * upd function names too * minor doc upds * use f_unique_to_query * add output dir; add file output notifications * add cols to summary outputs; adjust accordingly * trigger GitHub actions Co-authored-by: C. Titus Brown <[email protected]> Co-authored-by: Taylor Reiter <[email protected]> Co-authored-by: Luiz Irber <[email protected]> Co-authored-by: Hannah Eve Houts <[email protected]>
- Loading branch information
1 parent
c04f137
commit d473199
Showing
21 changed files
with
3,557 additions
and
16 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
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,32 @@ | ||
"""Define the command line interface for sourmash tax | ||
The top level CLI is defined in ../__init__.py. This module defines the CLI for | ||
`sourmash tax` operations. | ||
""" | ||
|
||
from . import metagenome | ||
from . import genome | ||
from . import annotate | ||
from ..utils import command_list | ||
from argparse import SUPPRESS, RawDescriptionHelpFormatter | ||
import os | ||
import sys | ||
|
||
|
||
def subparser(subparsers): | ||
subparser = subparsers.add_parser('tax', formatter_class=RawDescriptionHelpFormatter, usage=SUPPRESS, aliases=['taxonomy']) | ||
desc = 'Operations\n' | ||
clidir = os.path.dirname(__file__) | ||
ops = command_list(clidir) | ||
for subcmd in ops: | ||
docstring = getattr(sys.modules[__name__], subcmd).__doc__ | ||
helpstring = 'sourmash tax {op:s} --help'.format(op=subcmd) | ||
desc += ' {hs:33s} {ds:s}\n'.format(hs=helpstring, ds=docstring) | ||
s = subparser.add_subparsers( | ||
title="Integrate taxonomy information based on 'gather' results", dest='subcmd', metavar='subcmd', help=SUPPRESS, | ||
description=desc | ||
) | ||
for subcmd in ops: | ||
getattr(sys.modules[__name__], subcmd).subparser(s) | ||
subparser._action_groups.reverse() | ||
subparser._optionals.title = 'Options' |
Oops, something went wrong.