def main():
    usage = "usage: %prog outputSequenceDir configXMLFile inputSequenceFastaFilesxN [options]"
    parser = OptionParser(usage=usage)
    Stack.addJobTreeOptions(parser)

    options, args = parser.parse_args()
    setLoggingFromOptions(options)

    if len(args) < 3:
        raise RuntimeError("Too few input arguments: %s" % " ".join(args))

    outputSequenceDir = args[0]
    configFile = args[1]
    inputSequences = args[2:]

    # Replace any constants
    configNode = ET.parse(configFile).getroot()
    if configNode.find("constants") != None:
        ConfigWrapper(configNode).substituteAllPredefinedConstantsWithLiterals()

    Stack(
        CactusPreprocessor(
            inputSequences, CactusPreprocessor.getOutputSequenceFiles(inputSequences, outputSequenceDir), configNode
        )
    ).startJobTree(options)
def parseArgs(args):
    parser = ArgumentParser(description=__doc__)
    parser.add_argument('testRegionsDir',
                        help="directory containing test regions",
                        type=os.path.abspath)
    parser.add_argument('label',
                        help="A label for this run")
    parser.add_argument('--tests',
                        help="list of tests to run (comma-separated)",
                        default=None)
    parser.add_argument('--progressiveCactusBranch',
                        help="branch of progressiveCactus to switch to",
                        default="master")
    parser.add_argument('--cactusBranch', help="branch of cactus to switch to",
                        default=None)
    parser.add_argument('--cactusConfigFile',
                        help="config xml to use instead of default",
                        default=None,
                        type=os.path.abspath)
    parser.add_argument('--outputDir',
                        help="dir to place test results in",
                        default="output",
                        type=os.path.abspath)
    Stack.addJobTreeOptions(parser)
    return parser.parse_args(args[1:])
def main():
    parser = OptionParser()
    Stack.addJobTreeOptions(parser)
    
    parser.add_option("--fileToSort", dest="fileToSort",
                      help="The file you wish to sort")
    
    parser.add_option("--N", dest="N",
                      help="The threshold below which a serial sort function is used to sort file. All lines must of length less than or equal to N or program will fail", 
                      default=10000)
    
    options, args = parser.parse_args()
    
    if options.fileToSort == None:
        raise RuntimeError("No file to sort given")

    if not os.path.exists(options.fileToSort):
        raise RuntimeError("File to sort does not exist: %s" % options.fileToSort)
    
    if int(options.N) <= 0:
        raise RuntimeError("Invalid value of N: %s" % options.N)
    
    if len(args) != 0:
        raise RuntimeError("Unrecognised input arguments: %s" % " ".join(args))
    
    #Now we are ready to run
    i = Stack(Setup(options.fileToSort, int(options.N))).startJobTree(options)
    
    if i:
        raise RuntimeError("The jobtree contained %i failed jobs" % i)
Exemple #4
0
def main():
    parser = build_parser()
    Stack.addJobTreeOptions(parser)
    args = parser.parse_args()
    setLoggingFromOptions(args)

    ilp_config = ilp_tuple(args.breakpoint_penalty, args.data_penalty,
                           args.expected_value_penalty, args.trash_penalty,
                           args.kmer_size)
    paths = paths_tuple(args.out_dir, args.aln_index, args.whitelist,
                        args.masked_ref, args.unmasked_ref, args.bad_kmers,
                        args.normalizing, args.key_file)
    try:
        cgquery_dict = pickle.load(open(args.cgquery_file))
    except IOError:
        raise IOError("Cgquery dict does not exist.")

    if not os.path.exists(paths.out_dir):
        os.makedirs(paths.out_dir)

    i = Stack(
        Target.makeTargetFn(build_analyses,
                            args=(paths, ilp_config,
                                  cgquery_dict))).startJobTree(args)

    if i != 0:
        raise RuntimeError("Got failed jobs")
Exemple #5
0
def main():
    ##########################################
    #Construct the arguments.
    ##########################################

    parser = OptionParser()
    
    parser.add_option("--host", dest="host")
    parser.add_option("--port", dest="port")
    parser.add_option("--databaseDir", dest="databaseDir")
    parser.add_option("--databaseOptions", dest="databaseOptions")
    parser.add_option("--keysPerJob", dest="keysPerJob")
    parser.add_option("--totalJobs", dest="totalJobs")
    parser.add_option("--minRecordSize", dest="minRecordSize")
    parser.add_option("--maxRecordSize", dest="maxRecordSize")
    parser.add_option("--test", dest="test", action="store_true",
                      help="Run doctest unit tests")
    
    Stack.addJobTreeOptions(parser)

    options, args = parser.parse_args()
    if options.test:
        _test()
    setLoggingFromOptions(options)

    if len(args) != 0:
        raise RuntimeError("Unrecognised input arguments: %s" % " ".join(args))
    
    Stack(AddKeysPhase(options)).startJobTree(options)
