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)
评论列表
文章目录