示例#1
0
        def generate_argparser():
            """Generate argparse parser
            """
            parser = MvfArgumentParser()
            parser.add_argument(
                "--maf",
                help="input MAF file",
                required=True,
                type=os.path.abspath,
            )
            parser.add_argument("--out",
                                help="output MVF file",
                                type=os.path.abspath,
                                required=True)
            parser.add_argument("--ref-tag",
                                "--reftag",
                                help="old reference tag")
            parser.add_argument(
                "--mvf-ref-label",
                "--mvfreflabel",
                default="REF",
                help=("new label for reference sample (default='REF')"))
            parser.add_argument(
                "--sample-tags",
                "--sampletags",
                nargs="*",
                required=True,
                help=("one or more TAG:NEWLABEL or TAG, items, "
                      "if TAG found in sample label, replace with "
                      "NEW (or TAG if NEW not specified) "
                      "NEW and TAG must each be unique."))

            parser.addarg_linebuffer()
            parser.addarg_overwrite()
            return parser
示例#2
0
 def generate_argparser():
     """Generate argparse parser
     """
     parser = MvfArgumentParser()
     parser.addarg_mvf()
     parser.add_argument("--out",
                         type=os.path.abspath,
                         help="Output path of FASTA file.",
                         required=True)
     parser.addarg_regions()
     parser.addarg_sample_indices()
     parser.addarg_sample_labels()
     parser.add_argument(
         "--label-type",
         "--labeltype",
         choices=('long', 'short'),
         default='long',
         help=("Long labels with all metadata or short ids"))
     parser.add_argument("--output-data",
                         "--outputdata",
                         choices=("dna", "rna", "prot"),
                         help="Output dna, rna or prot data.")
     parser.add_argument(
         "--buffer",
         type=int,
         default=10,
         help="size (Mbp) of write buffer for each sample")
     parser.add_argument(
         "--temp_dir",
         "--tempdir",
         default=".",
         help="directory to write temporary fasta files")
     return parser
示例#3
0
 def generate_argparser():
     """Generate argparse parser
     """
     parser = MvfArgumentParser()
     parser.addarg_mvf()
     parser.addarg_out()
     parser.addarg_sample_indices()
     parser.addarg_sample_labels()
     parser.addarg_windowsize()
     parser.addarg_mincoverage()
     parser.add_argument("--output-lists", action="store_true")
     return parser
示例#4
0
 def generate_argparser():
     """Generate argparse parser
     """
     parser = MvfArgumentParser()
     parser.add_argument("--mvf",
                         nargs="*",
                         type=os.path.abspath,
                         required=True,
                         help="One or more mvf files.")
     parser.addarg_out()
     parser.add_argument(
         "--new-contigs",
         "--newcontigs",
         action="store_true",
         help=("By default, contigs are matched between files "
               "using their text labels in the header. "
               "Use this option to turn matching off and treat "
               "each file's contigs as distinct."))
     parser.add_argument(
         "--newsamples",
         action="store_true",
         help=("By default, samples are matched between files "
               "using their text labels in the header. "
               "Use this option to turn matching off and treat "
               "each file's sample columns as distinct."))
     parser.add_argument(
         "--main_header_file",
         "--mainheaderfile",
         help=("Output file will use same headers as "
               "this input file (default=first in list)."))
     parser.addarg_linebuffer()
     parser.addarg_overwrite()
     return parser
示例#5
0
 def generate_argparser():
     """Generate argparse parser
     """
     parser = MvfArgumentParser()
     parser.addarg_mvf()
     parser.addarg_out()
     parser.addarg_contig_ids()
     parser.addarg_contig_labels()
     parser.addarg_sample_indices()
     parser.addarg_sample_labels()
     parser.addarg_mincoverage()
     parser.addarg_windowsize()
     parser.add_argument(
         "--base-match",
         "--basematch",
         help="String of bases to match (i.e. numerator).")
     parser.add_argument(
         "--base-total",
         "--basetotal",
         help="String of bases for total (i.e. denominator).")
     return parser