Exemple #6
0
def main():
    #Parse the inputs args/options
    parser = OptionParser(usage="usage: workingDir [options]",
                          version="%prog 0.1")
    options = Options()
    parser.add_option("--sequences",
                      dest="sequences",
                      help="Quoted list of fasta files containing sequences")
    parser.add_option("--alignments", dest="alignments", help="Cigar file ")
    addExpectationMaximisationOptions(parser, options)

    Stack.addJobTreeOptions(parser)
    options, args = parser.parse_args()
    setLoggingFromOptions(options)

    if len(args) != 0:
        raise RuntimeError("Expected no arguments, got %s arguments: %s" %
                           (len(args), " ".join(args)))

    #Log the inputs
    logger.info(
        "Got '%s' sequences, '%s' alignments file, '%s' output model and '%s' iterations of training"
        % (options.sequences, options.alignments, options.outputModel,
           options.iterations))

    #This line invokes jobTree
    i = Stack(
        Target.makeTargetFn(expectationMaximisationTrials,
                            args=(options.sequences, options.alignments,
                                  options.outputModel,
                                  options))).startJobTree(options)

    if i != 0:
        raise RuntimeError("Got failed jobs")
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("alignment", help="HAL alignment file")
    parser.add_argument("srcGenome", help="Reference genome")
    parser.add_argument("bedFile", help="Bed file (in ref coordinates)")
    parser.add_argument("destGenome", help="Genome to check contiguity in")
    parser.add_argument("outFile", help="Output BED file")
    parser.add_argument("--maxGap", help="maximum gap size to accept", 
                        default=100, type=int)
    parser.add_argument("--deletionGaps", help="care about deletion gaps",
                        default=False, action='store_true')
    parser.add_argument("--sliceNum", help="number of slices to create",
                        type=int, default=1)
    parser.add_argument("--maxIntronDiff", help="Maximum number of bases "
                        "that intron gaps are allowed to change by", type=int,
                        default=10000)
    parser.add_argument("--requiredMapFraction", help="Fraction of bases in "
                        "the query that need to map to the target to be "
                        "accepted", type=float, default=0.0)
    parser.add_argument("--printStats", help="instead of printing the "
                        "passing BED lines, print statistics",
                        action='store_true', default=False)
    Stack.addJobTreeOptions(parser)
    args = parser.parse_args()
    setLoggingFromOptions(args)
    result = Stack(Setup(args)).startJobTree(args)
    if result:
        raise RuntimeError("Jobtree has failed jobs.")

    return 0
def main():
    parser = OptionParser()
    Stack.addJobTreeOptions(parser)
    options, args = parser.parse_args()
    
    #Now we are ready to run
    Stack(SetupFileTree()).startJobTree(options)
def main():
    parser = OptionParser()
    Stack.addJobTreeOptions(parser)

    parser.add_option("--fileToSort",
                      dest="fileToSort",
                      help="The file you wish to sort")

    parser.add_option(
        "--N",
        dest="N",
        help=
        "The threshold below which a serial sort function is used to sort file. All lines must of length less than or equal to N or program will fail",
        default=10000)

    options, args = parser.parse_args()

    if options.fileToSort == None:
        raise RuntimeError("No file to sort given")

    if not os.path.exists(options.fileToSort):
        raise RuntimeError("File to sort does not exist: %s" %
                           options.fileToSort)

    if int(options.N) <= 0:
        raise RuntimeError("Invalid value of N: %s" % options.N)

    if len(args) != 0:
        raise RuntimeError("Unrecognised input arguments: %s" % " ".join(args))

    #Now we are ready to run
    i = Stack(Target.makeTargetFn(
        setup, (options.fileToSort, int(options.N)))).startJobTree(options)
Exemple #10
0
def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument('hal', help='HAL alignment file.')
    parser.add_argument('ref_genome', help='Reference genome.')
    parser.add_argument(
        'model', help='Model file produced by phyloFit/halPhyloPTrain.py.')
    parser.add_argument('output_gff', help='Output GFF path.')
    parser.add_argument(
        '--windows',
        default='1000000,1000',
        help='windows parameter to pass on to msa_view (default: %(default)s)')
    parser.add_argument(
        '--between-blocks',
        default='5000',
        help=
        'between blocks parameter to pass on to msa_view (default: %(default)s)'
    )
    parser.add_argument(
        '--pre-extracted',
        default=None,
        help=('Path to pre-extracted alignments from phast_subset.'
              ' Will start the pipeline past that point.'))
    parser.add_argument(
        '--ref-fasta-path',
        default=None,
        help=
        'Path to reference genome FASTA. If not provided, it will be extracted from the HAL.'
    )
    Stack.addJobTreeOptions(parser)
    return parser.parse_args()
Exemple #11
0
def main():
    ##########################################
    #Construct the arguments.
    ##########################################

    parser = OptionParser()

    parser.add_option("--host", dest="host")
    parser.add_option("--port", dest="port")
    parser.add_option("--databaseDir", dest="databaseDir")
    parser.add_option("--databaseOptions", dest="databaseOptions")
    parser.add_option("--keysPerJob", dest="keysPerJob")
    parser.add_option("--totalJobs", dest="totalJobs")
    parser.add_option("--minRecordSize", dest="minRecordSize")
    parser.add_option("--maxRecordSize", dest="maxRecordSize")
    parser.add_option("--test",
                      dest="test",
                      action="store_true",
                      help="Run doctest unit tests")

    Stack.addJobTreeOptions(parser)

    options, args = parser.parse_args()
    if options.test:
        _test()
    setLoggingFromOptions(options)

    if len(args) != 0:
        raise RuntimeError("Unrecognised input arguments: %s" % " ".join(args))

    Stack(AddKeysPhase(options)).startJobTree(options)
def main():
    parser = build_parser()
    Stack.addJobTreeOptions(parser)
    args = parser.parse_args()
    # biotypes = get_all_biotypes(args.attributePath)
    biotypes = [
        "protein_coding",
        "miRNA",
        "snoRNA",
        "snRNA",
        "lincRNA",
        "processed_pseudogenes",
        "unprocessed_pseudogenes",
        "pseudogenes",
    ]
    job_args = (
        args.comparativeAnnotationDir,
        args.attributePath,
        args.annotationGp,
        args.gencode,
        args.genomes,
        biotypes,
        args.outDir,
    )
    i = Stack(Target.makeTargetFn(wrapper, args=job_args)).startJobTree(args)
    if i != 0:
        raise RuntimeError("Got failed jobs")
