Exemplo n.º 1
0
def getUI(prog_name, args):
    longDescription = "..."
    shortDescription = longDescription

    ui = CLI(prog_name, shortDescription, longDescription)
    ui.minArgs = 2
    ui.maxArgs = 2
    ui.addOption(
        Option(short="o",
               long="output",
               argName="filename",
               description="output resultant reads to these files",
               required=False,
               type=str))
    ui.addOption(
        Option(short="v",
               long="verbose",
               description="output additional messages to stderr " +
               "about run.",
               required=False))
    ui.addOption(
        Option(short="h", long="help", description="show this help message "))
    ui.addOption(Option(short="u", long="test", description="run unit tests "))

    ui.parseCommandLine(args)
    return ui
Exemplo n.º 2
0
def getUI_lookup_index(prog_name, args):
    """
  build and return a UI object for the 'build' option.

  :param args: raw arguments to parse
  """
    programName = prog_name
    long_description = "Build an index for one or more files."
    short_description = long_description

    ui = CLI(programName, short_description, long_description)
    ui.minArgs = 2
    ui.maxArgs = 2
    ui.addOption(
        Option(short="o",
               long="output",
               argName="filename",
               description="output to given file, else stdout",
               required=False,
               type=str))
    ui.addOption(
        Option(short="k",
               long="key",
               argName="key",
               description="the key to lookup; if missing, the " +
               "program runs in interactive mode. ",
               required=False,
               type=str))
    ui.addOption(
        Option(short="t",
               long="type",
               argName="filename",
               description="the type of the file. If missing, " +
               "the script will try to guess the file type. " +
               "Supported file types are: " +
               ", ".join([f.name for f in FileType]),
               required=False,
               type=str))
    ui.addOption(
        Option(short="v",
               long="verbose",
               description="output additional messages to stderr " +
               "about run (default: " + str(DEFAULT_VERBOSITY) + ")",
               default=DEFAULT_VERBOSITY,
               required=False))
    ui.addOption(
        Option(short="h",
               long="help",
               description="show this help message ",
               special=True))
    ui.addOption(
        Option(short="u",
               long="test",
               description="run unit tests ",
               special=True))

    ui.parseCommandLine(args)
    return ui
Exemplo n.º 3
0
def getUI(prog_name, args):
    longDescription = "Given two files consisting of mapped reads, remove " +\
                      "the reads that are in both mapped in exonic regions " +\
                      "and junction regions "
    shortDescription = "Filter ambigious reads"

    ui = CLI(prog_name, shortDescription, longDescription)
    ui.minArgs = -1
    ui.maxArgs = -1
    ui.addOption(
        Option(short="f",
               long="first",
               argName="filename",
               description="BED file with first end reads",
               required=True,
               type=str))
    ui.addOption(
        Option(short="s",
               long="second",
               argName="filename",
               description="BED file with second end reads",
               required=True,
               type=str))
    ui.addOption(
        Option(short="o",
               long="output",
               argName="filename",
               description="whitespace separated list of output" +
               " filenames, wrap in commas. Expect two" +
               " filenames here, one for each input.",
               required=True,
               type=str))
    ui.addOption(
        Option(short="v",
               long="verbose",
               description="outputs additional messages to stdout " +
               "about run (default: " + str(DEFAULT_VERBOSITY) + ")",
               default=DEFAULT_VERBOSITY,
               required=False))
    ui.addOption(
        Option(short="b",
               long="best",
               description="keep clearly " + "better ambiguously mapped reads",
               required=False))
    ui.addOption(
        Option(short="h",
               long="help",
               description="show this help message",
               special=True))
    ui.addOption(
        Option(short="u",
               long="test",
               description="run unit tests",
               special=True))

    ui.parseCommandLine(args)
    return ui