示例#6
0
 def generate_argparser():
     """Generate argparse parser
     """
     parser = MvfArgumentParser()
     parser.addarg_mvf()
     parser.addarg_out()
     parser.addarg_gff()
     parser.add_argument("--filter-annotation",
                         "--filterannotation",
                         help=("Skip entries in the GFF file that "
                               "contain this string in their 'Notes'"))
     parser.add_argument(
         "--nongenic-mode",
         "--nongenicmode",
         action="store_true",
         help=("Instead of returning annotated genes, "
               "return the non-genic regions without "
               "without changing contigs or coordinates"))
     parser.add_argument(
         "--nongenic-margin",
         "--nongenicmargin",
         type=int,
         default=0,
         help=("for --unnanotated-mode, only retain "
               "positions that are this number of bp away "
               "from an annotated region boundary"))
     parser.addarg_linebuffer()
     parser.addarg_overwrite()
     return parser
示例#7
0
 def generate_argparser():
     """Generate argparse parser
     """
     parser = MvfArgumentParser()
     parser.addarg_mvf()
     parser.addarg_out()
     parser.addarg_sample_indices(nmin=2)
     parser.addarg_sample_labels(nmin=2)
     parser.addarg_windowsize()
     parser.addarg_mincoverage()
     parser.add_argument("--data-type",
                         "--datatype",
                         choices=("dna", "prot"),
                         help=("Data type to compare."
                               "(This option is only needed for codon "
                               " MVF files, others will default.)"))
     parser.add_argument("--ambig",
                         choices=("random2", "random3"),
                         help=("By default, ambiguous nucleotides are "
                               "excluded.  This option will include "
                               "sets of ambiguous characters by "
                               "randomly choosing one of the options "
                               "for: RYMKWS ('random2') or "
                               "RYMKWS+BDHV ('random3')"))
     parser.add_argument(
         "--emit-counts",
         action="store_true",
         help=("output additional file that presents "
               "the raw counts of pairwise patterns for "
               "each sample pair tested for each window"))
     return parser
示例#8
0
 def generate_argparser():
     """Generate argparse parser
     """
     parser = MvfArgumentParser()
     parser.addarg_mvf()
     parser.addarg_out()
     parser.add_argument("--gff",
                         type=os.path.abspath,
                         help=("Input GFF3 file. If GFF3 not provided, "
                               "alignments are assumed to be "
                               "in-frame coding sequences."))
     parser.add_argument("--output-data",
                         "--outputdata",
                         choices=['protein', 'codon'],
                         default="codon",
                         help=("protein=single data column "
                               "of protein alleles; "
                               "codon=four columns with: "
                               "protein frame1 frame2 frame3"))
     parser.add_argument("--filter-annotation",
                         "--filterannotation",
                         help=("skip GFF entries with text "
                               "matching this in their 'Notes' field"))
     parser.addarg_linebuffer()
     parser.addarg_overwrite()
     return parser
示例#9
0
 def generate_argparser():
     """Generate argparse parser
     """
     parser = MvfArgumentParser()
     parser.addarg_mvf()
     parser.addarg_out()
     parser.add_argument("--gff",
                         type=os.path.abspath,
                         help=("Input GFF3 file. If GFF3 not provided, "
                               "alignments are assumed to be "
                               "in-frame coding sequences."))
     parser.add_argument("--output-data",
                         "--outputdata",
                         choices=['protein', 'codon'],
                         default="codon",
                         help=("protein=single data column "
                               "of protein alleles; "
                               "codon=four columns with: "
                               "protein frame1 frame2 frame3"))
     parser.add_argument("--filter-annotation",
                         "--filterannotation",
                         help=("skip GFF entries with text "
                               "matching this in their 'Notes' field"))
     parser.add_argument("--parent-gene-prefix",
                         "--parentgeneprefix",
                         default="gene:",
                         help=("Parent genes prefix when interpreting"
                               "GFF files.  For GFF3 files, 'gene:' "
                               "is standard, but for older or custom "
                               "GFF files this may vary.  Use 'none' "
                               "to make empty."))
     parser.addarg_linebuffer()
     parser.addarg_overwrite()
     parser.add_argument(
         "--verbose",
         action="store_true",
         help="""Output excessive data to screen for debugging""")
     return parser
