本文整理汇总了Python中cobra.core.Reaction.notes方法的典型用法代码示例。如果您正苦于以下问题:Python Reaction.notes方法的具体用法?Python Reaction.notes怎么用?Python Reaction.notes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cobra.core.Reaction
的用法示例。
在下文中一共展示了Reaction.notes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_cobra_model_from_sbml_file
# 需要导入模块: from cobra.core import Reaction [as 别名]
# 或者: from cobra.core.Reaction import notes [as 别名]
#.........这里部分代码省略.........
cobra_model = Model(sbml_model_id)
metabolites = []
metabolite_dict = {}
# Convert sbml_metabolites to cobra.Metabolites
for sbml_metabolite in sbml_species:
# Skip sbml boundary species
if sbml_metabolite.getBoundaryCondition():
continue
if (old_sbml or legacy_metabolite) and \
sbml_metabolite.getId().endswith('_b'):
# Deal with incorrect sbml from bigg.ucsd.edu
continue
tmp_metabolite = Metabolite()
metabolite_id = tmp_metabolite.id = sbml_metabolite.getId()
tmp_metabolite.compartment = compartment_re.split(
sbml_metabolite.getCompartment())[-1]
if legacy_metabolite:
if tmp_metabolite.compartment not in compartment_dict:
tmp_metabolite.compartment = legacy_compartment_converter[
tmp_metabolite.compartment]
tmp_metabolite.id = parse_legacy_id(
tmp_metabolite.id, tmp_metabolite.compartment,
use_hyphens=use_hyphens)
if use_hyphens:
tmp_metabolite.id = metabolite_re.split(
tmp_metabolite.id)[-1].replace('__', '-')
else:
# Just in case the SBML ids are ill-formed and use -
tmp_metabolite.id = metabolite_re.split(
tmp_metabolite.id)[-1].replace('-', '__')
tmp_metabolite.name = sbml_metabolite.getName()
tmp_formula = ''
tmp_metabolite.notes = parse_legacy_sbml_notes(
sbml_metabolite.getNotesString())
if sbml_metabolite.isSetCharge():
tmp_metabolite.charge = sbml_metabolite.getCharge()
if "CHARGE" in tmp_metabolite.notes:
note_charge = tmp_metabolite.notes["CHARGE"][0]
try:
note_charge = float(note_charge)
if note_charge == int(note_charge):
note_charge = int(note_charge)
except:
warn("charge of %s is not a number (%s)" %
(tmp_metabolite.id, str(note_charge)))
else:
if ((tmp_metabolite.charge is None) or
(tmp_metabolite.charge == note_charge)):
tmp_metabolite.notes.pop("CHARGE")
# set charge to the one from notes if not assigend before
# the same
tmp_metabolite.charge = note_charge
else: # tmp_metabolite.charge != note_charge
msg = "different charges specified for %s (%d and %d)"
msg = msg % (tmp_metabolite.id,
tmp_metabolite.charge, note_charge)
warn(msg)
# Chances are a 0 note charge was written by mistake. We
# will default to the note_charge in this case.
if tmp_metabolite.charge == 0:
tmp_metabolite.charge = note_charge
for the_key in tmp_metabolite.notes.keys():
if the_key.lower() == 'formula':
tmp_formula = tmp_metabolite.notes.pop(the_key)[0]