def main():
    parser = OptionParser()
    Stack.addJobTreeOptions(parser)
    parser.add_option("--sleepTime", dest="sleepTime", type="int",
                     help="sleep [default=5] seconds", default=5)
    parser.add_option("--tree", dest="tree",
                      help="tree [balanced|comb|star|fly]", default="comb")
    parser.add_option("--size", dest="size", type="int",
                      help="tree size (for comb or star) [default=10]", 
                      default=10) 
    parser.add_option("--cpusPerJob", dest="cpusPerJob",
                      help="Cpus per job", default="1")
        
    options, args = parser.parse_args()
    setLoggingFromOptions(options)

    startTime = datetime.datetime.now()

    if options.tree == "star":
        tree = starTree(options.size)
    elif options.tree == "balanced":
        tree = balancedTree()
    elif options.tree == "fly":
        tree = flyTree()
    else:
        tree = combTree(options.size)
    
    baseTarget = FirstJob(tree, "Anc00", options.sleepTime, startTime, int(options.cpusPerJob))
    Stack(baseTarget).startJobTree(options)
    
    if options.logFile is not None:
        checkLog(options)
def main():
    ##########################################
    #Construct the arguments.
    ##########################################

    parser = OptionParser()
 
    parser.add_option("--haplotypeSequences", dest="haplotypeSequences")
    parser.add_option("--newickTree", dest="newickTree")
    parser.add_option("--assembliesDir", dest="assembliesDir")
    parser.add_option("--outputDir", dest="outputDir")
    parser.add_option("--configFile", dest="configFile")
    parser.add_option("--minimumNsForScaffoldGap", dest="minimumNsForScaffoldGap")
    parser.add_option("--assemblyEventString", dest="assemblyEventString")
    parser.add_option("--haplotype1EventString", dest="haplotype1EventString")
    parser.add_option("--haplotype2EventString", dest="haplotype2EventString")
    parser.add_option("--contaminationEventString", dest="contaminationEventString")
    parser.add_option("--featureBedFiles", dest="featureBedFiles")
    parser.add_option("--geneBedFiles", dest="geneBedFiles")
    
    Stack.addJobTreeOptions(parser)

    options, args = parser.parse_args()
    setLoggingFromOptions(options)

    if len(args) != 0:
        raise RuntimeError("Unrecognised input arguments: %s" % " ".join(args))

    Stack(MakeAlignments(newickTree=options.newickTree, 
                         haplotypeSequences=options.haplotypeSequences.split(), 
                         assembliesDir=options.assembliesDir, 
                         outputDir=options.outputDir, 
                         configFile=options.configFile, 
                         options=options)).startJobTree(options)
    logger.info("Done with job tree")
def main():
    usage = ("Usage: %prog [options] pathStats_hg19.xml sequencesDir")
    parser = OptionParser( usage = usage )
    Stack.addJobTreeOptions(parser)
    
    initOptions(parser)
    options, args = parser.parse_args()
    checkOptions( args, options, parser )

    insertions = readfile(args[0], options.minsize, options.filteredSamples)
    #HLA-DRB region: chr6:32,414,165-32,605,002
    start = 32414165
    end = 32605002
    numDRBins = 0
    for s in insertions:
        for ins in insertions[s]:
            if start <= ins.refstart and ins.refstart <= end:
                numDRBins += 1
    sys.stderr.write("Number of insertions in HLA-DRB region: %d\n" %numDRBins)
    #return

    getInsertedSeqs(insertions, args[1])
    printInsertSeqs(insertions)

    #mapSeqs(insertions, options)
    i = Stack( MapSeqs(insertions, options) ).startJobTree(options)
    if i:
        raise RuntimeError("The jobTree contains %d failed jobs\n" %i)
Exemple #16
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("alignment", help="HAL alignment file")
    parser.add_argument("srcGenome", help="Reference genome")
    parser.add_argument("bedFile", help="Bed file (in ref coordinates)")
    parser.add_argument("destGenome", help="Genome to check contiguity in")
    parser.add_argument("outFile", help="Output BED file")
    parser.add_argument("--maxGap", help="maximum gap size to accept", 
                        default=100, type=int)
    parser.add_argument("--deletionGaps", help="care about deletion gaps",
                        default=False, action='store_true')
    parser.add_argument("--sliceNum", help="number of slices to create",
                        type=int, default=1)
    parser.add_argument("--maxIntronDiff", help="Maximum number of bases "
                        "that intron gaps are allowed to change by", type=int,
                        default=10000)
    parser.add_argument("--requiredMapFraction", help="Fraction of bases in "
                        "the query that need to map to the target to be "
                        "accepted", type=float, default=0.0)
    parser.add_argument("--printStats", help="instead of printing the "
                        "passing BED lines, print statistics",
                        action='store_true', default=False)
    Stack.addJobTreeOptions(parser)
    args = parser.parse_args()
    setLoggingFromOptions(args)
    result = Stack(Setup(args)).startJobTree(args)
    if result:
        raise RuntimeError("Jobtree has failed jobs.")

    return 0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--genome", required=True)
    parser.add_argument("--refGenome", required=True)
    parser.add_argument("--refTranscriptFasta", required=True)
    parser.add_argument("--targetGenomeFasta", required=True)
    parser.add_argument("--outDb", default="cgp_cds_metrics.db")
    parser.add_argument("--compAnnPath", required=True)
    gp_group = parser.add_mutually_exclusive_group(required=True)
    gp_group.add_argument("--cgpGp")
    gp_group.add_argument("--consensusGp")
    Stack.addJobTreeOptions(parser)
    args = parser.parse_args()
    out_db = os.path.join(args.compAnnPath, args.outDb)
    if args.cgpGp is not None:
        gp = args.cgpGp
        mode = "cgp"
        chunk_size = 15  # smaller chunk size because we will do more alignments per transcript
    else:
        gp = args.consensusGp
        mode = "consensus"
        chunk_size = 40
    s = Stack(
        Target.makeTargetFn(align_gp,
                            args=[
                                args.genome, args.refGenome,
                                args.refTranscriptFasta,
                                args.targetGenomeFasta, gp, mode, out_db,
                                args.compAnnPath, chunk_size
                            ]))
    i = s.startJobTree(args)
    if i != 0:
        raise RuntimeError("Got failed jobs")
