def main(args): for f in args: mbrFile,mbrPath = mystemp(suffix='.mbr') fStub,fExt = os.path.splitext(f) oFile = safeOFW('.'.join((fStub,'Hg18rm',fExt[1:])),'w') print os.curdir try: subprocess.call(['megablast', '-m8', '-i',f, '-d', hg18db,'-o', mbrPath]) humanQrys =B.m8TitleSet(mbrPath,qrySet=True) for rec in fasta.generalIterator(f): if len(humanQrys)==0: break if rec.title in humanQrys: continue else: print >> oFile, rec oFile.close() except BaseException: os.unlink(oFile.name) print '%s -failed' %f raise finally: os.unlink(mbrPath) return 0
def main(args,maxMismatch=0,seedLen=36): for f in args: bowtieFile,bowtiePath = mystemp(suffix='.bowtie') fStub,fExt = os.path.splitext(f) oFile = safeOFW('.'.join((fStub,'Hg18rm',fExt[1:])),'w') print os.curdir try: subprocess.call(['bowtie', '-f','-l',str(seedLen),'-n',str(maxMismatch), hg18db, f, bowtiePath]) humanQrys =B.readTitleSet(bowtiePath) if len(humanQrys)==0: raise RuntimeError, "No Alignments found" for rec in fasta.generalIterator(f): if rec.title in humanQrys: continue else: print >> oFile, rec oFile.close() except BaseException: os.unlink(oFile.name) print '%s -failed' %f raise finally: os.unlink(bowtiePath) return 0