示例#10
0
 def generate_argparser():
     """Generate argparse parser
     """
     parser = MvfArgumentParser()
     parser.addarg_mvf()
     parser.addarg_out()
     parser.addarg_gff()
     parser.add_argument("--filter-annotation",
                         "--filterannotation",
                         help=("Skip entries in the GFF file that "
                               "contain this string in their 'Notes'"))
     parser.add_argument(
         "--nongenic-mode",
         "--nongenicmode",
         action="store_true",
         help=("Instead of returning annotated genes, "
               "return the non-genic regions without "
               "without changing contigs or coordinates"))
     parser.add_argument(
         "--nongenic-margin",
         "--nongenicmargin",
         type=int,
         default=0,
         help=("for --unnanotated-mode, only retain "
               "positions that are this number of bp away "
               "from an annotated region boundary"))
     parser.add_argument("--gene-prefix",
                         "--geneprefix",
                         default="mRNA:",
                         help=("Gene entry prefix when interpreting"
                               "GFF files.  For GFF3 files, 'mRNA:' "
                               "is standard, but for older or custom "
                               "GFF files this may vary.  Use 'none' "
                               "to make empty."))
     parser.addarg_linebuffer()
     parser.addarg_overwrite()
     return parser
示例#11
0
 def generate_argparser():
     """Generate argparse parser
     """
     parser = MvfArgumentParser()
     parser.add_argument("--vcf",
                         type=os.path.abspath,
                         help="VCF input file")
     parser.add_argument("--out", required=True, help="output MVF file")
     parser.add_argument(
         "--out-flavor",
         "--outflavor",
         default="dna",
         choices=['dna', 'dnaqual', 'dnaqual-indel', 'dna-indel'],
         help=("choose output MVF flavor to include "
               "quality scores and/or indels"))
     parser.add_argument("--mask-depth",
                         "--maskdepth",
                         type=int,
                         default=1,
                         help="below this read depth mask with N/n")
     parser.add_argument(
         "--low-depth",
         "--lowdepth",
         type=int,
         default=3,
         help=("below this read depth coverage, "
               "convert to lower case set to 0 to disable"))
     parser.add_argument(
         "--mask-qual",
         "--maskqual",
         type=int,
         default=3,
         help=("low quality cutoff, bases replaced by N/- "
               "set to 0 to disable"))
     parser.add_argument(
         "--low-qual",
         "--lowqual",
         type=int,
         default=20,
         help=("below this quality convert to lower case "
               "set to 0 to disable"))
     parser.add_argument(
         "--contig-ids",
         "--contigids",
         nargs='*',
         help=("manually specify one or more contig ids "
               "as ID;VCFLABE;MVFLABEL, note that "
               "VCFLABEL must match EXACTLY the contig string "
               "labels in the VCF file"))
     parser.add_argument(
         "--sample-replace",
         "--samplereplace",
         nargs="*",
         help=("one or more TAG:NEWLABEL or TAG, items, "
               "if TAG found in sample label, replace with "
               "NEW (or TAG if NEW not specified) "
               "NEW and TAG must each be unique"))
     parser.add_argument(
         "--ref-label",
         "--reflabel",
         default="REF",
         help="label for reference sample (default='REF')")
     parser.add_argument("--alleles-from",
                         "--allelesfrom",
                         default=None,
                         help="""get additional alignment columns
         from INFO fields (:-separated)""")
     parser.addarg_linebuffer()
     parser.add_argument(
         "--no-autoindex",
         "--noautoindex",
         action="store_true",
         help="do not automatically index contigs from the VCF")
     parser.add_argument(
         "--field-sep",
         "--fieldsep",
         default="TAB",
         choices=['TAB', 'SPACE', 'DBLSPACE', 'COMMA', 'MIXED'],
         help="""VCF field separator (default='TAB')""")
     parser.add_argument(
         "--qual",
         action="store_true",
         help="""Include Phred genotype quality (GQ) scores""")
     parser.addarg_overwrite()
     return parser
