本文整理汇总了Python中cobra.core.Reaction.systematic_names方法的典型用法代码示例。如果您正苦于以下问题:Python Reaction.systematic_names方法的具体用法?Python Reaction.systematic_names怎么用?Python Reaction.systematic_names使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cobra.core.Reaction
的用法示例。
在下文中一共展示了Reaction.systematic_names方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_cobra_model_from_sbml_file
# 需要导入模块: from cobra.core import Reaction [as 别名]
# 或者: from cobra.core.Reaction import systematic_names [as 别名]
#.........这里部分代码省略.........
# specified then the bounds are determined by getReversible.
if not sbml_reaction.getKineticLaw():
if sbml_reaction.getReversible():
parameter_dict['lower_bound'] = __default_lower_bound
parameter_dict['upper_bound'] = __default_upper_bound
else:
# Assume that irreversible reactions only proceed from left to
# right.
parameter_dict['lower_bound'] = 0
parameter_dict['upper_bound'] = __default_upper_bound
parameter_dict[
'objective_coefficient'] = __default_objective_coefficient
else:
for sbml_parameter in \
sbml_reaction.getKineticLaw().getListOfParameters():
parameter_dict[
sbml_parameter.getId().lower()] = sbml_parameter.getValue()
if 'lower_bound' in parameter_dict:
reaction.lower_bound = parameter_dict['lower_bound']
elif 'lower bound' in parameter_dict:
reaction.lower_bound = parameter_dict['lower bound']
elif sbml_reaction.getReversible():
reaction.lower_bound = __default_lower_bound
else:
reaction.lower_bound = 0
if 'upper_bound' in parameter_dict:
reaction.upper_bound = parameter_dict['upper_bound']
elif 'upper bound' in parameter_dict:
reaction.upper_bound = parameter_dict['upper bound']
else:
reaction.upper_bound = __default_upper_bound
objective_coefficient = parameter_dict.get(
'objective_coefficient', parameter_dict.get(
'objective_coefficient', __default_objective_coefficient))
if objective_coefficient != 0:
coefficients[reaction] = objective_coefficient
# ensure values are not set to nan or inf
if isnan(reaction.lower_bound) or isinf(reaction.lower_bound):
reaction.lower_bound = __default_lower_bound
if isnan(reaction.upper_bound) or isinf(reaction.upper_bound):
reaction.upper_bound = __default_upper_bound
reaction_note_dict = parse_legacy_sbml_notes(
sbml_reaction.getNotesString())
# Parse the reaction notes.
# POTENTIAL BUG: DEALING WITH LEGACY 'SBML' THAT IS NOT IN A
# STANDARD FORMAT
# TODO: READ IN OTHER NOTES AND GIVE THEM A reaction_ prefix.
# TODO: Make sure genes get added as objects
if 'GENE ASSOCIATION' in reaction_note_dict:
rule = reaction_note_dict['GENE ASSOCIATION'][0]
try:
rule.encode('ascii')
except (UnicodeEncodeError, UnicodeDecodeError):
warn("gene_reaction_rule '%s' is not ascii compliant" % rule)
if rule.startswith(""") and rule.endswith("""):
rule = rule[6:-6]
reaction.gene_reaction_rule = rule
if 'GENE LIST' in reaction_note_dict:
reaction.systematic_names = reaction_note_dict['GENE LIST'][0]
elif ('GENES' in reaction_note_dict and
reaction_note_dict['GENES'] != ['']):
reaction.systematic_names = reaction_note_dict['GENES'][0]
elif 'LOCUS' in reaction_note_dict:
gene_id_to_object = dict([(x.id, x) for x in reaction._genes])
for the_row in reaction_note_dict['LOCUS']:
tmp_row_dict = {}
the_row = 'LOCUS:' + the_row.lstrip('_').rstrip('#')
for the_item in the_row.split('#'):
k, v = the_item.split(':')
tmp_row_dict[k] = v
tmp_locus_id = tmp_row_dict['LOCUS']
if 'TRANSCRIPT' in tmp_row_dict:
tmp_locus_id = tmp_locus_id + \
'.' + tmp_row_dict['TRANSCRIPT']
if 'ABBREVIATION' in tmp_row_dict:
gene_id_to_object[tmp_locus_id].name = tmp_row_dict[
'ABBREVIATION']
if 'SUBSYSTEM' in reaction_note_dict:
reaction.subsystem = reaction_note_dict.pop('SUBSYSTEM')[0]
reaction.notes = reaction_note_dict
# Now, add all of the reactions to the model.
cobra_model.id = sbml_model.getId()
# Populate the compartment list - This will be done based on
# cobra.Metabolites in cobra.Reactions in the future.
cobra_model.compartments = compartment_dict
cobra_model.add_reactions(cobra_reaction_list)
set_objective(cobra_model, coefficients)
return cobra_model