예제 #1
0
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',
        '--exon-numbering-key',
        help="The name of the key containing the exon numbering.",
        default="exon_nbr",
        type=str)

    return parser
예제 #2
0
def make_parser():
    """The 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(
        '-n',
        '--no-check-gene-chr',
        help=
        "By default the command raise an error if several chromosomes are associated with the same gene_id. Disable this behaviour (but you should better think about what it means...).",
        action="store_true")

    return parser
예제 #3
0
def make_parser():
    """The program parser."""
    parser = argparse.ArgumentParser(add_help=True)

    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",
                        type=arg_formatter.FormattedFile(mode='w',
                                                         file_ext=('gtf')))

    parser.add_argument('-m',
                        '--min-exon-number',
                        help="Minimum number of exons.",
                        default=0,
                        type=int)

    parser.add_argument('-M',
                        '--max-exon-number',
                        help="Maximum number of exons.",
                        default=None,
                        type=int)
    return parser
예제 #4
0
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 (BED).",
                            default=sys.stdout,
                            metavar="BED",
                            type=arg_formatter.FormattedFile(mode='w',
                                                             file_ext='bed'))

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

    return parser
예제 #5
0
def make_parser():
    """The 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="TXT",
                            type=arg_formatter.FormattedFile(mode='w',
                                                             file_ext='txt'))

    parser_grp.add_argument(
        '-s',
        '--separator',
        help="The separator to be used for separating key names.",
        default="\n",
        metavar="SEP",
        type=str)

    return parser
예제 #6
0
def make_parser():
    """parse"""
    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')))

    parser_grp.add_argument('-l', '--longs',
                            help="Take the longest transcript of each gene",
                            action="store_true")

    parser_grp.add_argument('-g', '--keep-gene-lines',
                            help="Add gene lines to the output",
                            action="store_true")

    return parser
예제 #7
0
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 FASTA file.",
                            default=sys.stdout,
                            metavar="FASTA",
                            type=arg_formatter.FormattedFile(mode='w', file_ext='fasta'))

    parser_grp.add_argument('-g', '--genome',
                            help="The genome in fasta format.",
                            default=None,
                            metavar="FASTA",
                            required=True,
                            type=arg_formatter.FormattedFile(mode='r', file_ext='fasta'))

    parser_grp.add_argument('-s', '--separator',
                            help="To separate info in header.",
                            default="|",
                            type=str,
                            required=False)

    parser_grp.add_argument('-l', '--label',
                            help="A set of key for the header that will be extracted from the transcript line.",
                            default="feature,transcript_id,gene_id,seqid,start,end",
                            type=str,
                            required=False)

    parser_grp.add_argument('-t', '--feature-type',
                            help="The feature type (one defined in column 3).",
                            type=str,
                            default="exon",
                            required=False)

    parser_grp.add_argument('-n', '--no-rev-comp',
                            help="Don't reverse complement sequence "
                                 "corresponding to gene on minus strand.",
                            action="store_true",
                            required=False)

    parser_grp.add_argument('-r', '--rev-comp-to-header',
                            help="Indicate in the header whether sequence was rev-complemented.",
                            action="store_true",
                            required=False)

    parser_grp.add_argument('-u', '--unique',
                            help="Don't write redondant IDS.",
                            action="store_true",
                            required=False)

    return parser
예제 #8
0
def make_parser():
    """The main argument parser."""
    parser = argparse.ArgumentParser(add_help=True)

    parser_grp = parser.add_argument_group('Arguments')

    parser_grp.add_argument('-i', '--inputfiles',
                            help="Complete paths to the OLOGRAM output text files",
                            type=arg_formatter.FormattedFile(mode='r', file_ext=('txt')),
                            nargs='+')

    parser_grp.add_argument('-os', '--ori-shuffles',
                            help="How many shuffles were performed in the individual runs that will be merged?",
                            default=200,
                            type=int,
                            required=False)


    parser_grp.add_argument('-o', '--output',
                            help="Destination path for the merged output file.",
                            default=None,
                            nargs=None,
                            type=arg_formatter.FormattedFile(mode='w', file_ext=('txt')),
                            required=True)

    return parser
