本文整理汇总了Python中Bio.SeqIO.SffIO.SffWriter.write方法的典型用法代码示例。如果您正苦于以下问题:Python SffWriter.write方法的具体用法?Python SffWriter.write怎么用?Python SffWriter.write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bio.SeqIO.SffIO.SffWriter
的用法示例。
在下文中一共展示了SffWriter.write方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fastqReader
# 需要导入模块: from Bio.SeqIO.SffIO import SffWriter [as 别名]
# 或者: from Bio.SeqIO.SffIO.SffWriter import write [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)