Exemplo n.º 4
0
def getUI(args):
    """
  build and return a UI object for this script.

  :param args: raw arguments to parse
  """
    programName = os.path.basename(sys.argv[0])
    longDescription = "takes a file with a list of p-values and applies " +\
                      "Benjamini and Hochberg FDR to convert to q-values "
    shortDescription = "takes a file with a list of p-values and applies " +\
                       "Benjamini and Hochberg FDR to convert to q-values "

    ui = CLI(programName, shortDescription, longDescription)
    ui.minArgs = 0
    ui.maxArgs = 1
    ui.addOption(
        Option(short="o",
               long="output",
               argName="filename",
               description="output to given file, else stdout",
               required=False,
               type=str))
    ui.addOption(
        Option(short="f",
               long="field",
               argName="number",
               description="the field that contains the p-values " +
               "(indexed from 1, as with unix 'cut' " + "command)",
               default=4,
               required=False,
               type=int))
    ui.addOption(
        Option(short="e",
               long="header",
               description="take the first line as a header ",
               default=False,
               required=False))
    ui.addOption(
        Option(short="v",
               long="verbose",
               description="output additional messages to stderr " +
               "about run (default: " + str(DEFAULT_VERBOSITY) + ")",
               default=DEFAULT_VERBOSITY,
               required=False))
    ui.addOption(
        Option(short="h",
               long="help",
               description="show this help message ",
               special=True))
    ui.addOption(
        Option(short="u",
               long="test",
               description="run unit tests ",
               special=True))

    ui.parseCommandLine(args)
    return ui
Exemplo n.º 5
0
def getUI(prog_name, args):
    """Build and return user interface object for this script."""
    longDescription = "Given a set of BED intervals, pile them up so that " +\
                      "their start positions are aligned and then count the " +\
                      "number of other regions that overlap them."
    shortDescription = longDescription

    ui = CLI(prog_name, shortDescription, longDescription)
    # gotta have two args -- MAF dir/file and BED regions.
    # Input by stdin not allowed
    ui.minArgs = 2
    ui.maxArgs = 2
    ui.addOption(
        Option(short="o",
               long="output",
               argName="filename",
               description="output to given file, else stdout",
               required=False,
               type=str))
    ui.addOption(
        Option(short="a",
               long="anchor",
               argName="anchor-point",
               description="5-prime, start",
               required=False,
               type=str))
    ui.addOption(
        Option(short="v",
               long="verbose",
               description="output additional messages to stderr " +
               "about run",
               required=False))
    ui.addOption(
        Option(short="n",
               long="normalize",
               description="normalize counts by number of regions " +
               "overlapping that position",
               required=False))
    ui.addOption(
        Option(short="h",
               long="help",
               description="show this help message ",
               special=True))
    ui.addOption(
        Option(short="u",
               long="test",
               description="run unit tests ",
               special=True))

    ui.parseCommandLine(args)
    return ui
Exemplo n.º 6
0
def getUI(args):
    """
  build and return a UI object for this script.

  :param args: raw arguments to parse
  """
    programName = os.path.basename(sys.argv[0])
    longDescription = "takes a file with a list of p-values and applies " +\
                      "Benjamini and Hochberg FDR to convert to q-values "
    shortDescription = "takes a file with a list of p-values and applies " +\
                       "Benjamini and Hochberg FDR to convert to q-values "

    ui = CLI(programName, shortDescription, longDescription)
    ui.minArgs = 2
    ui.maxArgs = 2
    ui.addOption(
        Option(short="o",
               long="output",
               argName="filename",
               description="output to given file, else stdout",
               required=False,
               type=str))
    ui.addOption(
        Option(short="s",
               long="stranded",
               description="treat regions on separate strands as " +
               "disjoint, even if they overlap",
               required=False))
    ui.addOption(
        Option(short="v",
               long="verbose",
               description="output additional messages to stderr " +
               "about run",
               required=False))
    ui.addOption(
        Option(short="h",
               long="help",
               description="show this help message ",
               special=True))
    ui.addOption(
        Option(short="u",
               long="test",
               description="run unit tests ",
               special=True))

    ui.parseCommandLine(args)
    return ui