예제 #9
0
def make_parser():
    """The program parser."""
    parser = argparse.ArgumentParser()

    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",
                        type=arg_formatter.FormattedFile(mode='w',
                                                         file_ext=('gtf')))

    parser.add_argument('-g',
                        '--keep-gene-lines',
                        help="Add gene lines to the output",
                        action="store_true")
    return parser
예제 #10
0
def make_parser():
    """The 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",
                            required=False,
                            type=arg_formatter.FormattedFile(
                                mode='r', file_ext=('gtf', 'gtf.gz')))

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

    parser_grp.add_argument('-k',
                            '--key-name',
                            help="The name of the new key.",
                            default='tss_number',
                            type=str,
                            required=False)

    parser_grp.add_argument(
        '-c',
        '--compute-dist',
        help=
        "Add a key indicating the distance to the first tss (the most 5').",
        action='store_true')

    parser_grp.add_argument(
        '-d',
        '--key-name-dist',
        help="If --compute-dist is true a name for that key.",
        default='dist_to_first_tss',
        type=str,
        required=False)

    parser_grp.add_argument(
        '-g',
        '--add-nb-tss-to-gene',
        help="Add the number of different tss to each gene",
        action='store_true')

    parser_grp.add_argument(
        '-l',
        '--gene-key',
        help="The name of the key if --add-nb-tss-to-gene is selected.",
        default='nb_tss',
        type=str,
        required=False)

    return parser
예제 #11
0
def make_parser():
    """The 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",
                            required=False,
                            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('-a',
                            '--key-name',
                            type=str,
                            default="intron_sizes",
                            help="The name of the key.",
                            required=False)

    return parser
예제 #12
0
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 (BED).",
                            default=sys.stdout,
                            metavar="BED",
                            type=arg_formatter.FormattedFile(mode='w',
                                                             file_ext='bed'))

    parser_grp.add_argument('-b',
                            '--by-transcript',
                            help="The intronic regions are returned for each"
                            " transcript.",
                            action="store_true")

    parser_grp.add_argument(
        '-n',
        '--names',
        help="The key(s) that should be used as name (if -b is used).",
        default="gene_id,transcript_id",
        metavar="NAME",
        type=str)

    parser_grp.add_argument(
        '-s',
        '--separator',
        help=
        "The separator to be used for separating name elements (if -b is used).",
        default="|",
        metavar="SEP",
        type=str)

    parser_grp.add_argument(
        '-w',
        '--intron-nb-in-name',
        help=
        "By default intron number is written in 'score' column. Force it to be written in 'name' column.",
        action="store_true")

    parser_grp.add_argument(
        '-F',
        '--no-feature-name',
        help="Don't add the feature name ('intron') in the name column.",
        action="store_true")

    return parser
예제 #13
0
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 (BED).",
                            default=sys.stdout,
                            metavar="BED",
                            type=arg_formatter.FormattedFile(mode='w', file_ext='bed'))

    parser_grp.add_argument('-t', '--ft-type',
                            help="The target feature (as found in the 3rd "
                                 "column of the GTF).",
                            default='transcript',
                            type=str,
                            required=False)

    parser_grp.add_argument('-v', '--invert',
                            help="Get 3' coordinate.",
                            action="store_true")

    parser_grp.add_argument('-p', '--transpose',
                            help="Transpose coordinate in 5' (use negative value) or in 3' (use positive values).",
                            type=int,
                            required=False,
                            default=0)

    parser_grp.add_argument('-n', '--names',
                            help="The key(s) that should be used as name.",
                            default="gene_id,transcript_id",
                            metavar="NAME",
                            type=str)

    parser_grp.add_argument('-m', '--more-names',
                            help="A comma-separated list of information to be added to the 'name' column of the bed file.",
                            default=None,
                            type=str)

    parser_grp.add_argument('-s', '--separator',
                            help="The separator to be used for separating name elements (see -n).",
                            default="|",
                            metavar="SEP",
                            type=str)

    parser_grp.add_argument('-e', '--explicit',
                            help="Write explicitly the name of the keys in the header.",
                            action="store_true",
                            required=False)
    return parser
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('-s',
                            '--intron-size',
                            help="The minimum intron size.",
                            type=int,
                            default=100,
                            required=True)

    parser_grp.add_argument(
        '-m',
        '--merged',
        help=
        "If selected, the sum of all intron lengths for a gene should be higher than s.",
        action="store_true")

    parser_grp.add_argument('-d',
                            '--delete-monoexonic',
                            help="Delete mono-exonic transcripts.",
                            action="store_true")

    parser_grp.add_argument(
        '-a',
        '--add-intron-size',
        help=
        "Add a new key containing intron_size (comma-separated in order of apppearance) or the sum of intron size (see -m).",
        action="store_true")

    parser_grp.add_argument(
        '-v',
        '--invert-match',
        help=
        'Keep genes with an intron whose size is above s and delete others.',
        action="store_true",
        required=False)
    return parser
