本文整理匯總了Python中Bio.SeqIO.SffIO.SffWriter.close方法的典型用法代碼示例。如果您正苦於以下問題:Python SffWriter.close方法的具體用法?Python SffWriter.close怎麽用?Python SffWriter.close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Bio.SeqIO.SffIO.SffWriter
的用法示例。
在下文中一共展示了SffWriter.close方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: fastqReader
# 需要導入模塊: from Bio.SeqIO.SffIO import SffWriter [as 別名]
# 或者: from Bio.SeqIO.SffIO.SffWriter import close [as 別名]
elif seq_format.lower().startswith("fastq"):
from galaxy_utils.sequence.fastq import fastqReader, fastqWriter
reader = fastqReader(open(in_file, "rU"))
writer = fastqWriter(open(out_file, "w"))
marker = "@"
else:
sys.exit("Unsupported file type %r" % seq_format)
#Now do the renaming
count = 0
renamed = 0
for record in reader:
#The [1:] is because the fastaReader leaves the > on the identifier,
#likewise the fastqReader leaves the @ on the identifier
try:
idn, descr = record.identifier[1:].split(None, 1)
except ValueError:
idn = record.identifier[1:]
descr = None
if idn in rename:
if descr:
record.identifier = "%s%s %s" % (marker, rename[idn], descr)
else:
record.identifier = "%s%s" % (marker, rename[idn])
renamed += 1
writer.write(record)
count += 1
writer.close()
reader.close()
print "Renamed %i out of %i records" % (renamed, count)