import_genbank.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:db-import 作者: antismash 项目源码 文件源码
def create_smcog_hit(cur, feature, gene_id):
    '''Create an smCOG hit entry'''
    try:
        smcog_name, smcog_score, smcog_evalue = parse_smcog(feature)
        smcog_score = float(smcog_score)
        smcog_evalue = float(smcog_evalue)
        smcog_id = get_smcog_id(cur, smcog_name)
        cur.execute("SELECT gene_id, smcog_id FROM antismash.smcog_hits WHERE smcog_id = %s AND gene_id = %s", (smcog_id, gene_id))
        ret = cur.fetchone()
        if ret is None:
            cur.execute("INSERT INTO antismash.smcog_hits (score, evalue, smcog_id, gene_id) VALUES (%s, %s, %s, %s)", (smcog_score, smcog_evalue, smcog_id, gene_id))
    except ValueError as e:
        # no smcog qualifier is an expected error, don't log that
        err_msg = str(e)
        if not (err_msg.startswith('No smcog qualifier') or
                err_msg.startswith('No note qualifier')):
            print(e, file=sys.stderr)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号