Exemple #18
0
def main():
    #Parse the inputs args/options
    parser = OptionParser(usage="usage: workingDir [options]", version="%prog 0.1")
    Stack.addJobTreeOptions(parser)
    options, args = parser.parse_args()
    setLoggingFromOptions(options)
    
    if len(args) != 1:
        raise RuntimeError("Expected one argument, got %s arguments: %s" % (len(args), " ".join(args)))
    workingDir = args[0]
    
    #Assign the input files
    readFastqFiles = [ os.path.join(workingDir, "readFastqFiles", i) for i in os.listdir(os.path.join(workingDir, "readFastqFiles")) if ".fq" in i or ".fastq" in i ]
    referenceFastaFiles = [ os.path.join(workingDir, "referenceFastaFiles", i) for i in os.listdir(os.path.join(workingDir, "referenceFastaFiles")) if ".fa" in i or ".fasta" in i ] 
    outputDir = os.path.join(workingDir, "output")
    
    #Log the inputs
    logger.info("Using the following working directory: %s" % workingDir)
    logger.info("Using the following output directory: %s" % outputDir)
    for readFastqFile in readFastqFiles:
        logger.info("Got the following read fastq file: %s" % readFastqFile)
    for referenceFastaFile in referenceFastaFiles:
        logger.info("Got the following reference fasta files: %s" % referenceFastaFile)
    
    #This line invokes jobTree  
    i = Stack(Target.makeTargetFn(setupExperiments, args=(readFastqFiles, referenceFastaFiles, mappers, analyses, outputDir))).startJobTree(options) 
    
    if i != 0:
        raise RuntimeError("Got failed jobs")
Exemple #19
0
def main():
    usage = "usage: %prog [options] <multicactus project>"
    description = "Progressive version of cactus_workflow"
    parser = OptionParser(usage=usage, description=description)
    Stack.addJobTreeOptions(parser)
    addCactusWorkflowOptions(parser)
    
    parser.add_option("--nonRecursive", dest="nonRecursive", action="store_true",
                      help="Only process given event (not children) [default=False]", 
                      default=False)
    
    parser.add_option("--event", dest="event", 
                      help="Target event to process [default=root]", default=None)
    
    parser.add_option("--overwrite", dest="overwrite", action="store_true",
                      help="Recompute and overwrite output files if they exist [default=False]",
                      default=False)
    
    options, args = parser.parse_args()
    setLoggingFromOptions(options)

    if len(args) != 1:
        parser.print_help()
        raise RuntimeError("Unrecognised input arguments: %s" % " ".join(args))

    Stack(RunCactusPreprocessorThenProgressiveDown(options, args)).startJobTree(options)
Exemple #20
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--genome", required=True)
    parser.add_argument("--database", required=True)
    parser.add_argument("--hintsDir", required=True)
    parser.add_argument("--fasta", required=True)
    parser.add_argument("--filterTissues", nargs="+")
    parser.add_argument("--filterCenters", nargs="+")
    bamfiles = parser.add_mutually_exclusive_group(required=True)
    bamfiles.add_argument("--bamFiles", nargs="+", help="bamfiles being used", dest="bams")
    bamfiles.add_argument("--bamFofn", help="File containing list of bamfiles", dest="bams")
    Stack.addJobTreeOptions(parser)
    args = parser.parse_args()
    # below is an ugly hack to filter out tissues/centers by checking for the words in the file path
    if not isinstance(args.bams, list):
        if not os.path.exists(args.bams):
            raise RuntimeError("ERROR: bamFofn does not exist.")
        bams = {x.rstrip() for x in open(args.bams)}
        args.bams = bams
    else:
        args.bams = set(args.bams)
    for to_remove_list in [args.filterTissues, args.filterCenters]:
        if isinstance(to_remove_list, list):
            to_remove = set()
            for x in to_remove_list:
                for b in args.bams:
                    if x in b:
                        to_remove.add(b)
            args.bams -= to_remove
    s = Stack(Target.makeTargetFn(main_hints_fn, memory=8 * 1024 ** 3,
                                  args=[args.bams, args.database, args.genome, args.fasta, args.hintsDir]))
    i = s.startJobTree(args)
    if i != 0:
        raise RuntimeError("Got failed jobs")
def parse_args():
    """
    Builds an argument parser for this run
    """
    parent_parser = argparse.ArgumentParser()
    subparsers = parent_parser.add_subparsers(title="Modes",
                                              description="Execution Modes",
                                              dest="mode")
    tm_parser = subparsers.add_parser('transMap')
    ref_parser = subparsers.add_parser('reference')
    aug_parser = subparsers.add_parser('augustus')
    # common arguments
    for parser in [ref_parser, aug_parser, tm_parser]:
        parser.add_argument('--outDir', type=str, required=True)
        parser.add_argument('--refGenome', type=str, required=True)
        parser.add_argument('--refFasta', type=str, required=True)
        parser.add_argument('--sizes', required=True)
        parser.add_argument('--annotationGp', required=True)
        parser.add_argument('--gencodeAttributes', required=True)
        Stack.addJobTreeOptions(parser)  # add jobTree options
    # transMap specific options
    for parser in [aug_parser, tm_parser]:
        parser.add_argument('--genome', required=True)
        parser.add_argument('--psl', required=True)
        parser.add_argument('--refPsl', required=True)
        parser.add_argument('--targetGp', required=True)
        parser.add_argument('--fasta', required=True)
    # Augustus specific options
    aug_parser.add_argument('--augustusGp', required=True)
    args = parent_parser.parse_args()
    assert args.mode in ["transMap", "reference", "augustus"]
    return args