Exemplo n.º 7
0
def getUI(args):
    """
  build and return a UI object for this script.

  :param args: raw arguments to parse
  """
    programName = os.path.basename(sys.argv[0])
    longDescription = "Compute the Jaccard index for two sets of genomic " +\
                      "intervals."
    shortDescription = longDescription

    ui = CLI(programName, shortDescription, longDescription)
    ui.minArgs = 2
    ui.maxArgs = 2
    ui.addOption(
        Option(short="v",
               long="verbose",
               description="output additional messages to stderr " +
               "about run",
               required=False))
    ui.addOption(
        Option(short="s",
               long="stranded",
               description="treat regions on separate strands as " +
               "disjoint, even if they overlap",
               required=False))
    ui.addOption(
        Option(short="h",
               long="help",
               description="show this help message ",
               special=True))
    ui.addOption(
        Option(short="u",
               long="test",
               description="run unit tests ",
               special=True))

    ui.parseCommandLine(args)
    return ui
Exemplo n.º 8
0
def getUI(prog_name, args):
    longDescription = "Convert junction reads into exonic reads by picking " +\
                      "an exon to assign them to"
    shortDescription = longDescription

    ui = CLI(prog_name, shortDescription, longDescription)
    ui.minArgs = 0
    ui.maxArgs = 1
    ui.addOption(
        Option(short="o",
               long="output",
               argName="filename",
               description="output resultant reads to these files",
               required=False,
               type=str))
    ui.addOption(
        Option(short="v",
               long="verbose",
               description="output additional messages to stderr " +
               "about run (default: " + str(DEFAULT_VERBOSITY) + ")",
               default=DEFAULT_VERBOSITY,
               required=False))
    ui.addOption(
        Option(short="s",
               long="scheme",
               argName="TYPE",
               description="scheme for assigning reads to " +
               "junctions, one of FIRST_EXON, " +
               "SECOND_EXON, BOTH_EXONS, BIGGEST_EXON",
               default=DEFAULT_SCHEME,
               required=False,
               type=str))
    ui.addOption(
        Option(short="h", long="help", description="show this help message "))
    ui.addOption(Option(short="u", long="test", description="run unit tests "))

    ui.parseCommandLine(args)
    return ui
Exemplo n.º 9
0
def getUI(prog_name, args):
    longDescription = "compute the nucleotide frequency at each position in " +\
                      "a fastq file"
    shortDescription = longDescription

    ui = CLI(prog_name, shortDescription, longDescription)
    ui.minArgs = 1
    ui.maxArgs = 1
    ui.addOption(
        Option(short="o",
               long="output",
               argName="filename",
               description="output resultant table to this file. " +
               "If omitted, output is to stdout",
               required=False,
               type=str))
    ui.addOption(
        Option(short="h",
               long="help",
               description="show this help message ",
               special=True))
    ui.addOption(
        Option(short="v",
               long="verbose",
               description="outputs additional messages to stdout " +
               "about run (default: " + str(DEFAULT_VERBOSITY) + ")",
               default=DEFAULT_VERBOSITY,
               required=False))
    ui.addOption(
        Option(short="u",
               long="test",
               description="run unit tests ",
               special=True))

    ui.parseCommandLine(args)
    return ui