示例#12
0
 def generate_argparser():
     """Generate argparse parser
     """
     parser = MvfArgumentParser()
     parser.add_argument("--fasta",
                         nargs='*',
                         required=True,
                         help="input FASTA file(s)")
     parser.add_argument("--out", required=True, help="output MVF file")
     parser.add_argument("--flavor",
                         choices=['dna', 'protein'],
                         help="type of file [dna] or protein",
                         default='dna')
     parser.add_argument(
         "--contig-ids",
         "--contigids",
         nargs='*',
         help=("manually specify one or more contig ids "
               "as ID:LABEL"))
     parser.add_argument(
         "--sample-replace",
         "--samplereplace",
         nargs="*",
         help=("one or more TAG:NEWLABEL or TAG, items, "
               "if TAG found in sample label, replace with "
               "NEW (or TAG if NEW not specified) "
               "NEW and TAG must each be unique"))
     parser.add_argument("--ref-label",
                         "--reflabel",
                         default="REF",
                         help="label for reference sample")
     parser.add_argument("--read-buffer",
                         "--readbuffer",
                         type=int,
                         default=100000,
                         help="number of lines to hold in READ buffer")
     parser.add_argument("--write-buffer",
                         "--writebuffer",
                         type=int,
                         default=100000,
                         help="number of lines to hold in WRITE buffer")
     parser.add_argument("--field-sep",
                         "--fieldsep",
                         nargs='*',
                         default=None,
                         choices=[
                             'TAB', 'SPACE', 'DBLSPACE', 'COMMA',
                             'MIXED', 'PIPE', 'AT', 'UNDER', 'DBLUNDER'
                         ],
                         help=("FASTA field separator; assumes "
                               "'>database accession locus' format"))
     parser.add_argument("--contig-field",
                         "--contigfield",
                         type=int,
                         help=("When headers are split by --field-sep, "
                               "the 0-based index of the contig id."))
     parser.add_argument(
         "--contig-by-file",
         "--contigbyfile",
         action="store_true",
         help=("Contigs are designated by separate files."))
     parser.add_argument("--sample-field",
                         "--samplefield",
                         type=int,
                         help=("when headers are split by --field-sep, "
                               "the 0-based index of the sample id"))
     parser.add_argument("--manual-coord",
                         "--manualcoord",
                         nargs='*',
                         help=("manually specify reference coordinates "
                               "for each file in the format "
                               "CONTIGID:START..STOP, ..."))
     parser.addarg_overwrite()
     return parser
示例#13
0
 def generate_argparser():
     """Generate argparse parser
     """
     pallette = Pallette()
     parser = MvfArgumentParser()
     parser.addarg_mvf()
     parser.add_argument("--out-prefix",
                         "--outprefix",
                         help="Output prefix (not required).")
     parser.addarg_sample_indices(nmin=3)
     parser.addarg_sample_labels(nmin=3)
     parser.addarg_outgroup_indices(nmin=1)
     parser.addarg_outgroup_labels(nmin=1)
     parser.addarg_windowsize()
     parser.add_argument(
         "--contig-labels",
         "--contiglabels",
         nargs=1,
         help=("Enter the ids of one or more contigs in the "
               "order they will appear in the chromoplot (as "
               "comma-separated list)"
               "(defaults to all ids in order present in MVF)"))
     parser.add_argument(
         "--contig-ids",
         "--contigids",
         "--contigs",
         nargs=1,
         help=("Enter the labels of one or more contigs in the "
               "order they will appear in the chromoplot (as "
               "comma-separated list)"
               "(defaults to all ids in order present in MVF)"))
     parser.add_argument(
         "--majority",
         action="store_true",
         help=("Plot only 100% shading in the majority track "
               " rather than shaded proportions in all tracks."))
     parser.add_argument(
         "--info-track",
         "--infotrack",
         action="store_true",
         help=("Include an additional coverage information "
               "track that will show empty, uninformative, "
               "and informative loci. (Useful for "
               "ranscriptomes/RAD or other reduced sampling."))
     parser.add_argument("--empty-mask",
                         "--emptymask",
                         choices=pallette.colornames,
                         default="none",
                         help="Mask empty regions with this color.")
     parser.add_argument(
         "--yscale",
         default=20,
         type=int,
         help=("Height (in number of pixels) for each track"))
     parser.add_argument(
         "--xscale",
         default=1,
         type=int,
         help="Width (in number of pixels) for each window")
     parser.add_argument("--colors",
                         nargs=3,
                         choices=pallette.colornames,
                         help="three colors to use for chromoplot")
     parser.add_argument(
         "--plot-type",
         "--plottype",
         choices=["graph", "image"],
         default="image",
         help=("PNG image (default) or graph via matplotlib "
               "(experimental)"))
     return parser