예제 #15
0
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",
                            required=False,
                            type=arg_formatter.FormattedFile(
                                mode='r', file_ext=('gtf', 'gtf.gz')))

    parser_grp.add_argument('-o',
                            '--outputfile',
                            help="Output file.",
                            default=sys.stdout,
                            metavar="BED/BED3/BED6",
                            type=arg_formatter.FormattedFile(mode='w',
                                                             file_ext='bed'))

    parser_grp.add_argument('-n',
                            '--names',
                            help="The key(s) that should be used as name.",
                            default="gene_id,transcript_id",
                            metavar="NAME",
                            type=str)

    parser_grp.add_argument(
        '-s',
        '--separator',
        help="The separator to be used for separating name elements (see -n).",
        default="|",
        metavar="SEP",
        type=str)

    parser_grp.add_argument(
        '-m',
        '--more-names',
        help="Add this information to the 'name' column of the BED file.",
        default="",
        type=str)

    parser_grp.add_argument('-f',
                            '--format',
                            help='Currently one of bed3, bed6',
                            type=str,
                            choices=('bed', 'bed3', 'bed6'),
                            default='bed6',
                            required=False)

    return parser
예제 #16
0
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="The tabulated file. Default to STDIN",
                            default=sys.stdin,
                            metavar="TXT",
                            type=arg_formatter.FormattedFile(mode='r',
                                                             file_ext='txt'))

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

    parser_grp.add_argument('-c',
                            '--columns',
                            help="The list (csv) of column names.",
                            default=None,
                            type=str,
                            required=True)

    parser_grp.add_argument('-n',
                            '--invert-match',
                            help='Not/invert match.',
                            action="store_true")

    parser_grp.add_argument('-u',
                            '--unique',
                            help='Write non redondant lines.',
                            action="store_true")

    parser_grp.add_argument(
        '-s',
        '--separator',
        help="The separator to be used for separating name elements (see -n).",
        default="\t",
        metavar="SEP",
        type=str)

    parser_grp.add_argument('-H',
                            '--no-header',
                            help="Don't print the header line.",
                            action="store_true",
                            required=False)

    return parser
예제 #17
0
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',
        help='The character string to add as a prefix to the values.',
        default="chr",
        metavar="TEXT",
        type=str)

    parser_grp.add_argument(
        '-s',
        '--suffix',
        help='The character string to add as a prefix to the values.',
        action="store_true",
        required=False)

    parser_grp.add_argument('-f',
                            '--target-feature',
                            help='The name of the target feature.',
                            default="*",
                            type=str,
                            required=False)

    return parser
예제 #18
0
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('-c',
                            '--chrom-info',
                            help="Tabulated two-columns file. Chromosomes"
                            " as column 1 and sizes as"
                            " column 2 ",
                            default=None,
                            metavar="CHROMINFO",
                            action=CheckChromFile,
                            required=True)

    parser_grp.add_argument(
        '-u',
        '--upstream',
        help="Extends the tts in 5' by a given value (int)."
        " Defines the region around the tts.",
        default=1500,
        metavar="UPSTREAM",
        type=int,
        required=False)

    parser_grp.add_argument(
        '-d',
        '--downstream',
        help="Extends the region in 3' by a given value (int)."
        " Defines the region around the tts.",
        default=1500,
        metavar="DOWNSTREAM",
        type=int,
        required=False)

    return parser
