| 1 |
#!/usr/bin/env python3 |
| 2 |
# Copyright (c) 2014-2016 Genome Research Ltd. |
| 3 |
# |
| 4 |
# This file is part of IVA. |
| 5 |
# |
| 6 |
# IVA is free software: you can redistribute it and/or modify it under |
| 7 |
# the terms of the GNU General Public License as published by the Free Software |
| 8 |
# Foundation; either version 3 of the License, or (at your option) any later |
| 9 |
# version. |
| 10 |
# This program is distributed in the hope that it will be useful, but WITHOUT |
| 11 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 12 |
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 13 |
# details. |
| 14 |
# You should have received a copy of the GNU General Public License along with |
| 15 |
# this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
|
| 17 |
import sys |
| 18 |
import argparse |
| 19 |
import iva |
| 20 |
|
| 21 |
parser = argparse.ArgumentParser( |
| 22 |
usage = '%(prog)s [options] <output directory>', |
| 23 |
) |
| 24 |
|
| 25 |
parser.add_argument('outdir', help='Name of output directory', metavar='Directory_name') |
| 26 |
parser.add_argument('--add_to_ref', action=iva.common.abspathAction, help='Filename of Genbank IDs or GI numbers to be added to database. Format is: whitespace separated list of GI numbers on each line. One line defines one genome (e.g. flu is 8 segments, so put 8 GI numbers on one line for one flu reference)', metavar='Filename') |
| 27 |
parser.add_argument('--skip_viruses', action='store_true', help='Do not run kraken-build --download-library viruses when building the database. If this option used, then --add_to_ref must also be used') |
| 28 |
parser.add_argument('--threads', type=int, help='Number of threads to use [%(default)s]', metavar='INT', default=1) |
| 29 |
parser.add_argument('--minimizer_len', type=int, help='Number to pass to kraken-build minimizer_len option [%(default)s]', default=13, metavar='INT') |
| 30 |
parser.add_argument('--max_db_size', type=int, help='Number to pass to kraken-build max_db_size option [%(default)s]', default=3, metavar='INT') |
| 31 |
parser.add_argument('--verbose', action='store_true', help='Be verbose') |
| 32 |
parser.add_argument('--version', action='version', version=iva.common.version) |
| 33 |
options = parser.parse_args() |
| 34 |
|
| 35 |
iva.external_progs.write_prog_info('iva_qc_make_db', '-') |
| 36 |
|
| 37 |
db = iva.kraken.Database( |
| 38 |
options.outdir, |
| 39 |
extra_refs_file=options.add_to_ref, |
| 40 |
threads=options.threads, |
| 41 |
minimizer_len=options.minimizer_len, |
| 42 |
max_db_size=options.max_db_size, |
| 43 |
verbose=options.verbose, |
| 44 |
skip_virus_download=options.skip_viruses |
| 45 |
) |
| 46 |
|
| 47 |
db.build() |