def main():
    parser = OptionParser(
        usage="mcmc_mixing_analysis_jobtree.py --pevnts sample.pevnts --refhistoryid=2500 --numsteps=1000 --stepsize=1 --logInfo --jobTree=/outputdir --batchSystem=singleMachine"
    )
    parser.add_option("--pevnts", dest="pevnts", help="a .pevnts file", type="string")
    parser.add_option("--pedges", dest="pedges", help="a .pedges file", type="string")
    parser.add_option("--outputdir", dest="outputdir", help="where you want the final output to go", type="string")
    parser.add_option(
        "--simulation",
        dest="simulation",
        default=False,
        action="store_true",
        help="flag to indicate that it's a simulated history",
    )
    parser.add_option(
        "--trueID", dest="trueID", help="the id of the true history for simulations.", default=0, type="int"
    )
    parser.add_option(
        "--binwidth",
        dest="binwidth",
        help="the multiplier between history ids of independent runs",
        default=histseg.Global_BINWIDTH,
        type="int",
    )
    add_mcmc_options(parser)
    Stack.addJobTreeOptions(parser)
    options, args = parser.parse_args()
    histseg.Global_BINWIDTH = options.binwidth
    i = Stack(SetupMCMC(options, options.outputdir)).startJobTree(options)
    if i:
        raise RuntimeError("The jobtree contains %d failed jobs.\n" % i)
Exemple #23
0
def main():
    parser = build_parser()
    Stack.addJobTreeOptions(parser)
    args = parser.parse_args()
    setLoggingFromOptions(args)

    if not os.path.exists(args.outDir):
        os.mkdir(args.outDir)

    if args.overwriteDb is True:
        if os.path.exists(args.mergedDb):
            os.remove(args.mergedDb)
        for g in args.genomes:
            if os.path.exists(os.path.join(args.outDir, g + ".db")):
                os.remove(os.path.join(args.outDir, g + ".db"))

    logger.info("Building paths to the required files")
    alnPslDict = parse_dir(args.genomes, args.dataDir, alignment_ext)
    seqTwoBitDict = parse_dir(args.genomes, args.dataDir, sequence_ext)
    geneCheckBedDict = parse_dir(args.genomes, args.dataDir, gene_check_ext)
    #geneCheckBedDetailsDict = parse_dir(args.genomes, args.geneCheckDir, gene_check_details_ext)

    refSequence = os.path.join(args.dataDir, args.refGenome + ".2bit")
    if not os.path.exists(refSequence):
        raise RuntimeError("Reference genome 2bit not present at {}".format(refSequence))
    args.refSequence = refSequence

    i = Stack(Target.makeTargetFn(build_analysis, args=(alnPslDict, seqTwoBitDict, geneCheckBedDict, 
            args.gencodeAttributeMap, args.genomes, args.annotationBed, args.outDir, args.primaryKey, 
            args.refGenome))).startJobTree(args)

    if i != 0:
        raise RuntimeError("Got failed jobs")

    merge_databases(args.outDir, args.mergedDb, args.genomes)
def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument('--hal', help='HAL alignment file.', required=True)
    parser.add_argument('--ref_genome',
                        help='Reference genome.',
                        required=True)
    parser.add_argument('--conserved_bed',
                        help='Conserved BED file.',
                        required=True)
    parser.add_argument('--conserved_model',
                        help='Original conserved model',
                        required=True)
    parser.add_argument('--non_conserved_model',
                        help='Original nonconserved model.',
                        required=True)
    parser.add_argument('--out_bed', help='output BED', required=True)
    parser.add_argument('--target_genomes',
                        nargs='+',
                        required=True,
                        help='target genomes')
    parser.add_argument('--accelerated_genomes',
                        nargs='+',
                        required=True,
                        help='target genomes')
    parser.add_argument(
        '--single_copy_percent_cutoff',
        default=0.98,
        type=float,
        help=
        'Percent of region that must be single copy before we test it for acceleration'
    )
    Stack.addJobTreeOptions(parser)
    return parser.parse_args()
Exemple #25
0
def main():
    parser = OptionParser(usage="make_simulations_jobtree.py ....")
    add_simulation_options(parser)
    Stack.addJobTreeOptions(parser)
    options, args = parser.parse_args()
    i = Stack(SetupSim(options)).startJobTree(options)
    if i:
        raise RuntimeError("The jobtree contains %d failed jobs.\n" % i)
def main(): 
	parser= OptionParser(usage = "make_simulations_jobtree.py ....")
	add_simulation_options(parser)
	Stack.addJobTreeOptions(parser)
	options, args = parser.parse_args()
	i = Stack(SetupSim(options)).startJobTree(options)
	if i: 
		raise RuntimeError("The jobtree contains %d failed jobs.\n" % i)
Exemple #27
0
def main():
    parser = lcommon.init_options() 
    Stack.addJobTreeOptions(parser)
    options, args = parser.parse_args()

    i = Stack(Setup(args)).startJobTree(options)
    if i:
        raise RuntimeError("The jobtree contains %d failed jobs.\n" % i)
