Esempio n. 1
0
def build_parser(parser):
    parser = add_database_args(parser)

    input_group = parser.add_argument_group(
        "Input options").add_mutually_exclusive_group()

    input_group.add_argument(
        '-t', '--tax-ids',
        dest='taxids',
        metavar='FILE-OR-LIST',
        help="""File containing a whitespace-delimited list of
        tax_ids (ie, separated by tabs, spaces, or newlines; lines
        beginning with "#" are ignored). This option can also be
        passed a comma-delited list of taxids on the command line.""")

    input_group.add_argument(
        '-i', '--seq-info', type=argparse.FileType('r'),
        help="""Read tax_ids from sequence info file, minimally containing the
        field "tax_id" """)

    output_group = parser.add_argument_group(
        "Output options").add_mutually_exclusive_group()

    output_group.add_argument(
        '-o', '--out',
        type=argparse.FileType('w'),
        default=sys.stdout,
        metavar='FILE',
        help="""headerless csv file containing old_id,new_id""")
Esempio n. 2
0
def build_parser(parser):
    parser = add_database_args(parser)

    input_group = parser.add_argument_group('input options')

    input_group.add_argument(
        '-t', '--tax-ids', nargs='+',
        help='one or more space-delimited tax_ids (eg "-t 47770 33945")')

    input_group.add_argument(
        '-f', '--tax-id-file', metavar='FILE', type=argparse.FileType('rt'),
        help=('File containing a whitespace-delimited list of '
              'tax_ids (ie, separated by tabs, spaces, or newlines.'))

    input_group.add_argument(
        '-i', '--seq-info',
        type=argparse.FileType('rt'),
        help=('Read tax_ids from sequence info file, minimally '
              'containing a column named "tax_id"'))

    output_group = parser.add_argument_group(
        "Output options").add_mutually_exclusive_group()

    output_group.add_argument(
        '-o', '--outfile',
        type=argparse.FileType('wt'),
        default=sys.stdout,
        metavar='FILE',
        help=('Output file containing lineages for the specified taxa '
              'in csv format; writes to stdout if unspecified'))
Esempio n. 3
0
def build_parser(parser):

    parser.add_argument(
        'new_nodes',
        metavar='csv',
        help=('A csv file defining nodes to add to the taxonomy. '
              'Mandatory fields include "tax_id", "parent_id", "rank", '
              '"tax_name"; optional fields include "source_name", '
              '"source_id" and "children". The "children" field should '
              'specify one or more existing taxids in a semicolon-'
              'delimited list. Other columns are ignored.'))

    parser = add_database_args(parser)

    parser.add_argument(
        '-S', '--source-name',
        dest='source_name',
        default='unknown',
        help=('Identifies the source for new nodes (will override '
              '"source_name" in the input provided '
              'by `--new-nodes`). [%(default)s]'))

    parser.add_argument(
        '--update',
        action='store_true',
        help='Update any existing nodes')

    parser.add_argument(
        '--tax-table',
        help='table name in database')

    parser.add_argument(
        '--out',
        default=sys.stdout,
        help='sql queries')
Esempio n. 4
0
def build_parser(parser):
    parser = add_database_args(parser)
    parser.add_argument('tax_ids', nargs='+')
    parser.add_argument(
        '-o', '--outfile',
        type=argparse.FileType('w'),
        default=sys.stdout,
        metavar='FILE')
