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
def main(args): fFile= args[-1] titles=set(args[:-1]) for rec in fasta.generalIterator(fFile): if rec.title in titles: print rec return 0
def somethingUsefull(args, oFile): for f in args: for rec in fasta.generalIterator(f): if fasta.isAllDRNA(rec.sequence): print >> oFile, rec else: n = 0 for uaSeq in fasta.expandAmbiguousSequence(rec.sequence): uaTitle = rec.title + "|ua%s" % n n += 1 print >> oFile, rec.__class__(title=uaTitle, sequence=uaSeq)
def main(args): for rec in fasta.generalIterator(args[0]): rec.title+='|%.1f' % rec.Tm() print rec return 0