本文整理汇总了Python中sonLib.bioio.system函数的典型用法代码示例。如果您正苦于以下问题:Python system函数的具体用法?Python system怎么用?Python system使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了system函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_bedParsing
def test_bedParsing(self):
""" mafComparator should parse a bed file and use the intervals for testing
"""
for maf1, maf2, bed, totalTrue, totalTrueInInterval in self.knownValues:
if not os.path.exists('tempTestFiles'):
os.mkdir('tempTestFiles')
f = open(self.maf1path, 'w')
f.write('%s%s%s' % (self.header, maf1, self.footer))
f.close()
f = open(self.maf2path, 'w')
f.write('%s%s%s' % (self.header, maf2, self.footer))
f.close()
f = open(self.bedpath, 'w')
f.write('%s' % bed)
f.close()
cmd = ['mafComparator']
cmd.append('--mafFile1=%s' % self.maf1path)
cmd.append('--mafFile2=%s' % self.maf2path)
cmd.append('--outputFile=%s' % os.path.join('tempTestFiles', 'output.xml'))
if bed != '':
cmd.append('--bedFiles=%s' % os.path.join('tempTestFiles', 'bed.bed'))
cmd.append('--sampleNumber=1000 --logLevel %s' % getLogLevelString())
system(" ".join(cmd))
tree = ET.parse(os.path.join('tempTestFiles', 'output.xml'))
homTests = tree.findall('homologyTests')
self.assertAlmostEquals(totalTrue,
float(homTests[0].find('aggregateResults').find('all').attrib['totalTrue']))
if totalTrueInInterval is None:
self.assertEqual(None, homTests[0].find('aggregateResults').find('A'))
else:
self.assertAlmostEquals(totalTrueInInterval,
float(homTests[0].find('aggregateResults').find('A').attrib['totalTrue']))
shutil.rmtree(os.path.dirname(self.maf1path))
示例2: run
def run(self):
previousOutputFile = None
previousOutputFile2 = None
blanchettePath = os.path.join(TestStatus.getPathToDataSets(), "blanchettesSimulation")
for i in xrange(self.options.blanchetteRepeats):
trueAlignmentMFA = os.path.join(os.path.join(blanchettePath, "%.2i.job" % i), "true.mfa")
trueAlignmentMAF = os.path.join(self.getLocalTempDir(), "temp.maf")
treeFile = os.path.join(blanchettePath, "tree.newick")
system("mfaToMaf --mfaFile %s --outputFile %s --treeFile %s" % (trueAlignmentMFA, trueAlignmentMAF, treeFile))
trueRenamedMAF = trueAlignmentMAF + ".renamed"
expPath = os.path.join(self.outputDir, str(i), "experiment.xml")
applyNamingToMaf(expPath, trueAlignmentMAF, trueRenamedMAF)
trueAlignmentMAF = trueRenamedMAF
if self.params.vanilla == False:
predictedAlignmentMaf = os.path.join(self.outputDir, str(i), "progressiveCactusAlignment", "Anc0", "Anc0.maf")
else:
predictedAlignmentMaf = os.path.join(self.outputDir, str(i), "cactusVanilla.maf")
outputFile = os.path.join(self.getLocalTempDir(), "temp%i" % i)
system("mafComparator --mafFile1 %s --mafFile2 %s --outputFile %s" % (trueAlignmentMAF, predictedAlignmentMaf, outputFile))
system("cp %s %s" % (outputFile, os.path.join(self.outputDir, str(i), "mafComparison.xml")))
if previousOutputFile != None:
system("mergeMafComparatorResults.py --results1 %s --results2 %s --outputFile %s" % (outputFile, previousOutputFile, outputFile))
previousOutputFile = outputFile
system("mv %s %s" % (previousOutputFile, os.path.join(self.outputDir, "mafComparison.xml")))
示例3: testScriptTree_Example
def testScriptTree_Example(self):
"""Uses the jobTreeTest code to test the scriptTree Target wrapper.
"""
for test in xrange(self.testNo):
command = "scriptTreeTest_Wrapper.py --jobTree %s --logLevel=INFO --retryCount=10" % self.jobTreeDir
system(command)
runJobTreeStatusAndFailIfNotComplete(self.jobTreeDir)
示例4: split_fasta
def split_fasta(input_fasta, work_dir):
out_root = os.path.join(work_dir, "out") + '/'
os.mkdir(out_root)
system("faSplit byname {input} {out_root}".format(
input=input_fasta,
out_root=out_root))
return glob(os.path.join(work_dir, "out/*"))
示例5: run
def run(self):
#self.logToMaster("Get_Vd_Dj_Ins_Agg")
tempdir = "%s_tempdir" % os.path.splitext(self.outfile)[0]
system("mkdir -p %s" % tempdir)
items = self.clone.split('_')
v = items[0]
cdr3_aa = items[1]
j = items[2]
if self.devent.d3del == 0:
d_cdr3_nt = self.d_nt[self.devent.d5del: ]
else:
d_cdr3_nt = self.d_nt[self.devent.d5del: -1 * self.devent.d3del]
for vdelname in os.listdir(self.vdir):
vfile = os.path.join(self.vdir, vdelname)
vdel = int(vdelname.split("_batch")[0])
v_cdr3_nt = self.v_nt if vdel == 0 else self.v_nt[: -1 * vdel]
for jdelname in os.listdir(self.jdir):
jfile = os.path.join(self.jdir, jdelname)
jdel = int(jdelname.split("_batch")[0])
j_cdr3_nt = self.j_nt if jdel == 0 else self.j_nt[jdel: ]
outfile = os.path.join(tempdir, "%s_%s" % (vdelname, jdelname))
self.addChildTarget(Get_Vd_Dj_Ins_Agg2(v, vdel, vfile,
v_cdr3_nt, j, jdel, jfile, j_cdr3_nt, self.d,
self.devent.d5del, self.devent.d3del, d_cdr3_nt,
cdr3_aa, self.modelfile, outfile))
self.setFollowOnTarget(Get_Vd_Dj_Ins_Agg3(tempdir, self.outfile))
示例6: run
def run(self):
if os.path.exists(self.outfile):
system("rm -f" % self.outfile)
for batch in os.listdir(self.indir):
batchfile = os.path.join(self.indir, batch)
clones = pickle.load(gzip.open(batchfile, "rb"))
write_clones(self.outfile, clones, True)
示例7: run
def run(self):
infile = os.path.join(self.indir, "copyNumberStats.xml")
if os.path.exists( infile ):
cmd = "cnvPlot.py %s --outdir %s " %(infile, self.outdir)
if self.filteredSamples != "":
cmd += " --filteredSamples %s" %(self.filteredSamples)
system(cmd)
示例8: run
def run(self):
newmodfile = "%s-modified" %self.modfile
#modify small branch lengths (change all the xxxe-1y to xxxe-10)
system("sed 's/e-1./e-08/g' %s > %s" %(self.modfile, newmodfile))
#get conservation bigwig and liftover files:
cmd = "halTreePhyloP.py %s %s %s --bigWig --numProc %d" %(self.halfile, newmodfile, self.outdir, self.numproc)
system(cmd)
示例9: extractOutput
def extractOutput(workDir, outputHalFile, options):
if options.outputMaf is not None:
mcProj = MultiCactusProject()
mcProj.readXML(
os.path.join(workDir, ProjectWrapper.alignmentDirName,
ProjectWrapper.alignmentDirName + "_project.xml"))
rootName = mcProj.mcTree.getRootName()
rootPath = os.path.join(workDir, ProjectWrapper.alignmentDirName,
rootName, rootName + '.maf')
cmd = 'mv %s %s' % (rootPath, options.outputMaf)
system(cmd)
envFile = getEnvFilePath()
logFile = os.path.join(workDir, 'cactus.log')
pjPath = os.path.join(workDir, ProjectWrapper.alignmentDirName,
'%s_project.xml' % ProjectWrapper.alignmentDirName)
logHandle = open(logFile, "a")
logHandle.write("\n\n%s: Beginning HAL Export\n\n" % str(
datetime.datetime.now()))
logHandle.close()
cmd = '. %s && cactus2hal.py %s %s >> %s 2>&1' % (envFile, pjPath,
outputHalFile, logFile)
system(cmd)
logHandle = open(logFile, "a")
logHandle.write("\n%s: Finished HAL Export \n" % str(
datetime.datetime.now()))
logHandle.close()
示例10: runCactus
def runCactus(workDir, jtCommands, jtPath, options):
envFile = getEnvFilePath()
pjPath = os.path.join(workDir, ProjectWrapper.alignmentDirName,
'%s_project.xml' % ProjectWrapper.alignmentDirName)
logFile = os.path.join(workDir, 'cactus.log')
if options.overwrite:
overwriteFlag = '--overwrite'
system("rm -f %s" % logFile)
else:
overwriteFlag = ''
logHandle = open(logFile, "a")
logHandle.write("\n%s: Beginning Progressive Cactus Alignment\n\n" % str(
datetime.datetime.now()))
logHandle.close()
cmd = '. %s && cactus_progressive.py %s %s %s >> %s 2>&1' % (envFile,
jtCommands,
pjPath,
overwriteFlag,
logFile)
jtMonitor = JobStatusMonitor(jtPath, pjPath, logFile,
deadlockCallbackFn=abortFunction(jtPath,
options))
if options.database == "kyoto_tycoon":
jtMonitor.daemon = True
jtMonitor.start()
system(cmd)
logHandle = open(logFile, "a")
logHandle.write("\n%s: Finished Progressive Cactus Alignment\n" % str(
datetime.datetime.now()))
logHandle.close()
示例11: checkOptions
def checkOptions(parser, args, options):
if not options.indir:
raise InputOptionError("Input directory is required. None was given.\n")
if not os.path.exists(options.indir):
raise InputOptionError("Input directory %s does not exist\n" % options.indir)
if not os.path.exists(options.outdir):
system("mkdir -p %s" % options.outdir)
示例12: run
def run(self):
system("mkdir -p %s" % self.outdir)
clone2sams = read_clone_file(self.clone_file, True)
if os.path.isdir(self.model):
model = rcommon.get_median_model(self.model)
else:
model = pickle.load(gzip.open(self.model, "rb"))
sam2total, group2sams = read_clonesize(self.numclone_file)
len2llh = read_llh(self.lenllh, intkey=True)
clone2llh = read_llh(self.clonellh)
global_dir = self.getGlobalTempDir()
lencount_dir = os.path.join(global_dir, "sam2len2count")
system("mkdir -p %s" % lencount_dir)
for s in os.listdir(self.db_dir):
samdir = os.path.join(self.db_dir, s)
lencount_file = os.path.join(lencount_dir, s)
self.addChildTarget(GetLencount(samdir, lencount_file))
self.setFollowOnTarget(
GetLlhs(
clone2sams,
self.outdir,
model,
lencount_dir,
group2sams,
self.ingroup,
self.outgroup,
len2llh,
clone2llh,
)
)
示例13: testCPecanRealignSplitSequences
def testCPecanRealignSplitSequences(self):
"""Runs cPecanRealign, splitting indels longer than 100bp, and check
that the coverage from the results is the same as the coverage from
realigning with no arguments.."""
for seqFile1, seqFile2 in seqFilePairGenerator():
# Drop the lastz command since it's not needed. But this
# is still convenient to use the same parameters as all
# the other tests
realignCommand, _ = getCommands(seqFile1, seqFile2)
splitRealignCommand = realignCommand + " --splitIndelsLongerThanThis 100"
realignOutput = getTempFile()
splitRealignOutput = getTempFile()
realignCommand += " > %s" % realignOutput
splitRealignCommand += " > %s" % splitRealignOutput
system(realignCommand)
system(splitRealignCommand)
# Check coverage on seqFile1
#The following will fail until we refactor.
splitRealignCoverage = popenCatch("cactus_coverage %s %s" % (seqFile1, splitRealignOutput))
realignCoverage = popenCatch("cactus_coverage %s %s" % (seqFile1, realignOutput))
self.assertTrue(splitRealignCoverage == realignCoverage)
# Check coverage on seqFile2
splitRealignCoverage = popenCatch("cactus_coverage %s %s" % (seqFile2, splitRealignOutput))
realignCoverage = popenCatch("cactus_coverage %s %s" % (seqFile2, realignOutput))
self.assertTrue(splitRealignCoverage == realignCoverage)
os.remove(realignOutput)
os.remove(splitRealignOutput)
示例14: run
def run(self):
self.logToMaster("Getting recomb. events for clone %s ..." % self.clone)
max_vdel = len(self.vseq) - 3
min_vdel = find_min_vdel(self.vseq, self.aaseq)
max_jdel = len(self.jseq) - 3
min_jdel = find_min_jdel(self.jseq, self.aaseq)
self.logToMaster("Vdel: <%d-%d>" % (min_vdel, max_vdel))
self.logToMaster("Jdel: <%d-%d>" % (min_jdel, max_jdel))
for d, dseq in self.d2seq.iteritems():
devents = find_devents(dseq, self.aaseq)
self.logToMaster("%d number of devents" % (len(devents)))
# DEBUG
#numempty = 0
#for devent in devents:
# if devent.cdr3aa_dstart == -1:
# numempty += 1
#self.logToMaster("\t%d empty D, %d non_empty_D\n" % (numempty, len(devents) - numempty))
# END DEBUG
for i, devent in enumerate(devents):
outdir = os.path.join(self.outdir, d, str(i)) #outdir/clone/d/i
system("mkdir -p %s" % outdir)
if devent.cdr3aa_dstart == -1:
dempty_file = os.path.join(outdir, "d_empty")
self.addChildTarget(Get_Vjins(self.clone, self.vseq,
min_vdel, max_vdel, self.jseq, min_jdel,
max_jdel, d, devent, self.aaseq, dempty_file))
else:
self.addChildTarget(Get_Vd_Dj_Ins(self.clone, self.vseq,
min_vdel, max_vdel, self.jseq, min_jdel,
max_jdel, d, dseq, devent, self.aaseq, outdir))
self.setFollowOnTarget(CloneEventsAgg(self.outdir))
示例15: testJobReadWriteAndDelete
def testJobReadWriteAndDelete(self):
jobDir = os.path.join(os.getcwd(), "testJobDir")
os.mkdir(jobDir) #If directory already exists then the test will fail
command = "by your command"
memory = 2^32
cpu = 1
tryCount = 100
for i in xrange(10):
startTime = time.time()
for j in xrange(100):
j = Job(command, memory, cpu, tryCount, jobDir)
self.assertEquals(j.remainingRetryCount, tryCount)
self.assertEquals(j.jobDir, jobDir)
self.assertEquals(j.children, [])
self.assertEquals(j.followOnCommands, [ (command, memory, cpu, 0)])
self.assertEquals(j.messages, [])
j.write()
j = Job.read(j.getJobFileName())
self.assertEquals(j.remainingRetryCount, tryCount)
self.assertEquals(j.jobDir, jobDir)
self.assertEquals(j.children, [])
self.assertEquals(j.followOnCommands, [ (command, memory, cpu, 0)])
self.assertEquals(j.messages, [])
self.assertTrue(os.path.exists(j.getJobFileName()))
j.delete()
self.assertTrue(not os.path.exists(j.getJobFileName()))
print "It took %f seconds to load/unload jobs" % (time.time() - startTime) #We've just used it for benchmarking, so far
#Would be good to extend this trivial test
system("rm -rf %s" % jobDir)