예제 #19
0
def make_parser():
    """The 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(
        '-n',
        '--number',
        help="The number of transcripts or gene to select.",
        default=1,
        metavar="NUMBER",
        type=arg_formatter.ranged_num(lowest=1,
                                      highest=None,
                                      linc=True,
                                      val_type='int'),
        required=False)

    parser_grp.add_argument('-t',
                            '--ft-type',
                            help="The type of feature.",
                            default="transcript",
                            choices=["gene", "transcript"],
                            required=False)

    parser_grp.add_argument('-s',
                            '--seed-value',
                            help="Seed value for the random number generator.",
                            default=None,
                            metavar="SEED",
                            type=arg_formatter.ranged_num(lowest=1,
                                                          highest=None,
                                                          linc=True,
                                                          val_type='int'),
                            required=False)

    return parser
예제 #20
0
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',
                            '--src-key',
                            help='comma-separated list of keys to join.',
                            default=None,
                            metavar="KEY",
                            type=str,
                            required=True)

    parser_grp.add_argument('-d',
                            '--dest-key',
                            help='The target key name.',
                            default=None,
                            metavar="KEY",
                            type=str,
                            required=True)

    parser_grp.add_argument('-s',
                            '--separator',
                            help="The separator for the concatenated values.",
                            default="|",
                            metavar="SEP",
                            type=str)

    parser_grp.add_argument('-f',
                            '--target-feature',
                            help='The name of the target feature.',
                            default="*",
                            type=str,
                            required=False)
    return parser
예제 #21
0
def make_parser():
    """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',
                            help="Tabulated two-columns file. Chromosomes"
                            " as column 1 and sizes as"
                            " column 2 ",
                            default=None,
                            metavar="CHROMINFO",
                            action=CheckChromFile,
                            required=True)

    return parser
예제 #22
0
def make_parser():
    """The program parser."""
    parser = argparse.ArgumentParser(add_help=True)

    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",
                        type=arg_formatter.FormattedFile(mode='w', file_ext=('gtf')))

    parser.add_argument('-g', '--go-id',
                        help='The GO ID (with or without "GO:" prefix).',
                        default="GO:0003700",
                        type=str,
                        required=False)

    parser_mut = parser.add_mutually_exclusive_group(required=True)

    parser_mut.add_argument('-l', '--list-datasets',
                            help='Do not select lines. Only get a list of available datasets/species.',
                            action="store_true",
                            required=False)

    parser_mut.add_argument('-s', '--species',
                            help='The dataset/species.',
                            default=None,
                            type=str,
                            required=False)

    parser.add_argument('-n', '--invert-match',
                        help='Not/invert match.',
                        action="store_true")

    parser.add_argument('-p1', '--http-proxy',
                        help='Use this http proxy (not tested/experimental).',
                        default='',
                        type=str,
                        required=False)

    parser.add_argument('-p2', '--https-proxy',
                        help='Use this https proxy (not tested/experimental).',
                        default='',
                        type=str,
                        required=False)
    return parser
