本文整理汇总了Python中Bio.SeqFeature.SeqFeature.qualifiers['db_xref']方法的典型用法代码示例。如果您正苦于以下问题:Python SeqFeature.qualifiers['db_xref']方法的具体用法?Python SeqFeature.qualifiers['db_xref']怎么用?Python SeqFeature.qualifiers['db_xref']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bio.SeqFeature.SeqFeature
的用法示例。
在下文中一共展示了SeqFeature.qualifiers['db_xref']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doConvert
# 需要导入模块: from Bio.SeqFeature import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature.SeqFeature import qualifiers['db_xref'] [as 别名]
#.........这里部分代码省略.........
feature.qualifiers['EC_number'].append(ec)
# Remove tRNA /product (not only when containing ???)
if clean:
if feature.type == 'tRNA' and 'product' in feature.qualifiers.keys():
del feature.qualifiers['product']
#for i in range(len(feature.qualifiers['product'])):
# if feature.qualifiers['product'][i].count('?') > 1:
# del feature.qualifiers['product'][i]
if 'function' in feature.qualifiers.keys():
for i in range(len(feature.qualifiers['function'])):
(feature.qualifiers['function'][i], ec_list) = getValueWithoutEc(feature.qualifiers['function'][i], feature)
if ec_list:
for ec in ec_list:
if 'EC_number' not in feature.qualifiers.keys():
feature.qualifiers['EC_number'] = [ec]
else:
feature.qualifiers['EC_number'].append(ec)
# Remove FT gene & keep only one FT source per record & remove some CDS
if clean:
if not feature.type == 'gene':
if feature.type == 'source':
if first_source:
new_features.append(feature)
first_source = False
# Remove CDS that are not valid
# CDS -- translation must start with M, nucleotide sequence without N's & no overlap with gap feature
# CDS -- must not have internal stop codons
# CDS -- must end with stop codons (TAG, TAA, or TGA) or add '<' or '>' e.g. complement(<1..174); 1399953..>1401221
elif feature.type == 'CDS':
if not 'transl_table' in feature.qualifiers.keys():
feature.qualifiers['transl_table'] = 11
if feature.strand == 1:
stop_codon = record.seq[feature.location.nofuzzy_end-3:feature.location.nofuzzy_end]
if not str(stop_codon) in ['TAG', 'TAA', 'TGA']:
feature.location = FeatureLocation(ExactPosition(feature.location.nofuzzy_start), AfterPosition(feature.location.nofuzzy_end))
if feature.strand == -1:
stop_codon = record.seq[feature.location.nofuzzy_start:feature.location.nofuzzy_start+3]
if not str(stop_codon) in ['CTA', 'TTA', 'TCA']:
feature.location = FeatureLocation(BeforePosition(feature.location.nofuzzy_start), ExactPosition(feature.location.nofuzzy_end))
translation = feature.extract(record.seq).translate(table=11)
if 'translation' in feature.qualifiers.keys():
if translation[-1] == '*':
if not len(translation) - 1 == len(feature.qualifiers['translation'][0]):
print 'WARNING: CDS %s translation length of different size' % feature.location
print translation
print feature.qualifiers['translation'][0]
else:
if not str(translation[:-1]) == str(feature.qualifiers['translation'][0]):
print 'WARNING: CDS %s translation not identical' % feature.location
print translation[:-1]
print feature.qualifiers['translation'][0]
else:
if not len(translation) == len(feature.qualifiers['translation'][0]):
print 'WARNING: CDS %s translation length of different size' % feature.translation
print translation
print feature.qualifiers['translation'][0]
else:
if not str(translation) == str(feature.qualifiers['translation'][0]):
print 'WARNING: CDS %s translation not identical' % feature.location
print translation
print feature.qualifiers['translation'][0]
#feature.qualifiers['translation'] = [translation]
if translation.startswith('M') and record.seq[feature.location.nofuzzy_start:feature.location.nofuzzy_end].count('N') == 0:
if translation[:-1].count('*') >= 1:
print 'WARNING: CDS %s with internal stop codon' % feature.location
print translation
else:
new_features.append(feature)
else:
print 'WARNING: CDS %s does not start with M' % feature.location
print translation
removed_cds = removed_cds + 1
else:
new_features.append(feature)
if not clean:
new_features.append(feature)
# Add source feature
if not has_source:
feature = SeqFeature(FeatureLocation(0,len(record.seq)), type="source")
feature.qualifiers['organism'] = ["%s %s" % (organism_name, strain)]
feature.qualifiers['strain'] = [strain]
feature.qualifiers['db_xref'] = ["taxon:%s" % taxon_id]
feature.qualifiers['mol_type'] = getMolType(embl_file)
new_features.append(feature)
if clean:
print 'WARNING: %s CDSs have been removed' % removed_cds
else:
print "Only adding header, use '--clean' for cleaning features"
new_features.extend(gap_features)
new_features.sort(feature_compare)
record.features = new_features
# Write out new embl file
SeqIO.write([record], open(dep_file, "w"), "embl")