本文整理汇总了Python中jobTree.scriptTree.stack.Stack类的典型用法代码示例。如果您正苦于以下问题:Python Stack类的具体用法?Python Stack怎么用?Python Stack使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Stack类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
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)
示例2: main
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)
示例3: main
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")
示例4: main
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)
示例5: main
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")
示例6: main
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
示例7: main
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)
示例8: main
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")
示例9: main
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)
示例10: parseArgs
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:])
示例11: main
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)
示例12: main
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)
示例13: main
def main():
parser = OptionParser()
Stack.addJobTreeOptions(parser)
options, args = parser.parse_args()
#Now we are ready to run
Stack(SetupFileTree()).startJobTree(options)
示例14: 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()
示例15: main
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)