Python 3.x Biopython在+2,-2阅读框中记录基因两侧额外的2个核苷酸
我在找伏击密码子。我已经把我的代码从embl文件中提取出了我需要的序列。然而,我有点困惑于如何添加两个上游和两个下游核苷酸,所以我最终得到了-2,-1,0,1,2阅读框Python 3.x Biopython在+2,-2阅读框中记录基因两侧额外的2个核苷酸,python-3.x,bioinformatics,biopython,Python 3.x,Bioinformatics,Biopython,我在找伏击密码子。我已经把我的代码从embl文件中提取出了我需要的序列。然而,我有点困惑于如何添加两个上游和两个下游核苷酸,所以我最终得到了-2,-1,0,1,2阅读框 for rec in SeqIO.parse("CP002701.embl", "embl"): if rec.features: for feature in rec.features: if feature.type == "CDS": prin
for rec in SeqIO.parse("CP002701.embl", "embl"):
if rec.features:
for feature in rec.features:
if feature.type == "CDS":
print(feature.location)
print(feature.qualifiers["protein_id"])
print(feature.location.extract(rec).seq)
是我想更改的部分,但不确定如何更改。位置以选择我感兴趣的额外4个碱基。@user7550844 OP于2017年2月12日15:46写道:
在这里提供一些帮助后,有一个有效的解决方案:
for rec in SeqIO.parse("CP002701.embl", "embl"):
if rec.features:
for feature in rec.features:
if feature.type == "CDS":
pad=2
newloc = SeqFeature.FeatureLocation( feature.location.start - pad,feature.location.end + pad)
newfeature=SeqFeature.SeqFeature(location=newloc,
type=feature.type,
strand=feature.strand,
ref=feature.ref,
ref_db=feature.ref_db)
newfeature.qualifiers = feature.qualifiers
print(newfeature.qualifiers)
print(newfeature.location)
print(newfeature.location.extract(rec).seq)
你能把答案作为一个实际的问题答案并标记为已解决吗?