Bio.SeqIO.PhdIO模块

Bio.SeqIO支持“phd”文件格式。

PHD文件由PHRED输出,并由PHRAP和CONMED使用。

您需要通过Bio.SeqIO函数以格式名称“phd”使用此模块。另请参阅基础的Bio.Sequencing.Phd模块。

例如,使用Bio.SeqIO,我们可以从Biopython单元测试中读取其中一个示例PHRED文件:

>>> from Bio import SeqIO
>>> for record in SeqIO.parse("Phd/phd1", "phd"):
...     print(record.id)
...     print("%s..." % record.seq[:10])
...     print("%s..." % record.letter_annotations["phred_quality"][:10])
34_222_(80-A03-19).b.ab1
ctccgtcgga...
[9, 9, 10, 19, 22, 37, 28, 28, 24, 22]...
425_103_(81-A03-19).g.ab1
cgggatccca...
[14, 17, 22, 10, 10, 10, 15, 8, 8, 9]...
425_7_(71-A03-19).b.ab1
acataaatca...
[10, 10, 10, 10, 8, 8, 6, 6, 6, 6]...

由于PHRED文件包含质量分数,因此您可以将它们保存为FASTQ或QUAL文件,例如使用Bio.SeqIO. writer(.),或者简单地使用SeqRecord对象的格式方法:

>>> print(record[:50].format("fastq"))
@425_7_(71-A03-19).b.ab1
acataaatcaaattactnaccaacacacaaaccngtctcgcgtagtggag
+
++++))'''')(''')$!$''')''''(+.''$!$))))+)))'''''''

或者,

>>> print(record[:50].format("qual"))
>425_7_(71-A03-19).b.ab1
10 10 10 10 8 8 6 6 6 6 8 7 6 6 6 8 3 0 3 6 6 6 8 6 6 6 6 7
10 13 6 6 3 0 3 8 8 8 8 10 8 8 8 6 6 6 6 6 6 6

请注意,这些示例仅显示前50个碱基,以保持输出较短。

class Bio.SeqIO.PhdIO.PhdIterator(source: IO[str] | PathLike | str | bytes)

基类:SequenceIterator

PHD文件的解析器。

modes = 't'
__init__(source: IO[str] | PathLike | str | bytes) None

从PHD文件返回SeqRecord对象。

论点:
  • 源-以文本模式打开的输入流,或文件的路径

这使用Bio.Sequencing.Phd模块来完成艰苦的工作。

__next__()

返回下一个SeqRecord。

此方法必须由子类实现。

__abstractmethods__ = frozenset({})
__annotations__ = {}
__firstlineno__ = 67
__parameters__ = ()
__static_attributes__ = ()
class Bio.SeqIO.PhdIO.PhdWriter(target: IO | PathLike | str | bytes)

基类:SequenceWriter

编写博士格式文件的类。

modes = 't'
write_record(record)

将单个博士记录写入文件。

__abstractmethods__ = frozenset({})
__annotations__ = {}
__firstlineno__ = 113
__parameters__ = ()
__static_attributes__ = ()