예제 #23
0
def make_parser():
    """The 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="TXT",
                            type=arg_formatter.FormattedFile(mode='w',
                                                             file_ext='txt'))

    parser_grp.add_argument('-k',
                            '--key-name',
                            help="The comma separated list of key name.",
                            default=None,
                            type=str,
                            required=True)

    parser_grp.add_argument('-s',
                            '--separator',
                            help="The separator used if -c or -p are true.",
                            default="\t",
                            type=str,
                            required=False)

    parser_grp.add_argument(
        '-c',
        '--count',
        help=
        "Add the counts for each key (separator will be set to '\t' by default).",
        action="store_true")

    parser_grp.add_argument(
        '-p',
        '--print-key-name',
        help="Also print the key name in the first column.",
        action="store_true")
    return parser
예제 #24
0
def make_parser():
    """The main argument parser."""
    parser = argparse.ArgumentParser(add_help=True)

    parser_grp = parser.add_argument_group('Arguments')

    parser_grp.add_argument('-i',
                            '--inputfile',
                            help="Complete path to the OLOGRAM output file",
                            type=arg_formatter.FormattedFile(mode='r',
                                                             file_ext=('tsv')),
                            required=True)

    parser_grp.add_argument('-o',
                            '--output',
                            help="Pdf file name",
                            default=None,
                            nargs=None,
                            type=arg_formatter.FormattedFile(mode='w',
                                                             file_ext='pdf'),
                            required=True)

    parser_grp.add_argument('-l',
                            '--query-label',
                            help="Name of the query for display",
                            default="Query",
                            type=str,
                            required=False)

    parser_grp.add_argument(
        '-t',
        '--top-s',
        help=
        "Optional. Only the top t combinations sorted by total basepairs in real data will be displayed.",
        default=-1,
        type=int,
        required=False)

    parser_grp.add_argument(
        '-mh',
        '--min_inheritance',
        help=
        "Optional. A combination will be added to a shorter parent in the tree only if it represents at least a proportion MH of its true base pairs (between 0 and 1).",
        default=-1,
        type=float,
        required=False)

    return parser
예제 #25
0
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-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 "
        "target keys column names as novel key and each cell as value.",
        type=argparse.FileType('r'),
        nargs='+')

    return parser
예제 #26
0
def make_parser():
    """The parser."""
    parser = argparse.ArgumentParser(add_help=True)

    parser_grp = parser.add_argument_group('Arguments')

    parser_grp.add_argument('-i',
                            '--inputfile',
                            help="Path to the CEAS file.",
                            default=None,
                            type=argparse.FileType('r'),
                            required=True)

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

    parser_grp.add_argument('-t',
                            '--target-table',
                            help="The target table.",
                            default="GeneTable",
                            type=str,
                            required=False)

    parser_grp.add_argument('-s',
                            '--show-tables',
                            help="Only list tables and exit.",
                            action="store_true",
                            required=False)

    return parser
예제 #27
0
def make_parser():
    """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,
                            metavar="RELEASE",
                            type=str)

    parser_grp.add_argument('-l', '--list-only',
                            help="If selected, list available species.",
                            action='store_true',
                            required=False)

    parser_grp.add_argument('-hs', '--hide-species-name',
                            help="If selected, hide species names upon listing.",
                            action='store_true',
                            required=False)

    parser_grp.add_argument('-c', '--to-stdout',
                            help='This option specifies that output will go to '
                                 'the standard output stream, leaving downloaded'
                                 ' files intact (or not, see -d).',
                            action='store_true',
                            required=False)

    parser_grp.add_argument('-d', '--delete',
                            help='Delete the gtf file after processing (e.g if -c is used).',
                            action='store_true',
                            required=False)

    return parser
예제 #28
0
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/BED",
                            type=arg_formatter.FormattedFile(
                                mode='r', file_ext=('bed', 'gtf', 'gtf.gz')))

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

    parser_grp.add_argument('-t',
                            '--ft-type',
                            help="The target feature (as found in the 3rd "
                            "column of the GTF).",
                            default='transcript',
                            type=str,
                            required=False)

    parser_grp.add_argument('-n',
                            '--names',
                            help="The key(s) that should be used as name.",
                            default="transcript_id",
                            metavar="NAME",
                            type=str)

    parser_grp.add_argument(
        '-s',
        '--separator',
        help="The separator to be used for separating name elements (see -n).",
        default="|",
        metavar="SEP",
        type=str)

    return parser
예제 #29
0
def make_parser():
    """The 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(
        '-m',
        '--max-transcript',
        help="The maximum number of transcripts to select for each gene.",
        default=1,
        metavar="MAX",
        type=arg_formatter.ranged_num(lowest=1,
                                      highest=None,
                                      linc=True,
                                      val_type='int'),
        required=False)

    parser_grp.add_argument('-s',
                            '--seed-value',
                            help="Seed value for the random number generator.",
                            default=None,
                            metavar="SEED",
                            type=arg_formatter.ranged_num(lowest=1,
                                                          highest=None,
                                                          linc=True,
                                                          val_type='int'),
                            required=False)

    return parser
예제 #30
0
def make_parser():
    """The 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",
                            required=False,
                            type=arg_formatter.FormattedFile(
                                mode='r', file_ext=('gtf', 'gtf.gz')))

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

    parser_grp.add_argument('-k',
                            '--keys',
                            default="*",
                            help="The set of keys of interest.",
                            type=str,
                            required=False)

    parser_grp.add_argument(
        '-t',
        '--additional-text',
        help="A facultative text to be printed in the third "
        "column (e.g species name).",
        default=None,
        metavar="TEXT",
        type=str,
        required=False)

    parser_grp.add_argument('-u',
                            '--uniq',
                            help="Ask for the count of non redondant values.",
                            action="store_true",
                            required=False)
    return parser