How to use the pygtftk.arg_formatter function in pygtftk

To help you get started, we’ve selected a few pygtftk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dputhier / pygtftk / pygtftk / plugins / ologram.py View on Github external
def make_parser():
    """The main argument parser."""
    parser = argparse.ArgumentParser(add_help=True)

    parser_grp = parser.add_argument_group('Arguments')

    # --------------------- Main arguments ----------------------------------- #

    parser_grp.add_argument('-i', '--inputfile',
                            help="Path to the GTF file. Defaults to STDIN",
                            default=sys.stdin,
                            metavar="GTF",
                            type=arg_formatter.FormattedFile(mode='r', file_ext=('gtf', 'gtf.gz')),
                            required=False)

    parser_grp.add_argument('-c', '--chrom-info',
                            help="Tabulated two-columns file. "
                                 "Chromosomes as column 1, sizes as column 2",
                            default=None,
                            metavar="TXT",
                            action=arg_formatter.CheckChromFile,
                            required=False)

    parser_grp.add_argument('-p', '--peak-file',
                            help='The file containing the peaks/regions to be annotated.'
                                 ' (bed format).',
                            default=None,
                            metavar="BED",
                            type=arg_formatter.FormattedFile(mode='r', file_ext='bed'),
github dputhier / pygtftk / pygtftk / plugins / retrieve.py View on Github external
"""The program parser."""
    parser = argparse.ArgumentParser(add_help=True)

    parser_grp = parser.add_argument_group('Arguments')

    parser_grp.add_argument('-s', '--species-name',
                            help="The species name.",
                            type=str,
                            metavar="SPECIES",
                            default="homo_sapiens",
                            required=False)

    parser_grp.add_argument('-o', '--outputfile',
                            help="Output file (gtf.gz).",
                            metavar="GTF.GZ",
                            type=arg_formatter.FormattedFile(mode='w', file_ext='gtf.gz'))

    parser_grp.add_argument('-e', '--ensembl-collection',
                            help="Which ensembl collection to interrogate"
                                 "('vertebrate', 'protists', 'fungi', 'plants', 'metazoa').",
                            default="vertebrate",
                            choices=[
                                'vertebrate',
                                'protists',
                                'fungi',
                                'plants',
                                'metazoa'],
                            type=str)

    parser_grp.add_argument('-r', '--release',
                            help="Release number. By default, the latest.",
                            default=None,
github dputhier / pygtftk / pygtftk / plugins / rm_dup_tss.py View on Github external
def make_parser():
    """ Parser """
    parser = argparse.ArgumentParser(add_help=True)

    parser_grp = parser.add_argument_group('Argument')

    parser_grp.add_argument('-i', '--inputfile',
                            help="Path to the GTF file. Default to STDIN",
                            default=sys.stdin,
                            metavar="GTF",
                            type=arg_formatter.FormattedFile(mode='r', file_ext=('gtf', 'gtf.gz')))

    parser_grp.add_argument('-o', '--outputfile',
                            help="Output file.",
                            default=sys.stdout,
                            metavar="GTF",
                            type=arg_formatter.FormattedFile(mode='w', file_ext=('gtf')))

    return parser
github dputhier / pygtftk / pygtftk / plugins / join_multi_file.py View on Github external
"""The program parser."""
    parser = argparse.ArgumentParser(add_help=True)

    parser_grp = parser.add_argument_group('Arguments')

    parser_grp.add_argument('-i', '--inputfile',
                            help="Path to the GTF file. Default to STDIN",
                            default=sys.stdin,
                            metavar="GTF",
                            type=arg_formatter.FormattedFile(mode='r', file_ext=('gtf', 'gtf.gz')))

    parser_grp.add_argument('-o', '--outputfile',
                            help="Output file.",
                            default=sys.stdout,
                            metavar="GTF",
                            type=arg_formatter.FormattedFile(mode='w', file_ext=('gtf')))

    parser_grp.add_argument('-k', '--key-to-join',
                            help='The name of the key used to join (e.g transcript_id).',
                            default=None,
                            metavar="KEY",
                            type=str,
                            required=True)

    parser_grp.add_argument('-t', '--target-feature',
                            help='The name(s) of the target feature(s). Comma-separated.',
                            default=None,
                            type=str,
                            required=False)

    parser_grp.add_argument('-m', '--matrix-files',
                            help="A set of matrix files with row names as "
github dputhier / pygtftk / pygtftk / plugins / nb_transcripts.py View on Github external
def make_parser():
    """The program parser."""
    parser = argparse.ArgumentParser(add_help=True)

    parser_grp = parser.add_argument_group('Arguments')

    parser_grp.add_argument('-i', '--inputfile',
                            help="Path to the GTF file. Default to STDIN",
                            default=sys.stdin,
                            metavar="GTF",
                            type=arg_formatter.FormattedFile(mode='r', file_ext=('gtf', 'gtf.gz')))

    parser_grp.add_argument('-o', '--outputfile',
                            help="Output file.",
                            default=sys.stdout,
                            metavar="GTF/TXT",
                            type=arg_formatter.FormattedFile(mode='w', file_ext=('gtf', 'txt')))

    parser_grp.add_argument('-f', '--text-format',
                            help="Return a text format.",
                            action="store_true")

    parser_grp.add_argument('-a',
                            '--key-name',
                            type=str,
                            default="nb_tx",
                            help="If gtf format is requested, the name of the key.",
github dputhier / pygtftk / pygtftk / plugins / shift.py View on Github external
"""The program CLI."""
    parser = argparse.ArgumentParser(add_help=True)

    parser_grp = parser.add_argument_group('Arguments')

    parser_grp.add_argument('-i', '--inputfile',
                            help="Path to the GTF file. Default to STDIN",
                            default=sys.stdin,
                            metavar="GTF",
                            type=arg_formatter.FormattedFile(mode='r', file_ext=('gtf', 'gtf.gz')))

    parser_grp.add_argument('-o', '--outputfile',
                            help="Output file.",
                            default=sys.stdout,
                            metavar="GTF",
                            type=arg_formatter.FormattedFile(mode='w', file_ext=('gtf')))

    parser_grp.add_argument('-s', '--shift-value',
                            help="Shift coordinate by s nucleotides.",
                            default=0,
                            type=int,
                            required=True)

    parser_grp.add_argument('-d', '--stranded',
                            help="By default shift not .",
                            action="store_true")

    parser_grp.add_argument('-a', '--allow-outside',
                            help="Accept the partial or total disappearance of a feature upon shifting.",
                            action="store_true")

    parser_grp.add_argument('-c', '--chrom-info',
github dputhier / pygtftk / pygtftk / plugins / del_attr.py View on Github external
def make_parser():
    parser = argparse.ArgumentParser(add_help=True)

    parser_grp = parser.add_argument_group('Arguments')

    parser_grp.add_argument('-i', '--inputfile',
                            help="Path to the GTF file. Default to STDIN",
                            default=sys.stdin,
                            metavar="GTF",
                            type=arg_formatter.FormattedFile(mode='r', file_ext=('gtf', 'gtf.gz')))

    parser_grp.add_argument('-o', '--outputfile',
                            help="Output file.",
                            default=sys.stdout,
                            metavar="GTF",
                            type=arg_formatter.FormattedFile(mode='w', file_ext=('gtf')))

    parser_grp.add_argument('-k', '--key',
                            help='Comma separated list of attribute names or a '
                                 'regular expression (see -r).',
                            default=None,
                            metavar="KEY",
                            type=str,
                            required=True)

    parser_grp.add_argument('-r', '--reg-exp',
github dputhier / pygtftk / pygtftk / plugins / closest_genes.py View on Github external
def make_parser():
    """The parser."""
    parser = argparse.ArgumentParser(add_help=True)

    parser_grp = parser.add_argument_group('Arguments')

    parser.add_argument('-i', '--inputfile',
                        help="Path to the GTF file. Default to STDIN",
                        default=sys.stdin,
                        metavar="GTF",
                        type=arg_formatter.FormattedFile(mode='r', file_ext=('gtf', 'gtf.gz')))

    parser.add_argument('-o', '--outputfile',
                        help="Output file.",
                        default=sys.stdout,
                        metavar="GTF/TXT",
                        type=arg_formatter.FormattedFile(mode='w', file_ext=('gtf', 'txt')))

    parser_grp.add_argument('-r', '--from-region-type',
                            help="What is region to consider for each gene.",
                            choices=['tss', 'tts', 'gene'],
                            default="tss",
                            type=str,
                            required=False)

    parser_grp.add_argument('-nb', '--nb-neighbors',
                            help="The size of the neighborhood.",
github dputhier / pygtftk / pygtftk / plugins / add_prefix.py View on Github external
def make_parser():
    """The program parser."""
    parser = argparse.ArgumentParser(add_help=True)

    parser_grp = parser.add_argument_group('Arguments')

    parser_grp.add_argument('-i', '--inputfile',
                            help="Path to the GTF file. Default to STDIN",
                            default=sys.stdin,
                            metavar="GTF",
                            type=arg_formatter.FormattedFile(mode='r', file_ext=('gtf', 'gtf.gz')))

    parser_grp.add_argument('-o', '--outputfile',
                            help="Output file.",
                            default=sys.stdout,
                            metavar="GTF",
                            type=arg_formatter.FormattedFile(mode='w', file_ext=('gtf')))

    parser_grp.add_argument('-k', '--key',
                            help="The name of the attribute for which a "
                                 "prefix/suffix is to be added to the corresponding"
                                 " values (e.g, gene_id, transcript_id...).",
                            default="chrom",
                            metavar="KEY",
                            type=str)

    parser_grp.add_argument('-t', '--text',
github dputhier / pygtftk / pygtftk / plugins / bigwig_to_bed.py View on Github external
description=__doc__)

    parser_grp = parser.add_argument_group('Arguments')

    # --------------------- Main arguments ----------------------------------- #

    parser_grp.add_argument('-i', '--inputfile',
                            help="Path to the bigwig file",
                            default=None,
                            type=arg_formatter.FormattedFile(mode='r', file_ext=('bigwig')),
                            required=False)

    parser_grp.add_argument('-o', '--outputfile',
                            help='The output BED file.',
                            default=sys.stdout,
                            type=arg_formatter.FormattedFile(mode='r', file_ext='bed'),
                            required=False)

    parser_grp.add_argument('-c', '--chrom-list',
                            help='The list of chromosomes of interest.',
                            default=None,
                            type=str,
                            nargs='*',
                            required=False)

    parser_grp.add_argument('-e', '--expression',
                            help='A boolean expression where s is the signal (e.g; s > 0 and s < 0.5).',
                            default=None,
                            type=str,
                            required=True)

    return parser