加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python-3.x – Biopython在基因的任一侧记录额外的2个核苷酸,用

发布时间:2020-12-20 13:16:07 所属栏目:Python 来源:网络整理
导读:我正在寻找埋伏终止密码子.我已经将我的代码提到了我从embl文件中提取所需序列的程度.然而,我对如何添加两个上游和两个下游核苷酸有点困惑,所以我最终得到-2,-1,1,2个阅读框. for rec in SeqIO.parse("CP002701.embl","embl"): if rec.features: for feature
我正在寻找埋伏终止密码子.我已经将我的代码提到了我从embl文件中提取所需序列的程度.然而,我对如何添加两个上游和两个下游核苷酸有点困惑,所以我最终得到-2,-1,1,2个阅读框.

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)

是我想改变的部分,但不知道如何更改.location以选择我感兴趣的额外4个基数.

解决方法

@ user7550844(OP)于2017年2月12日15:46写道:

在mofoniusrex on reddit的一些帮助下,这是一个有效的解决方案:

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)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读