Exemplo n.º 10
0
def getUI(prog_name, args):
    """Build and return user interface object for this script."""
    longDescription = "Given a set of BED intervals, compute a profile of " +\
                      "conservation by averaging over all intervals using a " +\
                      "whole genome alignment to a set of relevent species." +\
                      "\n\n" +\
                      "Usage: " + prog_name + " [options] regions.bed " +\
                      "genome-alig species" +\
                      "\n\n" +\
                      "genome-alig can be either a single MAF file, or a " +\
                      "directory of MAF files. In the latter case, the " +\
                      "directory may also optionally contain index files for " +\
                      "the alignment files."
    shortDescription = longDescription

    ui = CLI(prog_name, shortDescription, longDescription)
    # gotta have two args -- MAF dir/file and BED regions.
    # Input by stdin not allowed
    ui.minArgs = 3
    ui.maxArgs = 4
    ui.addOption(
        Option(short="o",
               long="output",
               argName="filename",
               description="output to given file, else stdout",
               required=False,
               type=str))
    ui.addOption(
        Option(short="w",
               long="window",
               argName="size",
               description="size of window to compute around each " +
               "interval; " + str(DEFAULT_WINDOW_SIZE) +
               " to use whole interval. " + "Default " +
               str(DEFAULT_WINDOW_SIZE),
               required=False,
               type=int))
    ui.addOption(
        Option(short="e",
               long="extensions",
               argName="extension",
               description="if genome-alig specifies a directory, " +
               "treat files with this extension as " + "alignment files.",
               required=False,
               type=str))
    ui.addOption(
        Option(short="i",
               long="index-extensions",
               argName="extension",
               description="if genome-alig specifies a directory, " +
               "treat files with this extension as " +
               "index files for alignments.",
               required=False,
               type=str))
    ui.addOption(
        Option(short="f",
               long="fail-no-index",
               description="fail if an alignment file without an " +
               "index is found; otherwise index-less " +
               "alignment files are loaded whole (which " +
               "might be slow if they're large, and " +
               "might require a lot of memory)",
               default=False,
               required=False))
    ui.addOption(
        Option(short="m",
               long="missing",
               argName="strategy",
               description="how to treat missing sequences in " +
               "blocks. Options are " +
               ", ".join([str(x.name) for x in MissingSequenceHandler]),
               required=False,
               type=str))
    ui.addOption(
        Option(short="s",
               long="species",
               argName="species",
               description="consider only these species. Default is " + "all.",
               required=False,
               type=str))
    ui.addOption(
        Option(short="v",
               long="verbose",
               description="output additional messages to stderr " +
               "about run (default: " + str(DEFAULT_VERBOSITY) + ")",
               default=DEFAULT_VERBOSITY,
               required=False))
    ui.addOption(
        Option(short="h",
               long="help",
               description="show this help message ",
               special=True))
    ui.addOption(
        Option(short="u",
               long="test",
               description="run unit tests ",
               special=True))

    ui.parseCommandLine(args)
    return ui
Exemplo n.º 11
0
def getUI(args, prog_name):
    """
  build and return a UI object for this script.

  :param args: raw arguments to parse
  """
    longDescription = "Collapse the regions in a file of genomic intervals "
    shortDescription = longDescription

    ui = CLI(prog_name, shortDescription, longDescription)
    ui.minArgs = 1
    ui.maxArgs = 1
    ui.addOption(
        Option(short="o",
               long="output",
               argName="filename",
               description="output to given file, else stdout",
               required=False,
               type=str))
    ui.addOption(
        Option(short="s",
               long="stranded",
               description="collapse positive and negative " +
               "strands independently (otherwise strand " +
               "is ignored and all output regions are on " + "positive strand",
               default=False,
               required=False))
    ui.addOption(
        Option(short="a",
               long="accumulate_names",
               description="accumulate names of the regions, " +
               "separated by semi-colon (otherwise " +
               "all output region names will be 'X').",
               default=False,
               required=False))
    ui.addOption(
        Option(short="e",
               long="exact",
               description="collapse only regions with exactly the " +
               " same genomic location (otherwise any " +
               "overlapping regions are collapsed)",
               default=False,
               required=False))
    ui.addOption(
        Option(short="v",
               long="verbose",
               description="output additional messages to stderr " +
               "about run (default: " + str(DEFAULT_VERBOSITY) + ")",
               default=DEFAULT_VERBOSITY,
               required=False))
    ui.addOption(
        Option(short="h",
               long="help",
               description="show this help message ",
               special=True))
    ui.addOption(
        Option(short="u",
               long="test",
               description="run unit tests ",
               special=True))

    ui.parseCommandLine(args)
    return ui