Bio.SeqIO.AceIO模块

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

您需要通过Bio.SeqIO函数使用此模块。另请参阅Bio.Sequencing.Ace模块,该模块提供的功能不仅仅是将ACE文件中的重叠群一致序列作为SeqRecord对象进行访问。

Bio.SeqIO.AceIO.AceIterator(source)

从ACE文件返回SeqRecord对象。

这使用Bio.Sequencing.Ace模块来完成繁重的工作。请注意,通过在一次遍历中迭代文件,我们被迫忽略任何WA、CT、RT或WR页脚标记。

ACE文件包括每个职位的基本质量,它们被视为Phred样式分数。就像您使用使用Bio.SeqIO的Phred分数读取FASTQ或QUAL文件一样,这些分数存储在SeqRecord的Letter_Annotation字典中的“Phred_Quality”键下。

>>> from Bio import SeqIO
>>> with open("Ace/consed_sample.ace") as handle:
...     for record in SeqIO.parse(handle, "ace"):
...         print("%s %s... %i" % (record.id, record.seq[:10], len(record)))
...         print(max(record.letter_annotations["phred_quality"]))
Contig1 agccccgggc... 1475
90

但是,ACE文件不包括共识序列中任何间隙的基本质量,并且这些间隙在Biopython中以零质量表示。使用零可能具有误导性,因为可能有非常有力的证据支持共识中的差距。因此,以前的Biopython版本使用None代替,但这一使用很复杂,并且阻止了以FASTQ格式输出有间隙的序列。

>>> from Bio import SeqIO
>>> with open("Ace/contig1.ace") as handle:
...     for record in SeqIO.parse(handle, "ace"):
...         print("%s ...%s..." % (record.id, record.seq[85:95]))
...         print(record.letter_annotations["phred_quality"][85:95])
...         print(max(record.letter_annotations["phred_quality"]))
Contig1 ...AGAGG-ATGC...
[57, 57, 54, 57, 57, 0, 57, 72, 72, 72]
90
Contig2 ...GAATTACTAT...
[68, 68, 68, 68, 68, 68, 68, 68, 68, 68]
90