Skip to content

Commit

Permalink
add_option => add_argument
Browse files Browse the repository at this point in the history
  • Loading branch information
tanghaibao committed May 1, 2024
1 parent b65bbbd commit 3cfb1ff
Show file tree
Hide file tree
Showing 105 changed files with 1,147 additions and 1,099 deletions.
6 changes: 3 additions & 3 deletions jcvi/algorithms/supermap.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ def supermap(blast_file, filter="intersection", dialect="blast", clip=0):

filter_choices = ("ref", "query", "intersection", "union")
dialect_choices = ("blast", "coords")
p.add_option(
p.add_argument(
"--filter",
choices=filter_choices,
default="intersection",
help="Available filters",
)
p.add_option("--dialect", choices=dialect_choices, help="Input format")
p.add_option(
p.add_argument("--dialect", choices=dialect_choices, help="Input format")
p.add_argument(
"--clip",
default=0,
type=int,
Expand Down
8 changes: 4 additions & 4 deletions jcvi/annotation/ahrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def fix(args):
Fix ugly names from Uniprot.
"""
p = OptionParser(fix.__doc__)
p.add_option(
p.add_argument(
"--ignore_sym_pat",
default=False,
action="store_true",
Expand Down Expand Up @@ -650,19 +650,19 @@ def batch(args):
ahrd_weights = {"blastp": [0.5, 0.3, 0.2], "blastx": [0.6, 0.4, 0.0]}
blast_progs = tuple(ahrd_weights.keys())

p.add_option(
p.add_argument(
"--path",
default="~/code/AHRD/",
help="Path where AHRD is installed",
)
p.add_option(
p.add_argument(
"--blastprog",
default="blastp",
choices=blast_progs,
help="Specify the blast program being run. Based on this option,"
+ " the AHRD parameters (score_weights) will be modified",
)
p.add_option(
p.add_argument(
"--iprscan",
default=None,
help="Specify path to InterProScan results file if available."
Expand Down
24 changes: 14 additions & 10 deletions jcvi/annotation/automaton.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,13 @@ def augustus(args):
annotation.reformat.augustus().
"""
p = OptionParser(augustus.__doc__)
p.add_option("--species", default="maize", help="Use species model for prediction")
p.add_option("--hintsfile", help="Hint-guided AUGUSTUS")
p.add_option("--nogff3", default=False, action="store_true", help="Turn --gff3=off")
p.add_argument(
"--species", default="maize", help="Use species model for prediction"
)
p.add_argument("--hintsfile", help="Hint-guided AUGUSTUS")
p.add_argument(
"--nogff3", default=False, action="store_true", help="Turn --gff3=off"
)
p.set_home("augustus")
p.set_cpus()
opts, args = p.parse_args(args)
Expand Down Expand Up @@ -112,7 +116,7 @@ def star(args):
Run star on a folder with reads.
"""
p = OptionParser(star.__doc__)
p.add_option(
p.add_argument(
"--single", default=False, action="store_true", help="Single end mapping"
)
p.set_fastq_names()
Expand Down Expand Up @@ -163,7 +167,7 @@ def cufflinks(args):
Run cufflinks on a folder containing tophat results.
"""
p = OptionParser(cufflinks.__doc__)
p.add_option("--gtf", help="Reference annotation")
p.add_argument("--gtf", help="Reference annotation")
p.set_cpus()
opts, args = p.parse_args(args)

Expand Down Expand Up @@ -219,23 +223,23 @@ def tophat(args):
from jcvi.formats.fastq import guessoffset

p = OptionParser(tophat.__doc__)
p.add_option("--gtf", help="Reference annotation")
p.add_option(
p.add_argument("--gtf", help="Reference annotation")
p.add_argument(
"--single", default=False, action="store_true", help="Single end mapping"
)
p.add_option(
p.add_argument(
"--intron",
default=15000,
type=int,
help="Max intron size",
)
p.add_option(
p.add_argument(
"--dist",
default=-50,
type=int,
help="Mate inner distance",
)
p.add_option(
p.add_argument(
"--stdev",
default=50,
type=int,
Expand Down
4 changes: 2 additions & 2 deletions jcvi/annotation/depth.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ def bed(args):
Write bed files where the bases have at least certain depth.
"""
p = OptionParser(bed.__doc__)
p.add_option(
p.add_argument(
"-o",
dest="output",
default="stdout",
help="Output file name",
)
p.add_option(
p.add_argument(
"--cutoff",
dest="cutoff",
default=10,
Expand Down
8 changes: 4 additions & 4 deletions jcvi/annotation/maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def batcheval(args):
from jcvi.formats.gff import make_index

p = OptionParser(evaluate.__doc__)
p.add_option(
p.add_argument(
"--type",
default="CDS",
help="list of features to extract, use comma to separate (e.g."
Expand Down Expand Up @@ -450,17 +450,17 @@ def split(args):
from jcvi.formats.bed import Bed

p = OptionParser(split.__doc__)
p.add_option(
p.add_argument(
"--key",
default="Name",
help="Key in the attributes to extract predictor.gff",
)
p.add_option(
p.add_argument(
"--parents",
default="match",
help="list of features to extract, use comma to separate (e.g.'gene,mRNA')",
)
p.add_option(
p.add_argument(
"--children",
default="match_part",
help="list of features to extract, use comma to separate (e.g."
Expand Down
16 changes: 8 additions & 8 deletions jcvi/annotation/pasa.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def assemble(args):
"""
p = OptionParser(assemble.__doc__)
p.set_pasa_opts()
p.add_option(
p.add_argument(
"--prepare",
default=False,
action="store_true",
Expand Down Expand Up @@ -228,7 +228,7 @@ def compare(args):
"""
p = OptionParser(compare.__doc__)
p.set_pasa_opts(action="compare")
p.add_option(
p.add_argument(
"--prepare",
default=False,
action="store_true",
Expand Down Expand Up @@ -320,7 +320,7 @@ def longest(args):
from jcvi.formats.sizes import Sizes

p = OptionParser(longest.__doc__)
p.add_option(
p.add_argument(
"--prefix",
default="pasa",
help="Replace asmbl_ with prefix",
Expand Down Expand Up @@ -393,31 +393,31 @@ def consolidate(args):

supported_modes = ["name", "coords"]
p = OptionParser(consolidate.__doc__)
p.add_option(
p.add_argument(
"--slop",
default=False,
action="store_true",
help="allow minor variation in terminal 5'/3' UTR start/stop position",
)
p.add_option(
p.add_argument(
"--inferUTR",
default=False,
action="store_true",
help="infer presence of UTRs from exon coordinates",
)
p.add_option(
p.add_argument(
"--mode",
default="name",
choices=supported_modes,
help="method used to determine overlapping loci",
)
p.add_option(
p.add_argument(
"--summary",
default=False,
action="store_true",
help="Generate summary table of consolidation process",
)
p.add_option(
p.add_argument(
"--clusters",
default=False,
action="store_true",
Expand Down
8 changes: 4 additions & 4 deletions jcvi/annotation/qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,26 +165,26 @@ def trimUTR(args):
from jcvi.formats.base import SetFile

p = OptionParser(trimUTR.__doc__)
p.add_option(
p.add_argument(
"--trim5",
default=None,
type=str,
help="File containing gene list for 5' UTR trimming",
)
p.add_option(
p.add_argument(
"--trim3",
default=None,
type=str,
help="File containing gene list for 3' UTR trimming",
)
p.add_option(
p.add_argument(
"--trimrange",
default=None,
type=str,
help="File containing gene list for UTR trim back"
+ "based on suggested (start, stop) coordinate range",
)
p.add_option(
p.add_argument(
"--refgff",
default=None,
type=str,
Expand Down
38 changes: 19 additions & 19 deletions jcvi/annotation/reformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ def plot(args):
from jcvi.graphics.chromosome import ChromosomeMap

p = OptionParser(plot.__doc__)
p.add_option("--firstn", type=int, help="Only plot the first N genes")
p.add_option("--ymax", type=int, help="Y-axis max value")
p.add_option("--log", action="store_true", help="Write plotting data")
p.add_argument("--firstn", type=int, help="Only plot the first N genes")
p.add_argument("--ymax", type=int, help="Y-axis max value")
p.add_argument("--log", action="store_true", help="Write plotting data")
opts, args, iopts = p.set_image_options(args, figsize="6x4")

if len(args) != 2:
Expand Down Expand Up @@ -305,7 +305,7 @@ def instantiate(args):
"""
p = OptionParser(instantiate.__doc__)
p.set_annot_reformat_opts()
p.add_option(
p.add_argument(
"--extended_stride",
default=False,
action="store_true",
Expand Down Expand Up @@ -594,13 +594,13 @@ def annotate(args):
valid_resolve_choices = ["alignment", "overlap"]

p = OptionParser(annotate.__doc__)
p.add_option(
p.add_argument(
"--resolve",
default="alignment",
choices=valid_resolve_choices,
help="Resolve ID assignment based on a certain metric",
)
p.add_option(
p.add_argument(
"--atg_name",
default=False,
action="store_true",
Expand All @@ -611,14 +611,14 @@ def annotate(args):
"Optional parameters (alignment):\n"
+ "Use if resolving ambiguities based on sequence `alignment`",
)
g1.add_option(
g1.add_argument(
"--pid",
dest="pid",
default=35.0,
type=float,
help="Percent identity cutoff",
)
g1.add_option(
g1.add_argument(
"--score",
dest="score",
default=250.0,
Expand All @@ -631,21 +631,21 @@ def annotate(args):
+ "Use if resolving ambiguities based on `overlap` length\n"
+ "Parameters equivalent to `intersectBed`",
)
g2.add_option(
g2.add_argument(
"-f",
dest="f",
default=0.5,
type=float,
help="Minimum overlap fraction (0.0 - 1.0)",
)
g2.add_option(
g2.add_argument(
"-r",
dest="r",
default=False,
action="store_true",
help="Require fraction overlap to be reciprocal",
)
g2.add_option(
g2.add_argument(
"-s",
dest="s",
default=True,
Expand Down Expand Up @@ -944,34 +944,34 @@ def rename(args):
import string

p = OptionParser(rename.__doc__)
p.add_option(
p.add_argument(
"-a",
dest="gene_increment",
default=10,
type=int,
help="Increment for continuous genes",
)
p.add_option(
p.add_argument(
"-b",
dest="gap_increment",
default=1000,
type=int,
help="Increment for gaps",
)
p.add_option(
p.add_argument(
"--pad0",
default=6,
type=int,
help="Pad gene identifiers with 0",
)
p.add_option(
p.add_argument(
"--spad0",
default=4,
type=int,
help="Pad gene identifiers on small scaffolds",
)
p.add_option("--prefix", default="Bo", help="Genome prefix")
p.add_option(
p.add_argument("--prefix", default="Bo", help="Genome prefix")
p.add_argument(
"--jgi",
default=False,
action="store_true",
Expand Down Expand Up @@ -1072,7 +1072,7 @@ def reindex(args):
from tempfile import mkstemp

p = OptionParser(reindex.__doc__)
p.add_option(
p.add_argument(
"--scores", type=str, help="read from existing EMBOSS `needle` scores file"
)
p.set_outfile()
Expand Down Expand Up @@ -1235,7 +1235,7 @@ def publocus(args):
Medtr1g007060.2 MTR_1g007060B
"""
p = OptionParser(publocus.__doc__)
p.add_option("--locus_tag", default="MTR_", help="GenBank locus tag")
p.add_argument("--locus_tag", default="MTR_", help="GenBank locus tag")
opts, args = p.parse_args(args)

if len(args) != 1:
Expand Down
Loading

0 comments on commit 3cfb1ff

Please sign in to comment.