示例#14
0
 def generate_argparser():
     """Generate argparse parser
     """
     parser = MvfArgumentParser()
     parser.addarg_mvf()
     parser.add_argument("--out",
                         type=os.path.abspath,
                         help="Output Phylip file.",
                         required=True)
     parser.addarg_regions()
     parser.add_argument(
         "--label-type",
         "--labeltype",
         choices=('long', 'short'),
         default='short',
         help="Long labels with all metadata or short ids")
     parser.add_argument("--output-data",
                         "--outputdata",
                         choices=("dna", "rna", "prot"),
                         help="Output dna, rna or prot data.")
     parser.addarg_sample_indices()
     parser.addarg_sample_labels()
     parser.add_argument(
         "--buffer",
         type=int,
         default=100000,
         help="size (bp) of write buffer for each sample")
     parser.add_argument(
         "--temp_dir",
         "--tempdir",
         default=".",
         help="directory to write temporary fasta files")
     parser.add_argument("--partition",
                         action="store_true",
                         help=("Output a CSV partitions file with RAxML"
                               "formatting for use in partitioned "
                               "phylogenetic methods."))
     return parser
示例#15
0
 def generate_argparser():
     """Generate argparse parser
     """
     parser = MvfArgumentParser()
     parser.addarg_mvf()
     parser.addarg_out()
     parser.addarg_sample_indices()
     parser.addarg_sample_labels()
     parser.addarg_contig_ids()
     parser.addarg_contig_labels()
     parser.addarg_windowsize()
     parser.add_argument("--raxml-outgroups",
                         "--raxmloutgroups",
                         help=("Comma-separated list of outgroup "
                               "taxon labels to use in RAxML."))
     parser.add_argument("--root-with",
                         "--rootwith",
                         help=("Comma-separated list of taxon labels "
                               "to root trees with after RAxML"))
     parser.add_argument("--output-contig-labels",
                         "--outputcontiglabels",
                         action="store_true",
                         help=("Output will use contig labels "
                               "instead of id numbers."))
     parser.add_argument("--output-empty",
                         "--outputempty",
                         action="store_true",
                         help=("Include entries of windows "
                               "with no data in output."))
     parser.add_argument(
         "--choose-allele",
         "--chooseallele",
         "--hapmode",
         default="none",
         dest="choose_allele",
         choices=[
             "none", "randomone", "randomboth", "major", "minor",
             "majorminor"
         ],
         help=("Chooses how heterozygous alleles are "
               "handled. (none=no splitting (default); "
               "randomone=pick one allele randomly "
               "(recommended); randomboth=pick two alleles "
               "randomly, but keep both; major=pick the "
               "more common allele; minor=pick the less "
               "common allele; majorminor= pick the major in "
               "'a' and minor in 'b'"))
     parser.add_argument("--min-sites",
                         "--minsites",
                         type=int,
                         default=100,
                         help="minimum number of sites ")
     parser.add_argument(
         "--min-seq-coverage",
         "--minseqcoverage",
         type=float,
         default=0.1,
         help=("proportion of total alignment a sequence"
               "must cover to be retianed [0.1]"))
     parser.add_argument("--min-depth",
                         "--mindepth",
                         type=int,
                         default=4,
                         help=("minimum number of alleles per site"))
     parser.add_argument(
         "--bootstrap",
         type=int,
         help=("turn on rapid bootstrapping for RAxML and "
               "perform specified number of replicates"))
     parser.add_argument("--raxml-model",
                         "--raxmlmodel",
                         default="GTRGAMMA",
                         help=("choose RAxML model"))
     parser.add_argument("--raxml-path",
                         "--raxmlpath",
                         default="raxml",
                         help="RAxML path for manual specification.")
     parser.add_argument(
         "--raxml-opts",
         "--raxmlopts",
         default="",
         help=("specify additional RAxML arguments as a "
               "double-quotes encased string"))
     parser.add_argument(
         "--duplicate-seq",
         "--duplicateseq",
         default="dontuse",
         choices=["dontuse", "keep", "remove"],
         help=("dontuse=remove duplicate sequences prior to "
               "RAxML tree inference, then add them to the "
               "tree manually as zero-branch-length sister "
               "taxa; keep=keep in for RAxML tree inference "
               "(may cause errors for RAxML); "
               "remove=remove entirely from alignment"))
     parser.add_argument("--temp-dir",
                         "--tempdir",
                         default='./raxmltemp',
                         type=os.path.abspath,
                         help=("Temporary directory path"))
     parser.add_argument("--temp-prefix",
                         "--tempprefix",
                         default="mvftree",
                         help=("Temporary file prefix"))
     return parser
