我使用biopython来完成一个简单的任务:从特定的基因库填充,提取基因ID和相关信息到表中。biopython FeatureLocation比较
当我试图比较来自不同SeqFeature
的Seq.SeqFeature.SeqFeature.location
时,它每次都给我False
。即使在以下情况:
from Bio.SeqFeature import FeatureLocation
location1 = FeatureLocation(0,0,strand = 1)
location2 = FeatureLocation(0,0,strand = 1)
print(location1 == location2) # will print False
只有这样才能给我想要的结果:
print(location1.start == location2.start and location1.end == location2.end and location1.strand == location2.strand) # will print True.
问题解决了这个样子,但我仍然徘徊,这是否是由设计出于某种原因或比较方法还没有建成。
下面是为什么我来解决这个问题的过程:
- 首先,我只提取自GenBank文件
feat.type == 'CDS'
信息,发现 所有伪基因丢失。 于是我想出了这个想法在
feat.type == 'gene'
记录信息,然后寻找要么'CDS'
或'misc_feature'
记录该基因的更多信息。这产生需要确认
'CDS'
或'misc_feature'
被的情况下,注释在同一个位置有多个'misc_feature'
标注同一基因的某些域。
Biopython 1.70最近发布,包含了来自Kai Blin的这项增强功能。在这个特殊的位置之前/之后,有一点模糊不清。 – peterjc