def parse_args():
    """Parses arguments from sys.argv."""
    parser = ArgumentParser(description=__doc__)
    parser.add_argument("hubDir", help="Directory to place the finished hub in")
    parser.add_argument("hals", type=os.path.abspath, nargs="+", help="Hal files")
    parser.add_argument("--labels", nargs="+", help="Labels for hal files (default: hal file name)")
    Stack.addJobTreeOptions(parser)
    return parser.parse_args()
def parse_args():
    """Parses arguments from sys.argv."""
    parser = ArgumentParser(description=__doc__)
    parser.add_argument('hubDir', help='Directory to place the finished hub in')
    parser.add_argument('hals', type=os.path.abspath, nargs='+', help='Hal files')
    parser.add_argument('--labels', nargs='+', help='Labels for hal files (default: hal file name)')
    Stack.addJobTreeOptions(parser)
    return parser.parse_args()
def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument('hal', help='HAL alignment file.')
    parser.add_argument('ref_genome', help='Reference genome.')
    parser.add_argument(
        'model', help='Model file produced by phyloFit/halPhyloPTrain.py.')
    parser.add_argument('output_bed',
                        help='Output BED path for most conserved elements.')
    parser.add_argument('output_wig', help='Output wiggle tracks.')
    parser.add_argument(
        '--output-conserved-model',
        default=None,
        help='If you want to save the nonconserved model, set its path here.')
    parser.add_argument(
        '--output-nonconserved-model',
        default=None,
        help='If you want to save the nonconserved model, set its path here.')
    parser.add_argument(
        '--pre-extracted',
        default=None,
        help=('Path to pre-extracted alignments from phast_subset.'
              ' Will start the pipeline past that point.'))
    parser.add_argument('--target-genomes',
                        default=None,
                        nargs='+',
                        help='target genomes')
    parser.add_argument(
        '--ref-fasta-path',
        default=None,
        help=
        'Path to reference genome FASTA. If not provided, it will be extracted from the HAL.'
    )
    parser.add_argument(
        '--target-coverage',
        default='0.3',
        help='target coverage parameter for phastCons. (default: %(default)s)')
    parser.add_argument(
        '--expected-length',
        default='45',
        help='expected length parameter for phastCons. (default: %(default)s)')
    parser.add_argument(
        '--windows',
        default='1000000,0',
        help='windows parameter to pass on to msa_view (default: %(default)s)')
    parser.add_argument(
        '--between-blocks',
        default='5000',
        help=
        'between blocks parameter to pass on to msa_view (default: %(default)s)'
    )
    parser.add_argument(
        '--min-informative',
        default='1000',
        help=
        'min informative parameter to pass on to msa_view (default: %(default)s)'
    )
    Stack.addJobTreeOptions(parser)
    return parser.parse_args()
Exemple #31
0
def main():
    parser = build_parser()
    Stack.addJobTreeOptions(parser)
    args = parser.parse_args()
    i = Stack(Target.makeTargetFn(build_analyses, args=(args.refGenome, args.genome, args.annotationGp, args.psl,
                                                        args.gp, args.fasta, args.refFasta, args.sizes,
                                                        args.gencodeAttributes, args.outDir))).startJobTree(args)
    if i != 0:
        raise RuntimeError("Got failed jobs")
Exemple #32
0
def main():
    usage = ("%prog <clonefile> <vfile> <jfile> <dfile> <outdir> <modeldir>")
    parser = lcommon.init_options(usage)
    Stack.addJobTreeOptions(parser)
    options, args = parser.parse_args()

    i = Stack(Setup(args)).startJobTree(options)
    if i:
        raise RuntimeError("The jobtree contains %d failed jobs.\n" % i)
def main():
    parser = build_parser()
    Stack.addJobTreeOptions(parser)
    args = parser.parse_args()
    i = Stack(Target.makeTargetFn(build_analyses, args=(args.refGenome, args.genome, args.annotationGp, args.psl,
                                                        args.gp, args.augustusGp, args.fasta, args.refFasta, args.sizes,
                                                        args.gencodeAttributes, args.outDir))).startJobTree(args)
    if i != 0:
        raise RuntimeError("Got failed jobs")
def main(): 
	parser = OptionParser(usage = "cn-avg_post_analysis_jobtree.py --cnavgout CN-AVG_outputdir --sampleid Sampleid --jobTree jobtreedir")
	
	add_analysis_options(parser)
	mcmcjobtree.add_mcmc_options(parser)
	Stack.addJobTreeOptions(parser)
	options, args = parser.parse_args()
	i = Stack(Setup(options)).startJobTree(options)
	if i: 
		raise RuntimeError("The jobtree contains %d failed jobs.\n" % i)
def main():
    parser = build_parser()
    Stack.addJobTreeOptions(parser)
    args = parser.parse_args()
    setLoggingFromOptions(args)
    args.defaultCpu = args.num_threads
    args.defaultMemory = 8 * 1024 ** 3
    i = Stack(Target.makeTargetFn(wrapper, args=(args,), memory=args.defaultMemory, cpu=args.defaultCpu)).startJobTree(args)
    if i != 0:
        raise RuntimeError("Got failed jobs")
def main(): 
	parser = OptionParser(usage = "note: This currently doesn't work.  run_cn-avg_post_analysis_jobtree.py --samplelist samplelist.txt")
	parser.add_option("--samplelist", dest="samplelist", help="The list of CNAVG outputs and sample ids. Should have the form <directory><ID>")
	postjobtree.add_analysis_options(parser)
	mcmcjobtree.add_mcmc_options(parser)
	Stack.addJobTreeOptions(parser)
	options, args = parser.parse_args()
	i = Stack(Setup(options)).startJobTree(options)
	if i:
		raise RuntimeError("The jobtree contains %d failed jobs.\n" % i)