示例#16
0
 def generate_argparser():
     """Generate argparse parser
     """
     parser = MvfArgumentParser()
     parser.addarg_mvf()
     parser.addarg_gff()
     parser.addarg_out()
     parser.addarg_samples()
     parser.addarg_windowsize()
     parser.addarg_mincoverage()
     parser.add_argument(
         "--allele-groups",
         "--allelegroups",
         nargs='*',
         help=("GROUP1:LABEL,LABEL GROUP2:LABEL,LABEL "))
     parser.add_argument("--species-groups",
                         "--speciesgroups",
                         nargs='*')
     parser.add_argument(
         "--chi-test",
         "--chitest",
         help=("Input two number values for expected "
               "Nonsynonymous and Synonymous expected values."))
     parser.add_argument(
         "--target",
         nargs="*",
         help=("Specify the taxa labels that define the "
               "target lineage-specific branch to be tested."))
     parser.add_argument("--num-target-species",
                         "--targetspec",
                         type=int,
                         default=1,
                         help=("Specify the minimum number of "
                               "taxa in the target set "
                               "that are required to conduct analysis"))
     parser.add_argument("--output-align",
                         "--outputalign",
                         help=("Output alignment to this file path in "
                               "phylip format."))
     parser.add_argument(
         "--outgroup",
         help=("Specify sample name with which to root trees."))
     parser.add_argument(
         "--use-labels",
         "--uselabels",
         action="store_true",
         help="Use contig labels instead of IDs in output.")
     parser.add_argument("--codeml-path",
                         "--codemlpath",
                         default="codeml",
                         type=os.path.abspath,
                         help="Full path for PAML codeml executable.")
     parser.add_argument("--raxml-path",
                         "--raxmlpath",
                         type=os.path.abspath,
                         default="raxml",
                         help="Full path to RAxML program executable.")
     parser.add_argument("--start-contig",
                         "--startcontig",
                         type=int,
                         default=0,
                         help="Numerical ID for the starting contig.")
     parser.add_argument("--end-contig",
                         "--endcontig",
                         type=int,
                         default=100000000,
                         help="Numerical id for the ending contig.")
     parser.add_argument(
         "--paml-tmp",
         "--pamltmp",
         default="pamltmp",
         type=os.path.abspath,
         help="path for temporary folder for PAML output files")
     parser.add_argument(
         "--all-sample-trees",
         "--allsampletrees",
         action="store_true",
         help=("Makes trees from all samples instead of "
               "only the most complete sequence from "
               "each species"))
     parser.add_argument(
         "--branch-lrt",
         "--branchlrt",
         type=os.path.abspath,
         help=("Specify the output file for and turn on the "
               "RAxML-PAML format LRT test scan for "
               "selection on the target branch in addition "
               "to the basic patterns scan"))
     parser.add_argument("--verbose",
                         action="store_true",
                         help="additional screen output")
     return parser
示例#17
0
 def generate_argparser():
     """Generate argparse parser
     """
     parser = MvfArgumentParser()
     parser.addarg_mvf()
     parser.addarg_out()
     parser.add_argument(
         "--actions",
         nargs='*',
         help=("set of actions:args to perform, "
               "note these are done in order as listed"))
     parser.add_argument("--labels",
                         action="store_true",
                         help="use sample labels instead of indices")
     parser.add_argument("--test",
                         help="manually input a line for testing")
     parser.add_argument("--test-nchar",
                         "--textnchar",
                         type=int,
                         help="total number of samples for test string")
     parser.add_argument(
         "--more-help",
         "--morehelp",
         action="store_true",
         help="prints full module list and descriptions")
     parser.addarg_linebuffer()
     parser.add_argument("--verbose",
                         action="store_true",
                         help="report every line (for debugging)")
     parser.addarg_overwrite()
     return parser