Bio.SeqIO.PhdIO 模組
Bio.SeqIO 支援 "phd" 檔案格式。
PHD 檔案由 PHRED 輸出,並由 PHRAP 和 CONSED 使用。
您應該透過 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.write(…),或者直接使用 SeqRecord 物件的 format 方法
>>> 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 個鹼基,以保持輸出簡短。
- Bio.SeqIO.PhdIO.PhdIterator(source: IO[str] | PathLike | str | bytes) Iterator[SeqRecord]
從 PHD 檔案傳回 SeqRecord 物件。
- 引數
source - 以文字模式開啟的輸入流,或是檔案的路徑
這使用 Bio.Sequencing.Phd 模組來完成繁重的工作。