def main():
    parser = build_parser()
    Stack.addJobTreeOptions(parser)
    args = parser.parse_args()
    setLoggingFromOptions(args)

    i = Stack(Target.makeTargetFn(wrapper, args=(args.source_dir, args.reference, args.out_dir))).startJobTree(args)

    if i != 0:
        raise RuntimeError("Got failed jobs")
def main():
    usage = "%prog <indir> <outdir> [options]"
    parser = lcommon.init_options(usage)
    Stack.addJobTreeOptions(parser)
    options, args = parser.parse_args()
    indir = args[0]
    outdir = args[1]
    i = Stack(Setup(indir, outdir)).startJobTree(options)
    if i:
        raise RuntimeError("The jobtree contains %d failed jobs.\n" % i)
Exemple #39
0
def main():
    args = parse_args()
    args.target_genomes = extract_model_tree(args.model) - set(
        [args.ref_genome])
    args.msa_split_options = " ".join(
        ['--windows', args.windows, '--between-blocks', args.between_blocks])
    s = Stack(Target.makeTargetFn(dless_pipeline_wrapper, args=(args, )))
    i = s.startJobTree(args)
    if i != 0:
        raise RuntimeError("Got failed jobs")
def main():
  description = ('%(prog)s starts a jobTree batch of augustus calls '
                 'for a given input set.')
  parser = ArgumentParser(description=description)
  initializeArguments(parser)
  Stack.addJobTreeOptions(parser)
  args = parser.parse_args()
  checkArguments(args, parser)

  launchBatch(args)
Exemple #41
0
def main():
    parser = OptionParser()
    Stack.addJobTreeOptions(parser)
    initOptions(parser)
    options, args = parser.parse_args()
    checkOptions(parser, options, args)

    #i = Stack( Setup(options.experimentList, options.outdir, options.kmer, options.ref, options.cont) ).startJobTree(options)
    i = Stack( Setup(options) ).startJobTree(options)
    if i:
        raise RuntimeError("The jobTree contains %d failed jobs\n" %i)
Exemple #42
0
def main():
    parser = OptionParser()
    Stack.addJobTreeOptions(parser)

    parser.add_option(
        "-e",
        "--experimentList",
        dest="experimentList",
        help=
        "File containing list of experiments (sample sets). E.g: \naml\ngbm\n")
    parser.add_option(
        "-d",
        "--dataDir",
        dest="dataDir",
        help="Location of the reads. E.g: /inside/grotto/nknguyen/mhcRef/data")
    parser.add_option("-r",
                      "--ref",
                      dest="ref",
                      help="Fasta file of the reference sequence")
    #parser.add_option("-r", "--ref",dest= "ref", help= "Fasta file of the reference sequence. /inside/depot/users/nknguyen/mhc/data")
    parser.add_option("-k",
                      "--kmer",
                      dest="kmer",
                      help="kmer for velvet",
                      default="25")
    parser.add_option("-o", "--output", dest="outdir", help="Output directory")
    parser.add_option(
        "-c",
        "--continue",
        dest="cont",
        action="store_true",
        help="If specified, skip the velveth step, continue running velvetg",
        default=False)
    parser.add_option(
        "-m",
        "--mask",
        dest="mask",
        action="store_true",
        help="If specified, soft-repeatMask the assembled contigs",
        default=False)
    parser.add_option("--maxIter",
                      dest="maxIter",
                      help="The number of maximun velvetg iterations",
                      default=2)

    options, args = parser.parse_args()

    if options.experimentList == None:
        raise RuntimeError("No experiment list (sample sets) given")

    #i = Stack( Setup(options.experimentList, options.outdir, options.kmer, options.ref, options.cont) ).startJobTree(options)
    i = Stack(Setup(options)).startJobTree(options)
    if i:
        raise RuntimeError("The jobTree contains %d failed jobs\n" % i)
Exemple #43
0
def main():
    parser = OptionParser()
    Stack.addJobTreeOptions(parser)
    initOptions(parser)
    options, args = parser.parse_args()
    checkOptions(parser, options, args)

    #i = Stack( Setup(options.experimentList, options.outdir, options.kmer, options.ref, options.cont) ).startJobTree(options)
    i = Stack(Setup(options)).startJobTree(options)
    if i:
        raise RuntimeError("The jobTree contains %d failed jobs\n" % i)
Exemple #44
0
def main():
    parser = buildParser()
    Stack.addJobTreeOptions(parser)
    args = parser.parse_args()
    setLoggingFromOptions(args)

    i = Stack(Target.makeTargetFn(buildAnalyses, args=(
        args.output, args.breakpoint_penalty, args.data_penalty, args.tightness_penalty, args.graph, args.kmer_size, args.save_intermediate))).startJobTree(
        args)

    if i != 0:
        raise RuntimeError("Got failed jobs")
def main():
    usage = (
        "%prog <clone_file> <model_dir|model_pickle_file> <db_dir> <numclone_file>"
        + "<out_dir> <ingroup> <outgroup> <lenllh> <clonellh>"
    )
    parser = lcommon.init_options(usage)
    Stack.addJobTreeOptions(parser)
    options, args = parser.parse_args()

    i = Stack(Setup(args)).startJobTree(options)
    if i:
        raise RuntimeError("The jobtree contains %d failed jobs.\n" % i)
Exemple #46
0
def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument('--hal', help='HAL alignment file.', required=True)
    parser.add_argument('--ref_genome',
                        help='Reference genome.',
                        required=True)
    parser.add_argument('--conserved_bed',
                        help='Conserved BED file.',
                        required=True)
    parser.add_argument('--out_bed', help='output BED', required=True)
    Stack.addJobTreeOptions(parser)
    return parser.parse_args()
