本文整理汇总了Python中sonLib.bioio.system函数的典型用法代码示例。如果您正苦于以下问题:Python system函数的具体用法?Python system怎么用?Python system使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了system函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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))
开发者ID:sorrywm,项目名称:mafTools,代码行数:33,代码来源:allTests.py
示例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")))
开发者ID:benedictpaten,项目名称:progressiveBenchmarks,代码行数:28,代码来源:pipeline.py
示例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)
开发者ID:decarlin,项目名称:jobTree,代码行数:7,代码来源:scriptTreeTest.py
示例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/*"))
开发者ID:ifiddes,项目名称:personal-scripts-code,代码行数:7,代码来源:repeatMaskerPipeline.py
示例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))
开发者ID:ngannguyen,项目名称:aimseqtk,代码行数:28,代码来源:aa_events_prob.py
示例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)
开发者ID:ngannguyen,项目名称:aimseqtk,代码行数:7,代码来源:sample.py
示例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)
开发者ID:ngannguyen,项目名称:referenceViz,代码行数:7,代码来源:getPlots.py
示例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)
开发者ID:glennhickey,项目名称:hal,代码行数:7,代码来源:conservationTrack.py
示例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()
开发者ID:glennhickey,项目名称:progressiveCactus,代码行数:26,代码来源:progressiveCactus.py
示例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()
开发者ID:glennhickey,项目名称:progressiveCactus,代码行数:33,代码来源:progressiveCactus.py
示例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)
开发者ID:ngannguyen,项目名称:immunoseq,代码行数:7,代码来源:aausage.py
示例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,
)
)
开发者ID:ngannguyen,项目名称:aimseqtk,代码行数:31,代码来源:clone_prob_cond.py
示例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)
开发者ID:ArtRand,项目名称:cPecan,代码行数:29,代码来源:cPecanRealignTest.py
示例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))
开发者ID:ngannguyen,项目名称:aimseqtk,代码行数:33,代码来源:aa_events.py
示例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)
开发者ID:ArtRand,项目名称:jobTree,代码行数:31,代码来源:jobTest.py
示例16: testJobUpdate
def testJobUpdate(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(40):
startTime = time.time()
j = Job(command, memory, cpu, tryCount, jobDir)
childNumber = random.choice(range(20))
for k in xrange(childNumber):
j.children.append((command, memory, cpu))
self.assertEquals(len(j.children), childNumber)
j.update(tryCount=tryCount, depth=0)
j = Job.read(j.getJobFileName())
self.assertEquals(len(j.children) + len(j.followOnCommands), childNumber + 1)
for childJobFile, memory, cpu in j.children:
cJ = Job.read(childJobFile)
self.assertEquals(cJ.remainingRetryCount, tryCount)
#self.assertEquals(cJ.jobDir, os.path.split(cJ)[0])
self.assertEquals(cJ.children, [])
self.assertEquals(cJ.followOnCommands, [ (command, memory, cpu, 0)])
self.assertEquals(cJ.messages, [])
self.assertTrue(os.path.exists(cJ.getJobFileName()))
cJ.delete()
self.assertTrue(not os.path.exists(cJ.getJobFileName()))
self.assertEquals(os.listdir(jobDir), [ "job" ])
j.delete()
print "It took %f seconds to update jobs" % (time.time() - startTime) #We've just used it for benchmarking, so far
system("rm -rf %s" % jobDir)
开发者ID:ArtRand,项目名称:jobTree,代码行数:33,代码来源:jobTest.py
示例17: testKeepingCoverageOnIngroups
def testKeepingCoverageOnIngroups(self):
"""Tests whether the --ingroupCoverageDir option works as
advertised."""
encodeRegion = "ENm001"
ingroups = ["human", "cow"]
outgroups = ["macaque", "rabbit", "dog"]
regionPath = os.path.join(self.encodePath, encodeRegion)
ingroupPaths = map(lambda x: os.path.join(regionPath, x + "." + encodeRegion + ".fa"), ingroups)
outgroupPaths = map(lambda x: os.path.join(regionPath, x + "." + encodeRegion + ".fa"), outgroups)
# Run blast in "ingroup vs outgroups" mode, requesting to keep
# the bed files that show outgroup coverage on the ingroup.
toilDir = os.path.join(self.tempDir, "tmp_toil")
outgroupFragmentPaths = [getTempFile(rootDir=self.tempDir) for outgroup in outgroups]
ingroupCoveragePaths = [getTempFile(rootDir=self.tempDir) for ingroup in ingroups]
runCactusBlastIngroupsAndOutgroups(ingroups=ingroupPaths, outgroups=outgroupPaths, alignmentsFile=self.tempOutputFile, outgroupFragmentPaths=outgroupFragmentPaths, ingroupCoveragePaths=ingroupCoveragePaths, toilDir=toilDir)
for i, ingroupPath in enumerate(ingroupPaths):
# Get the coverage from the outgroups independently and
# check that it's the same as the file in
# ingroupCoverageDir
otherIngroupPath = ingroupPaths[1] if i == 0 else ingroupPaths[0]
# To filter out alignments from the other ingroup and
# self-alignments we need to create a fasta with all the
# outgroup fragments in it.
outgroupsCombined = getTempFile(rootDir=self.tempDir)
for outgroupFragmentPath in outgroupFragmentPaths:
system("cat %s >> %s" % (outgroupFragmentPath, outgroupsCombined))
independentCoverageFile = getTempFile(rootDir=self.tempDir)
calculateCoverage(fromGenome=outgroupsCombined, sequenceFile=ingroupPath, cigarFile=self.tempOutputFile, outputFile=independentCoverageFile)
# find the coverage file cactus_blast kept (should be
# named according to the basename of the ingroup path
# file)
keptCoverageFile = ingroupCoveragePaths[i]
self.assertTrue(filecmp.cmp(independentCoverageFile, keptCoverageFile))
开发者ID:benedictpaten,项目名称:cactus,代码行数:34,代码来源:blastTest.py
示例18: run
def run(self):
cmd = "halLiftover --outPSL --tab %s %s %s %s %s" % (self.opts.halfile,
self.opts.query, self.bedfile, self.opts.target, self.liftfile)
system(cmd)
#system("cp %s %s_liftoverpsl" % (self.liftfile, self.opts.outfile))
status = get_liftover_status(self.bedfile, self.liftfile, self.opts.edge)
print_status(status, self.statusfile)
开发者ID:glennhickey,项目名称:hal,代码行数:7,代码来源:halLiftoverStatus.py
示例19: run
def run(self):
self.logToMaster("DownSampling\n")
opts = self.options
global_dir = self.getGlobalTempDir()
#sampling_dir = os.path.join(global_dir, "down_sampling")
sampling_dir = os.path.join(opts.outdir, "down_sampling")
system("mkdir -p %s" % sampling_dir)
for sam in os.listdir(self.sampledir):
samdir = os.path.join(self.sampledir, sam)
sample = pickle.load(gzip.open(os.path.join(samdir, sam), "rb"))
out_samdir = os.path.join(sampling_dir, sam)
system("mkdir -p %s" % out_samdir)
if opts.sampling_uniq: # sampling uniq clones
self.addChildTarget(libsample.SampleAnalysis0(sample, samdir,
out_samdir, libsample.sampling,
opts.sampling_uniq, 'uniq'))
elif opts.sampling_top: # sampling reads, then report top clones
self.addChildTarget(libsample.SampleAnalysis0(sample, samdir,
out_samdir, libsample.sampling, opts.sampling,
"top", opts.sampling_top))
else: # sampling reads
self.addChildTarget(libsample.SampleAnalysis0(sample, samdir,
out_samdir, libsample.sampling, opts.sampling))
if opts.normalize:
self.setFollowOnTarget(Normalize(sampling_dir, opts))
else:
self.setFollowOnTarget(Analyses(sampling_dir, opts))
开发者ID:ngannguyen,项目名称:aimseqtk,代码行数:28,代码来源:aimseq.py
示例20: realignSamFile
def realignSamFile(self):
"""Chains and then realigns the resulting global alignments.
"""
tempSamFile = os.path.join(self.getGlobalTempDir(), "temp.sam")
system("cp %s %s" % (self.outputSamFile, tempSamFile))
self.addChildTargetFn(realignSamFileTargetFn, args=(tempSamFile, self.outputSamFile,
self.readFastqFile, self.referenceFastaFile, self.options))
开发者ID:isovic,项目名称:marginAlign,代码行数:7,代码来源:abstractMapper.py
注:本文中的sonLib.bioio.system函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论