-
Notifications
You must be signed in to change notification settings - Fork 78
/
prepare.py
60 lines (52 loc) · 1.97 KB
/
prepare.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""combine multiple taxonomy databases into one."""
usage="""
sourmash tax prepare --taxonomy-csv <taxonomy_file> [ ... ] -o <output>
The 'tax prepare' command reads in one or more taxonomy databases
and saves them into a new database. It can be used to combine databases
in the desired order, as well as output different database formats.
Please see the 'tax prepare' documentation for more details:
https://sourmash.readthedocs.io/en/latest/command-line.html#sourmash-tax-prepare-prepare-and-or-combine-taxonomy-files
"""
import sourmash
from sourmash.logging import notify, print_results, error
def subparser(subparsers):
subparser = subparsers.add_parser('prepare',
usage=usage)
subparser.add_argument(
'-q', '--quiet', action='store_true',
help='suppress non-error output'
)
subparser.add_argument(
'-t', '--taxonomy-csv', '--taxonomy', metavar='FILE',
nargs="+", required=True,
help='database lineages'
)
subparser.add_argument(
'-o', '--output', required=True,
help='output file',
)
subparser.add_argument(
'-F', '--database-format',
help="format of output file; default is 'sql')",
default='sql',
choices=['csv', 'sql'],
)
subparser.add_argument(
'--keep-full-identifiers', action='store_true',
help='do not split identifiers on whitespace'
)
subparser.add_argument(
'--keep-identifier-versions', action='store_true',
help='after splitting identifiers, do not remove accession versions'
)
subparser.add_argument(
'--fail-on-missing-taxonomy', action='store_true',
help='fail quickly if taxonomy is not available for an identifier',
)
subparser.add_argument(
'-f', '--force', action = 'store_true',
help='continue past errors in file and taxonomy loading',
)
def main(args):
import sourmash
return sourmash.tax.__main__.prepare(args)