Exemple #47
0
def main():
    usage = "%prog <bed_file> <hal_file> <query_name> <target_name> <out_file>"
    parser = OptionParser(usage=usage)
    addOptions(parser)
    Stack.addJobTreeOptions(parser)

    options, args = parser.parse_args()
    checkOptions(parser, args, options)

    i = Stack(Setup(options)).startJobTree(options)
    if i:
        raise RuntimeError("The jobtree contains %d failed jobs.\n" % i)
Exemple #48
0
def main():
    usage = "%prog <bed_file> <hal_file> <query_name> <target_name> <out_file>"
    parser = OptionParser(usage=usage)
    addOptions(parser)
    Stack.addJobTreeOptions(parser)

    options, args = parser.parse_args()
    checkOptions(parser, args, options)

    i = Stack(Setup(options)).startJobTree(options)
    if i:
        raise RuntimeError("The jobtree contains %d failed jobs.\n" % i)
Exemple #49
0
def main():
    usage = "%prog <db_dir> <model_file> <outfile> [options]"
    parser = lcommon.init_options(usage)
    Stack.addJobTreeOptions(parser)
    options, args = parser.parse_args()
    db_dir = args[0]
    model_file = args[1]
    outfile = args[2]

    i = Stack(Setup(db_dir, model_file, outfile, options)).startJobTree(options)
    if i:
        raise RuntimeError("The jobtree contains %d failed jobs.\n" % i)
Exemple #50
0
def main():
    usage = (
        'usage: %prog --simDir path/to/dir [options]\n\n'
        '%prog requires mafJoin which is part of mafTools and is available\n'
        'at https://github.com/dentearl/mafTools/ . ')
    parser = OptionParser(usage=usage)
    initOptions(parser)
    Stack.addJobTreeOptions(parser)
    options, args = parser.parse_args()

    checkOptions(options, parser)

    launchJobTree(options)
def main():
    parser = OptionParser(
        usage=
        "cn-avg_post_analysis_jobtree.py --cnavgout CN-AVG_outputdir --sampleid Sampleid --jobTree jobtreedir"
    )

    add_analysis_options(parser)
    mcmcjobtree.add_mcmc_options(parser)
    Stack.addJobTreeOptions(parser)
    options, args = parser.parse_args()
    i = Stack(Setup(options)).startJobTree(options)
    if i:
        raise RuntimeError("The jobtree contains %d failed jobs.\n" % i)
def main():
    args = parse_args()
    if args.target_genomes is None:
        args.target_genomes = extract_model_tree(args.model) - set(
            [args.ref_genome])
    args.msa_split_options = ' '.join([
        '--windows', args.windows, '--between-blocks', args.between_blocks,
        '--min-informative', args.min_informative
    ])
    s = Stack(Target.makeTargetFn(subset_hal_pipeline, args=(args, )))
    i = s.startJobTree(args)
    if i != 0:
        raise RuntimeError("Got failed jobs")
Exemple #53
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--genomes", nargs="+", required=True)
    parser.add_argument("--refFasta", required=True)
    parser.add_argument("--outDir", required=True)
    parser.add_argument("--augustusStatsDir", required=True)
    Stack.addJobTreeOptions(parser)
    args = parser.parse_args()
    i = Stack(Target.makeTargetFn(wrapper, args=(args.genomes, args.refFasta, args.augustusStatsDir,
                                                 args.outDir))).startJobTree(args)
    if i != 0:
        raise RuntimeError("Got failed jobs")
    shutil.rmtree(os.path.join(args.outDir, "tmp"))
def main():
    parser = buildParser()
    Stack.addJobTreeOptions(parser)
    args = parser.parse_args()
    setLoggingFromOptions(args)

    i = Stack(
        Target.makeTargetFn(buildAnalyses,
                            args=(args.output, args.fastq_list,
                                  args.save_intermediate))).startJobTree(args)

    if i != 0:
        raise RuntimeError("Got failed jobs")
Exemple #55
0
def parse_args():
    """Parses arguments from sys.argv."""
    parser = ArgumentParser(description=__doc__)
    parser.add_argument('hubDir',
                        help='Directory to place the finished hub in')
    parser.add_argument('hals',
                        type=os.path.abspath,
                        nargs='+',
                        help='Hal files')
    parser.add_argument('--labels',
                        nargs='+',
                        help='Labels for hal files (default: hal file name)')
    Stack.addJobTreeOptions(parser)
    return parser.parse_args()
Exemple #56
0
def main():
    usage = '%prog <halFile> <outputDirectory> [options]'
    parser = OptionParser(usage = usage)
    addOptions(parser)
    Stack.addJobTreeOptions(parser)
    options, args = parser.parse_args()
    checkOptions(parser, args, options)
    
    halfile = args[0]
    outdir = args[1]

    i = Stack( Setup(halfile, outdir, options) ).startJobTree(options)
    if i:
        raise RuntimeError("The jobtree contains %d failed jobs.\n" %i)
Exemple #57
0
def main():
    usage = ('usage: %prog --rootName=name --rootDir=/path/to/dir --paramsDir=/path/to/dir\n'
             '--tree=newickTree --stepLength=stepLength --outDir=/path/to/dir '
             '--jobTree=/path/to/dir [options]\n\n'
             '%prog is used to initiate an evolver simulation using jobTree/scriptTree.')
    parser = OptionParser(usage = usage)
    initOptions(parser)
    Stack.addJobTreeOptions(parser)
    options, args = parser.parse_args()
    checkOptions(options, parser)

    checkForFiles(options)
    populateRootDir(options)
    launchSimTree(options)