Esempio n. 5
0
def build_parser(parser):
    parser = add_database_args(parser)

    node_parser = parser.add_argument_group(title='node options')
    node_parser.add_argument('--valid',
                             action='store_true',
                             help='include only valid nodes')
    node_parser.add_argument(
        '--ranked',
        action='store_true',
        help='include only ranked nodes (drop no_rank nodes)')

    input_group = parser.add_argument_group('input options')

    input_group.add_argument('--taxtable',
                             metavar='CSV',
                             help='build from a previous built taxtable')

    input_group.add_argument('--clade-ids',
                             help=('return top-down tax_id clades'))

    input_group.add_argument(
        '-n',
        '--taxnames',
        metavar='FILE',
        help=('A file identifing taxa in the form of taxonomic '
              'names. Names are matched against both primary names and '
              'synonyms. Lines beginning with "#" are ignored. Taxa '
              'identified here will be added to those specified using '
              '--tax-ids'))

    input_group.add_argument(
        '-t',
        '--tax-ids',
        metavar='FILE-OR-LIST',
        help=('File containing a whitespace-delimited list of '
              'tax_ids (ie, separated by tabs, spaces, or newlines; lines '
              'beginning with "#" are ignored). This option can also be '
              'passed a comma-delited list of tax_ids on the command line.'))

    input_group.add_argument(
        '-i',
        '--seq-info',
        type=argparse.FileType('r'),
        help=('Read tax_ids from sequence info file, minimally '
              'containing the field "tax_id"'))

    output_group = parser.add_argument_group(
        "Output options").add_mutually_exclusive_group()

    output_group.add_argument(
        '-o',
        '--out',
        type=argparse.FileType('w'),
        default=sys.stdout,
        metavar='FILE',
        help=('Output file containing lineages for the specified taxa '
              'in csv format; writes to stdout if unspecified'))
Esempio n. 6
0
def build_parser(parser):
    parser = add_database_args(parser)

    # TODO: do we need the commented-out options?
    # node_parser = parser.add_argument_group(title='node options')

    # node_parser.add_argument(
    #     '--valid',
    #     action='store_true',
    #     help='Include only valid nodes.')
    # node_parser.add_argument(
    #     '--ranked',
    #     choices=['columns', 'rows'],
    #     help='Include only ranked columns or ranked rows and columns.')

    input_group = parser.add_argument_group('input options')

    # input_group.add_argument(
    #     '--taxtable',
    #     metavar='CSV',
    #     help='build from a previous built taxtable')

    # input_group.add_argument(
    #     '--clade-ids',
    #     help=('return top-down tax_id clades'))

    input_group.add_argument(
        '-t',
        '--tax-ids',
        nargs='+',
        help='one or more space-delimited tax_ids (eg "-t 47770 33945")')

    input_group.add_argument(
        '-f',
        '--tax-id-file',
        metavar='FILE',
        type=argparse.FileType('rt'),
        help=('File containing a whitespace-delimited list of '
              'tax_ids (ie, separated by tabs, spaces, or newlines.'))

    input_group.add_argument(
        '-i',
        '--seq-info',
        type=argparse.FileType('rt'),
        help=('Read tax_ids from sequence info file, minimally '
              'containing a column named "tax_id"'))

    output_group = parser.add_argument_group(
        "Output options").add_mutually_exclusive_group()

    output_group.add_argument(
        '-o',
        '--outfile',
        type=argparse.FileType('wt'),
        default=sys.stdout,
        metavar='FILE',
        help=('Output file containing lineages for the specified taxa '
              'in csv format; writes to stdout if unspecified'))
Esempio n. 7
0
def build_parser(parser):
    parser = add_database_args(parser)
    parser.add_argument(
        'source_name',
        help='name of source identifying names and nodes to extract')
    parser.add_argument('-o',
                        '--outfile',
                        type=Opener('w'),
                        default=sys.stdout)
Esempio n. 8
0
def build_parser(parser):
    parser = add_database_args(parser)
    parser.add_argument('new_nodes', metavar='FILE', type=Opener('r'),
                        help='yaml file specifying new nodes')
    parser.add_argument(
        '--source-name', dest='source_name',
        help=("""Provides the default source name for new nodes.  The
              value is overridden by "source_name" in the input
              file. If not provided, "source_name" is required in each
              node or name definition. This source name is created if
              it does not exist."""))
Esempio n. 9
0
def build_parser(parser):
    parser = add_database_args(parser)
    parser.add_argument('new_nodes',
                        metavar='FILE',
                        type=Opener('r'),
                        help='yaml file specifying new nodes')
    parser.add_argument(
        '--source-name',
        dest='source_name',
        help=("""Provides the default source name for new nodes.  The
              value is overridden by "source_name" in the input
              file. If not provided, "source_name" is required in each
              node or name definition. This source name is created if
              it does not exist."""))
Esempio n. 10
0
def build_parser(parser):
    parser = add_database_args(parser)
    parser.add_argument('source_name',
                        help='name of source identifying names and nodes to extract')
    parser.add_argument('-o', '--outfile', type=Opener('w'), default=sys.stdout)