4.1. wc_lang package

4.1.2. Submodules

4.1.3. wc_lang.__main__ module

Command line programs for manipulating model definitions

Author

Jonathan Karr <karr@mssm.edu>

Author

Arthur Goldberg <Arthur.Goldberg@mssm.edu>

Date

2016-12-07

Copyright

2016, Karr Lab

License

MIT

class wc_lang.__main__.App(label=None, **kw)[source]

Bases: cement.core.foundation.App

Command line application

class Meta[source]

Bases: object

base_controller = 'base'[source]
handlers = [<class 'wc_lang.__main__.BaseController'>, <class 'wc_lang.__main__.CutSubmodelsController'>, <class 'wc_lang.__main__.MergeModelsController'>, <class 'wc_lang.__main__.ValidateController'>, <class 'wc_lang.__main__.DifferenceController'>, <class 'wc_lang.__main__.TransformController'>, <class 'wc_lang.__main__.NormalizeController'>, <class 'wc_lang.__main__.ConvertController'>, <class 'wc_lang.__main__.CreateTemplateController'>, <class 'wc_lang.__main__.UpdateVersionMetadataController'>, <class 'wc_lang.__main__.ExportController'>, <class 'wc_lang.__main__.ImportController'>, <class 'obj_tables.migrate.CementControllers.SchemaChangesTemplateController'>][source]
label = 'wc-lang'[source]
class wc_lang.__main__.BaseController(*args, **kw)[source]

Bases: cement.ext.ext_argparse.ArgparseController

Base controller for command line application

class Meta[source]

Bases: object

arguments = [(['-v', '--version'], {'action': 'version', 'version': '0.0.1'})][source]
description = 'Command line utilities for managing whole-cell model definitions'[source]
help = 'Command line utilities for managing whole-cell model definitions'[source]
label = 'base'[source]
class wc_lang.__main__.ConvertController(*args, **kw)[source]

Bases: cement.ext.ext_argparse.ArgparseController

Convert model among Excel (.xlsx), comma separated (.csv), JavaScript Object Notation (.json), tab separated (.tsv), and Yet Another Markup Language (.yaml, .yml) formats

class Meta[source]

Bases: object

arguments = [(['source'], {'type': <class 'str'>, 'help': 'Path to model'}), (['dest'], {'type': <class 'str'>, 'help': 'Path to save model in converted format'}), (['--unprotected'], {'action': 'store_true', 'default': False, 'help': 'If set, do not protect the outputted workbook'})][source]
description = 'Convert model among .csv, .json, .tsv, .xlsx, .yaml, and .yml formats'[source]
help = 'Convert model among .csv, .json, .tsv, .xlsx, .yaml, and .yml formats'[source]
label = 'convert'[source]
stacked_on = 'base'[source]
stacked_type = 'nested'[source]
class wc_lang.__main__.CreateTemplateController(*args, **kw)[source]

Bases: cement.ext.ext_argparse.ArgparseController

Create file with model template (i.e. create file with row and column labels)

class Meta[source]

Bases: object

arguments = [(['path'], {'type': <class 'str'>, 'help': 'Path to save model template'}), (['--ignore-repo-metadata'], {'dest': 'data_repo_metadata', 'default': True, 'action': 'store_false', 'help': 'If set, do not set the Git repository metadata for the knowledge base from the parent directory of `path`'}), (['--unprotected'], {'action': 'store_true', 'default': False, 'help': 'If set, do not protect the outputted workbook'})][source]
description = 'Create file with model template: blank file(s) with row and column labels'[source]
help = 'Create file with model template: blank file(s) with row and column labels'[source]
label = 'create-template'[source]
stacked_on = 'base'[source]
stacked_type = 'nested'[source]
class wc_lang.__main__.CutSubmodelsController(*args, **kw)[source]

Bases: cement.ext.ext_argparse.ArgparseController

Cut submodels into separate models

class Meta[source]

Bases: object

arguments = [(['in_file'], {'type': <class 'str'>, 'help': 'Path to model to cut'}), (['out_dir'], {'type': <class 'str'>, 'help': 'Directory to save cut submodels'}), (['--unprotected'], {'action': 'store_true', 'default': False, 'help': 'If set, do not protect the outputted workbook'})][source]
description = 'Cut submodels into separate models'[source]
help = 'Cut submodels into separate models'[source]
label = 'cut-submodels'[source]
stacked_on = 'base'[source]
stacked_type = 'nested'[source]
class wc_lang.__main__.DifferenceController(*args, **kw)[source]

Bases: cement.ext.ext_argparse.ArgparseController

Display difference between two model definitions

class Meta[source]

Bases: object

arguments = [(['path_1'], {'type': <class 'str'>, 'help': 'Path to first model'}), (['path_2'], {'type': <class 'str'>, 'help': 'Path to second model'}), (['--compare-files'], {'dest': 'compare_files', 'default': False, 'action': 'store_true', 'help': 'If true, compare models; otherwise compare files directly'}), (['--compare-metadata-in-files'], {'dest': 'compare_metadata_in_files', 'default': False, 'action': 'store_true', 'help': 'If true, compare metadata (tables of contents, header rows)'})][source]
description = 'Get difference between two model definitions'[source]
help = 'Get difference between two model definitions'[source]
label = 'difference'[source]
stacked_on = 'base'[source]
stacked_type = 'nested'[source]
static remove_metadata(model)[source]

Remove metadata from model

Parameters

model (wc_utils.workbook.Workbook) – model

class wc_lang.__main__.ExportController(*args, **kw)[source]

Bases: cement.ext.ext_argparse.ArgparseController

Export a model to SBML

class Meta[source]

Bases: object

arguments = [(['in_path'], {'type': <class 'str'>, 'help': 'Path to model to export'}), (['out_dir'], {'type': <class 'str'>, 'help': 'Directory to save exported model'})][source]
description = 'Export a model to SBML'[source]
help = 'Export a model to SBML'[source]
label = 'export'[source]
stacked_on = 'base'[source]
stacked_type = 'nested'[source]
class wc_lang.__main__.ImportController(*args, **kw)[source]

Bases: cement.ext.ext_argparse.ArgparseController

Import a model from SBML

class Meta[source]

Bases: object

arguments = [(['in_dir'], {'type': <class 'str'>, 'help': 'Directory with model to import'}), (['out_path'], {'type': <class 'str'>, 'help': 'Path to save model'}), (['--unprotected'], {'action': 'store_true', 'default': False, 'help': 'If set, do not protect the outputted workbook'})][source]
description = 'Import a model from SBML'[source]
help = 'Import a model from SBML'[source]
label = 'import'[source]
stacked_on = 'base'[source]
stacked_type = 'nested'[source]
class wc_lang.__main__.MergeModelsController(*args, **kw)[source]

Bases: cement.ext.ext_argparse.ArgparseController

Merge models

class Meta[source]

Bases: object

arguments = [(['-p', '--primary'], {'dest': 'primary_path', 'type': <class 'str'>, 'help': 'Path to base for merged model'}), (['-s', '--secondary'], {'dest': 'secondary_paths', 'type': <class 'str'>, 'nargs': '*', 'help': 'Path to models to merge into primary model'}), (['-o', '--out'], {'dest': 'out_path', 'type': <class 'str'>, 'help': 'Path to save merged model'}), (['--unprotected'], {'action': 'store_true', 'default': False, 'help': 'If set, do not protect the outputted workbook'})][source]
description = 'Merge multiple models'[source]
help = 'Merge multiple models'[source]
label = 'merge-models'[source]
stacked_on = 'base'[source]
stacked_type = 'nested'[source]
class wc_lang.__main__.NormalizeController(*args, **kw)[source]

Bases: cement.ext.ext_argparse.ArgparseController

Normalize model

class Meta[source]

Bases: object

arguments = [(['source'], {'type': <class 'str'>, 'help': 'Path to model'}), (['--dest'], {'default': '', 'type': <class 'str'>, 'help': 'Path to save normalized model'}), (['--unprotected'], {'action': 'store_true', 'default': False, 'help': 'If set, do not protect the outputted workbook'})][source]
description = 'Normalize model'[source]
help = 'Normalize model'[source]
label = 'normalize'[source]
stacked_on = 'base'[source]
stacked_type = 'nested'[source]
class wc_lang.__main__.TransformController(*args, **kw)[source]

Bases: cement.ext.ext_argparse.ArgparseController

Apply one, or more, transforms to a model and save the result

class Meta[source]

Bases: object

arguments = [(['source'], {'type': <class 'str'>, 'help': 'Path to model'}), (['dest'], {'type': <class 'str'>, 'help': 'Path to save transformed model'}), (['--transform'], {'dest': 'transforms', 'action': 'append', 'help': 'Model transform:\n ChangeValue: Change a value of an attribute of a model\n CreateImplicitDfbaExchangeReactions: Create implicit exchange reactions for dFBA submodels\n CreateImplicitDistributionZeroInitConcentrations: Create the implicit zero concentrations in a model\n MergeAlgorithmicallyLikeSubmodels: Merge groups of algorithmically-like submodels into individual submodels\n NullifyAttrs: Generate a reduced model by nullifying specific attributes\n PrepForSbml: Transform model into SBML-compatible representation and discard information that cannot be exported to SBML\n PrepForWCSim: Prepare model for simulation by making implicit information in the model explicit\n SetFiniteDfbaFluxBoundsTransform: Clip the flux bounds for the reactions in dFBA submodels to the default flux range\n SplitReversibleReactions: Split reversible reactions into separate forward and backward reactions'}), (['--unprotected'], {'action': 'store_true', 'default': False, 'help': 'If set, do not protect the outputted workbook'})][source]
description = 'Apply one, or more, transforms to a model and save the result'[source]
help = 'Apply one, or more, transforms to a model and save the result'[source]
label = 'transform'[source]
stacked_on = 'base'[source]
stacked_type = 'nested'[source]
class wc_lang.__main__.UpdateVersionMetadataController(*args, **kw)[source]

Bases: cement.ext.ext_argparse.ArgparseController

Update the version metadata (repository URL, branch, revision; wc_lang version) of a model

class Meta[source]

Bases: object

arguments = [(['path'], {'type': <class 'str'>, 'help': 'Path to model'}), (['--ignore-repo-metadata'], {'dest': 'data_repo_metadata', 'default': True, 'action': 'store_false', 'help': 'If set, do not set the Git repository metadata for the knowledge base from the parent directory of `path-core`'}), (['--unprotected'], {'action': 'store_true', 'default': False, 'help': 'If set, do not protect the outputted workbook'})][source]
description = 'Update the version metadata (repository URL, branch, revision; wc_lang version) of a model'[source]
help = 'Update the version metadata (repository URL, branch, revision; wc_lang version) of a model'[source]
label = 'update-version-metadata'[source]
stacked_on = 'base'[source]
stacked_type = 'nested'[source]
class wc_lang.__main__.ValidateController(*args, **kw)[source]

Bases: cement.ext.ext_argparse.ArgparseController

Validate model and display errors

class Meta[source]

Bases: object

arguments = [(['path'], {'type': <class 'str'>, 'help': 'Path to model'})][source]
description = 'Validate model and display errors'[source]
help = 'Validate model and display errors'[source]
label = 'validate'[source]
stacked_on = 'base'[source]
stacked_type = 'nested'[source]
wc_lang.__main__.main()[source]

4.1.4. wc_lang._version module

4.1.5. wc_lang.core module

Data model to represent composite, multi-algorithmic biochemical models.

This module defines classes that represent the schema and provenance of a biochemical model:

These are all instances of obj_tables.Model. A biochemical model may contain a list of instances of each of these classes, interlinked by object references. For example, a Species references the compartment which contains it as a Compartment instance and the species category to which it belongs as a SpeciesType instance.

This module also defines numerous classes that serve as attributes of these classes.

Author

Jonathan Karr <karr@mssm.edu>

Author

Arthur Goldberg <Arthur.Goldberg@mssm.edu>

Date

2016-11-10

Copyright

2016-2017, Karr Lab

License

MIT

class wc_lang.core.Author(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

An author of a model

id[source]

unique identifier

Type

str

name[source]

full name

Type

str

model[source]

model

Type

Model

last_name[source]

last name(s)

Type

str

first_name[source]

first name(s)

Type

str

middle_name[source]

middle name(s)

Type

str

title[source]

title

Type

str

organization[source]

organization

Type

str

email[source]

email address

Type

str

website[source]

website

Type

str

address[source]

physical address

Type

str

identifiers[source]

identifiers

Type

list of Identifier

comments[source]

comments

Type

str

Related attributes:

  • conclusions (list of Conclusion): conclusions

  • changes (list of Change): changes

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('id', 'name', 'last_name', 'first_name', 'middle_name', 'title', 'organization', 'email', 'website', 'address', 'identifiers', 'comments')[source]
attributes = {'address': <obj_tables.core.LongStringAttribute object>, 'comments': <obj_tables.core.LongStringAttribute object>, 'email': <obj_tables.core.EmailAttribute object>, 'first_name': <obj_tables.core.StringAttribute object>, 'id': <obj_tables.core.SlugAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'last_name': <obj_tables.core.StringAttribute object>, 'middle_name': <obj_tables.core.StringAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'organization': <obj_tables.core.LongStringAttribute object>, 'title': <obj_tables.core.LongStringAttribute object>, 'website': <obj_tables.core.UrlAttribute object>}[source]
child_attrs = {'sbml': ('id', 'name', 'model', 'last_name', 'first_name', 'middle_name', 'title', 'organization', 'email', 'website', 'address', 'identifiers', 'comments'), 'wc_sim': ()}[source]
children = {'core_model': ('identifiers',), 'submodel': ('identifiers',)}[source]
frozen_columns = 2[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.Author'>,)[source]
local_attributes = {'address': <obj_tables.core.LocalAttribute object>, 'changes': <obj_tables.core.LocalAttribute object>, 'comments': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'email': <obj_tables.core.LocalAttribute object>, 'first_name': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'last_name': <obj_tables.core.LocalAttribute object>, 'middle_name': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'organization': <obj_tables.core.LocalAttribute object>, 'title': <obj_tables.core.LocalAttribute object>, 'website': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.SlugAttribute object>[source]
related_attributes = {'changes': <obj_tables.core.ManyToManyAttribute object>, 'conclusions': <obj_tables.core.ManyToManyAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Author'[source]
verbose_name_plural = 'Authors'[source]
address = <obj_tables.core.LongStringAttribute object>[source]
comments = <obj_tables.core.LongStringAttribute object>[source]
email = <obj_tables.core.EmailAttribute object>[source]
first_name = <obj_tables.core.StringAttribute object>[source]
get_identifier(namespace)[source]

Get the author’s id in a namespace (e.g., github.user, orcid)

Parameters

namespace (str) – namespace of the identifier to retrieve

Returns

user’s id in namespace

Return type

str

Raises

ValueError – if the author has multiple ids in namespace

id = <obj_tables.core.SlugAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
last_name = <obj_tables.core.StringAttribute object>[source]
middle_name = <obj_tables.core.StringAttribute object>[source]
model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
organization = <obj_tables.core.LongStringAttribute object>[source]
title = <obj_tables.core.LongStringAttribute object>[source]
website = <obj_tables.core.UrlAttribute object>[source]
class wc_lang.core.Change(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

A change to a model

id[source]

unique identifier

Type

str

name[source]

full name

Type

str

model[source]

model

Type

Model

type[source]

type

Type

pronto.term.Term

target[source]

target

Type

str

target_submodel[source]

target submodel

Type

Submodel

target_type[source]

target type

Type

pronto.term.Term

reason[source]

reason

Type

str

reason_type[source]

type of reason

Type

pronto.term.Term

intention[source]

intention

Type

str

intention_type[source]

type of intention

Type

pronto.term.Term

identifiers[source]

identifiers

Type

list of Identifier

evidence[source]

observation that supports/disputes a conclusion

Type

list of Evidence

conclusions[source]

conclusions

Type

list of Conclusion

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

authors[source]

authors

Type

list of Author

date[source]

date

Type

datetime.datetime

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('id', 'name', 'type', 'target', 'target_submodel', 'target_type', 'reason', 'reason_type', 'intention', 'intention_type', 'identifiers', 'evidence', 'conclusions', 'comments', 'references', 'authors', 'date')[source]
attributes = {'authors': <obj_tables.core.ManyToManyAttribute object>, 'comments': <obj_tables.core.LongStringAttribute object>, 'conclusions': <obj_tables.core.ManyToManyAttribute object>, 'date': <obj_tables.core.DateTimeAttribute object>, 'evidence': <wc_lang.core.EvidenceManyToManyAttribute object>, 'id': <obj_tables.core.SlugAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'intention': <obj_tables.core.LongStringAttribute object>, 'intention_type': <obj_tables.sci.onto.OntoTermAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'reason': <obj_tables.core.LongStringAttribute object>, 'reason_type': <obj_tables.sci.onto.OntoTermAttribute object>, 'references': <obj_tables.core.ManyToManyAttribute object>, 'target': <obj_tables.core.LongStringAttribute object>, 'target_submodel': <obj_tables.core.ManyToOneAttribute object>, 'target_type': <obj_tables.sci.onto.OntoTermAttribute object>, 'type': <obj_tables.sci.onto.OntoTermAttribute object>}[source]
child_attrs = {'sbml': (), 'wc_sim': ()}[source]
children = {'core_model': ('identifiers', 'evidence', 'conclusions', 'references', 'authors'), 'submodel': ('identifiers', 'evidence', 'conclusions', 'references', 'authors')}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.Change'>,)[source]
local_attributes = {'authors': <obj_tables.core.LocalAttribute object>, 'comments': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'date': <obj_tables.core.LocalAttribute object>, 'evidence': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'intention': <obj_tables.core.LocalAttribute object>, 'intention_type': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'reason': <obj_tables.core.LocalAttribute object>, 'reason_type': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>, 'target': <obj_tables.core.LocalAttribute object>, 'target_submodel': <obj_tables.core.LocalAttribute object>, 'target_type': <obj_tables.core.LocalAttribute object>, 'type': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.SlugAttribute object>[source]
related_attributes = {}[source]
unique_together = ()[source]
verbose_name = 'Change'[source]
verbose_name_plural = 'Changes'[source]
authors = <obj_tables.core.ManyToManyAttribute object>[source]
comments = <obj_tables.core.LongStringAttribute object>[source]
conclusions = <obj_tables.core.ManyToManyAttribute object>[source]
date = <obj_tables.core.DateTimeAttribute object>[source]
evidence = <wc_lang.core.EvidenceManyToManyAttribute object>[source]
id = <obj_tables.core.SlugAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
intention = <obj_tables.core.LongStringAttribute object>[source]
intention_type = <obj_tables.sci.onto.OntoTermAttribute object>[source]
model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
reason = <obj_tables.core.LongStringAttribute object>[source]
reason_type = <obj_tables.sci.onto.OntoTermAttribute object>[source]
references = <obj_tables.core.ManyToManyAttribute object>[source]
target = <obj_tables.core.LongStringAttribute object>[source]
target_submodel = <obj_tables.core.ManyToOneAttribute object>[source]
target_type = <obj_tables.sci.onto.OntoTermAttribute object>[source]
type = <obj_tables.sci.onto.OntoTermAttribute object>[source]
class wc_lang.core.ChemicalStructure(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

Structure of a chemical compound

value[source]
Type

str

format[source]

format of the structure

Type

ChemicalStructureFormat

alphabet[source]

alphabet of BpForms-encoded structure

Type

ChemicalStructureAlphabet

empirical_formula[source]

empirical formula

Type

EmpiricalFormula

molecular_weight[source]

molecular weight

Type

float

charge[source]

charge

Type

int

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('value', 'format', 'alphabet', 'empirical_formula', 'molecular_weight', 'charge')[source]
attributes = {'alphabet': <obj_tables.core.EnumAttribute object>, 'charge': <obj_tables.core.IntegerAttribute object>, 'empirical_formula': <obj_tables.chem.core.ChemicalFormulaAttribute object>, 'format': <obj_tables.core.EnumAttribute object>, 'molecular_weight': <obj_tables.core.FloatAttribute object>, 'value': <obj_tables.core.LongStringAttribute object>}[source]
child_attrs = {'sbml': ('value', 'format', 'alphabet', 'empirical_formula', 'molecular_weight', 'charge'), 'wc_sim': ('molecular_weight', 'charge')}[source]
children = {'core_model': (), 'submodel': ()}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.ChemicalStructure'>,)[source]
local_attributes = {'alphabet': <obj_tables.core.LocalAttribute object>, 'charge': <obj_tables.core.LocalAttribute object>, 'empirical_formula': <obj_tables.core.LocalAttribute object>, 'format': <obj_tables.core.LocalAttribute object>, 'molecular_weight': <obj_tables.core.LocalAttribute object>, 'species_types': <obj_tables.core.LocalAttribute object>, 'value': <obj_tables.core.LocalAttribute object>}[source]
ordering = ()[source]
primary_attribute = None[source]
related_attributes = {'species_types': <obj_tables.core.ManyToOneAttribute object>}[source]
table_format = 4[source]
unique_together = ()[source]
verbose_name = 'Chemical structure'[source]
verbose_name_plural = 'Chemical structures'[source]
alphabet = <obj_tables.core.EnumAttribute object>[source]
charge = <obj_tables.core.IntegerAttribute object>[source]
empirical_formula = <obj_tables.chem.core.ChemicalFormulaAttribute object>[source]
format = <obj_tables.core.EnumAttribute object>[source]
get_structure()[source]

Get structure

Returns

structure

Return type

openbabel.OBMol, bpforms.BpForm, or bcforms.BcForm

Raises

ValueError – if the structure cannot be parsed

has_carbon()[source]

Returns True is species contains at least one carbon atom.

Returns

True is species contains at least one carbon atom.

Return type

bool

molecular_weight = <obj_tables.core.FloatAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
serialize()[source]

Generate string representation

Returns

string representation

Return type

str

validate()[source]

Check that the structure is valid

  • Format provided when structure is not None

  • Value provided when format is not None

  • Alphabet provided for BpForms-encoded structures

  • Empirical formula, molecular weight, charge match structure (when provided)

Returns

None if the object is valid,

otherwise return a list of errors as an instance of InvalidObject

Return type

InvalidObject or None

value = <obj_tables.core.LongStringAttribute object>[source]
class wc_lang.core.ChemicalStructureAlphabet[source]

Bases: int, wc_utils.util.enumerate.CaseInsensitiveEnum

An enumeration.

canonical_dna = 4[source]
canonical_protein = 6[source]
canonical_rna = 5[source]
dna = 1[source]
protein = 3[source]
rna = 2[source]
class wc_lang.core.ChemicalStructureFormat[source]

Bases: int, wc_utils.util.enumerate.CaseInsensitiveEnum

Format of a chemical structure

bcforms = 2[source]
bpforms = 1[source]
smiles = 0[source]
class wc_lang.core.CommentAttribute(min_length=0, max_length=4294967295, none=False, default='', default_cleaned_value='', none_value='', verbose_name='', description='', primary=False, unique=False, unique_case_insensitive=False)[source]

Bases: obj_tables.core.LongStringAttribute

Comment attribute

SEPARATOR = '\n\n'[source]
merge(left, right, right_objs_in_left, left_objs_in_right)[source]

Merge an attribute of elements of two models

Parameters
  • left (Model) – an element in a model to merge

  • right (Model) – an element in a second model to merge

  • right_objs_in_left (dict) – mapping from objects in right model to objects in left model

  • left_objs_in_right (dict) – mapping from objects in left model to objects in right model

class wc_lang.core.Compartment(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

id[source]

unique identifier

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

biological_type[source]

biological type

Type

pronto.term.Term

physical_type[source]

physical type

Type

pronto.term.Term

geometry[source]

geometry

Type

pronto.term.Term

parent_compartment[source]

parent compartment

Type

Compartment

mass_units[source]

the units of the compartment mass returned when an Expression uses the compartment as a term, identified by its id

Type

unit_registry.Unit

init_volume[source]

initial volume

Type

InitVolume

init_density[source]

parameter that provides the density during the initialization of each simulation

Type

Parameter

ph[source]

pH

Type

Ph

identifiers[source]

identifiers

Type

list of Identifier

evidence[source]

observation that supports/disputes a conclusion

Type

list of Evidence

conclusions[source]

conclusions

Type

list of Conclusion

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta, obj_tables.math.expression.ExpressionDynamicTermMeta

attribute_order = ('id', 'name', 'biological_type', 'physical_type', 'geometry', 'parent_compartment', 'mass_units', 'init_volume', 'init_density', 'ph', 'identifiers', 'evidence', 'conclusions', 'comments', 'references')[source]
attributes = {'biological_type': <obj_tables.sci.onto.OntoTermAttribute object>, 'comments': <wc_lang.core.CommentAttribute object>, 'conclusions': <obj_tables.core.ManyToManyAttribute object>, 'evidence': <wc_lang.core.EvidenceManyToManyAttribute object>, 'geometry': <obj_tables.sci.onto.OntoTermAttribute object>, 'id': <obj_tables.core.SlugAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'init_density': <obj_tables.core.OneToOneAttribute object>, 'init_volume': <obj_tables.core.ManyToOneAttribute object>, 'mass_units': <obj_tables.sci.units.UnitAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'parent_compartment': <obj_tables.core.ManyToOneAttribute object>, 'ph': <obj_tables.core.ManyToOneAttribute object>, 'physical_type': <obj_tables.sci.onto.OntoTermAttribute object>, 'references': <obj_tables.core.ManyToManyAttribute object>}[source]
child_attrs = {'sbml': ('id', 'name', 'model', 'biological_type', 'physical_type', 'geometry', 'parent_compartment', 'mass_units', 'init_volume', 'init_density', 'ph', 'identifiers', 'comments'), 'wc_sim': ('id', 'model', 'mass_units', 'biological_type', 'physical_type', 'geometry', 'parent_compartment', 'init_volume', 'init_density')}[source]
children = {'core_model': ('parent_compartment', 'sub_compartments', 'init_volume', 'init_density', 'ph', 'identifiers', 'evidence', 'conclusions', 'references'), 'submodel': ('init_volume', 'init_density', 'ph', 'identifiers', 'evidence', 'conclusions', 'references')}[source]
expression_term_units = 'mass_units'[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.Compartment'>,)[source]
local_attributes = {'biological_type': <obj_tables.core.LocalAttribute object>, 'comments': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'evidence': <obj_tables.core.LocalAttribute object>, 'function_expressions': <obj_tables.core.LocalAttribute object>, 'geometry': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'init_density': <obj_tables.core.LocalAttribute object>, 'init_volume': <obj_tables.core.LocalAttribute object>, 'mass_units': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'parent_compartment': <obj_tables.core.LocalAttribute object>, 'ph': <obj_tables.core.LocalAttribute object>, 'physical_type': <obj_tables.core.LocalAttribute object>, 'rate_law_expressions': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>, 'species': <obj_tables.core.LocalAttribute object>, 'stop_condition_expressions': <obj_tables.core.LocalAttribute object>, 'sub_compartments': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.SlugAttribute object>[source]
related_attributes = {'function_expressions': <obj_tables.core.ManyToManyAttribute object>, 'rate_law_expressions': <obj_tables.core.ManyToManyAttribute object>, 'species': <obj_tables.core.ManyToOneAttribute object>, 'stop_condition_expressions': <obj_tables.core.ManyToManyAttribute object>, 'sub_compartments': <obj_tables.core.ManyToOneAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Compartment'[source]
verbose_name_plural = 'Compartments'[source]
biological_type = <obj_tables.sci.onto.OntoTermAttribute object>[source]
comments = <wc_lang.core.CommentAttribute object>[source]
conclusions = <obj_tables.core.ManyToManyAttribute object>[source]
evidence = <wc_lang.core.EvidenceManyToManyAttribute object>[source]
export_relations_to_sbml(sbml_model, sbml)[source]

Add relationships to/from object to SBML compartment.

Parameters
  • sbml_model (libsbml.Model) – SBML model

  • sbml (libsbml.Compartment) – SBML compartment

export_to_sbml(sbml_model)[source]

Add this compartment to a SBML model.

Parameters

sbml_model (libsbml.Model) – SBML model

Returns

SBML compartment

Return type

libsbml.Compartment

Raises

ValueError – if the geometry cannot be exported to SBML

geometry = <obj_tables.sci.onto.OntoTermAttribute object>[source]
get_sub_compartments(nested=False)[source]

Get sub-compartments, optionally including all nested sub-compartments

Returns

list of sub-compartments

Return type

list of Compartment

get_tot_mean_init_volume()[source]

Get total mean initial volume of a compartment and its nested sub-compartments

Returns

total mean initial volume of a compartment and its nested sub-compartments

Return type

float

id = <obj_tables.core.SlugAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
import_from_sbml(sbml)[source]

Load from SBML compartment

Parameters

sbml (libsbml.Compartment) – SBML compartment

Raises

ValueError – if the geometry cannot be imported from SBML

import_relations_from_sbml(sbml, objs)[source]

Load relationships from SBML compartment

Parameters
  • sbml (libsbml.Compartment) – SBML compartment

  • objs (dict) – dictionary that maps WC-Lang types to dictionaries that map the ids of WC-Lang objects to WC-Lang objects

init_density = <obj_tables.core.OneToOneAttribute object>[source]
init_volume = <obj_tables.core.ManyToOneAttribute object>[source]
mass_units = <obj_tables.sci.units.UnitAttribute object>[source]
model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
parent_compartment = <obj_tables.core.ManyToOneAttribute object>[source]
ph = <obj_tables.core.ManyToOneAttribute object>[source]
physical_type = <obj_tables.sci.onto.OntoTermAttribute object>[source]
references = <obj_tables.core.ManyToManyAttribute object>[source]
validate()[source]

Check that the compartment is valid

  • Check that the units of density are g l^-1

Returns

None if the object is valid,

otherwise return a list of errors as an instance of InvalidObject

Return type

InvalidObject or None

class wc_lang.core.Conclusion(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model

Conclusion of one or more observations

id[source]

unique identifier

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

value[source]

value

Type

str

std[source]

standard error of the value

Type

str

units[source]

units

Type

unit_registry.Unit

type[source]

type

Type

pronto.term.Term

process[source]

procedure which produced the conclusion

Type

Process

identifiers[source]

identifiers

Type

list of Identifier

evidence[source]

evidence that supports/refutes the conclusion (e.g. individual observations underlying an average)

Type

list of Evidence

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

authors[source]

authors

Type

list of Author

date[source]

date and time when the conclusion was made

Type

datetime.datetime

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('id', 'name', 'value', 'std', 'units', 'type', 'process', 'identifiers', 'evidence', 'comments', 'references', 'authors', 'date')[source]
attributes = {'authors': <obj_tables.core.ManyToManyAttribute object>, 'comments': <wc_lang.core.CommentAttribute object>, 'date': <obj_tables.core.DateTimeAttribute object>, 'evidence': <wc_lang.core.EvidenceManyToManyAttribute object>, 'id': <obj_tables.core.SlugAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'process': <obj_tables.core.ManyToOneAttribute object>, 'references': <obj_tables.core.ManyToManyAttribute object>, 'std': <obj_tables.core.StringAttribute object>, 'type': <obj_tables.sci.onto.OntoTermAttribute object>, 'units': <obj_tables.sci.units.UnitAttribute object>, 'value': <obj_tables.core.StringAttribute object>}[source]
child_attrs = {'sbml': (), 'wc_sim': ()}[source]
children = {'core_model': ('process', 'identifiers', 'evidence', 'references', 'authors'), 'submodel': ('process', 'identifiers', 'evidence', 'references', 'authors')}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.Conclusion'>,)[source]
local_attributes = {'authors': <obj_tables.core.LocalAttribute object>, 'changes': <obj_tables.core.LocalAttribute object>, 'comments': <obj_tables.core.LocalAttribute object>, 'compartments': <obj_tables.core.LocalAttribute object>, 'date': <obj_tables.core.LocalAttribute object>, 'dfba_obj_reactions': <obj_tables.core.LocalAttribute object>, 'dfba_obj_species': <obj_tables.core.LocalAttribute object>, 'dfba_objs': <obj_tables.core.LocalAttribute object>, 'distribution_init_concentrations': <obj_tables.core.LocalAttribute object>, 'evidence': <obj_tables.core.LocalAttribute object>, 'functions': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'observables': <obj_tables.core.LocalAttribute object>, 'parameters': <obj_tables.core.LocalAttribute object>, 'process': <obj_tables.core.LocalAttribute object>, 'rate_laws': <obj_tables.core.LocalAttribute object>, 'reactions': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>, 'species': <obj_tables.core.LocalAttribute object>, 'species_types': <obj_tables.core.LocalAttribute object>, 'std': <obj_tables.core.LocalAttribute object>, 'stop_conditions': <obj_tables.core.LocalAttribute object>, 'submodels': <obj_tables.core.LocalAttribute object>, 'type': <obj_tables.core.LocalAttribute object>, 'units': <obj_tables.core.LocalAttribute object>, 'value': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.SlugAttribute object>[source]
related_attributes = {'changes': <obj_tables.core.ManyToManyAttribute object>, 'compartments': <obj_tables.core.ManyToManyAttribute object>, 'dfba_obj_reactions': <obj_tables.core.ManyToManyAttribute object>, 'dfba_obj_species': <obj_tables.core.ManyToManyAttribute object>, 'dfba_objs': <obj_tables.core.ManyToManyAttribute object>, 'distribution_init_concentrations': <obj_tables.core.ManyToManyAttribute object>, 'functions': <obj_tables.core.ManyToManyAttribute object>, 'observables': <obj_tables.core.ManyToManyAttribute object>, 'parameters': <obj_tables.core.ManyToManyAttribute object>, 'rate_laws': <obj_tables.core.ManyToManyAttribute object>, 'reactions': <obj_tables.core.ManyToManyAttribute object>, 'species': <obj_tables.core.ManyToManyAttribute object>, 'species_types': <obj_tables.core.ManyToManyAttribute object>, 'stop_conditions': <obj_tables.core.ManyToManyAttribute object>, 'submodels': <obj_tables.core.ManyToManyAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Conclusion'[source]
verbose_name_plural = 'Conclusions'[source]
authors = <obj_tables.core.ManyToManyAttribute object>[source]
comments = <wc_lang.core.CommentAttribute object>[source]
date = <obj_tables.core.DateTimeAttribute object>[source]
evidence = <wc_lang.core.EvidenceManyToManyAttribute object>[source]
id = <obj_tables.core.SlugAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
process = <obj_tables.core.ManyToOneAttribute object>[source]
references = <obj_tables.core.ManyToManyAttribute object>[source]
std = <obj_tables.core.StringAttribute object>[source]
type = <obj_tables.sci.onto.OntoTermAttribute object>[source]
units = <obj_tables.sci.units.UnitAttribute object>[source]
value = <obj_tables.core.StringAttribute object>[source]
class wc_lang.core.DfbaObjReaction(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

A pseudo-reaction used to represent the interface between metabolism and other cell processes.

id[source]

unique identifier

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

submodel[source]

submodel that uses this reaction

Type

Submodel

units[source]

rate units

Type

unit_registry.Unit

cell_size_units[source]

cell size units

Type

unit_registry.Unit

identifiers[source]

identifiers

Type

list of Identifier

evidence[source]

observation that supports/disputes a conclusion

Type

list of Evidence

conclusions[source]

conclusions

Type

list of Conclusion

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta, obj_tables.math.expression.ExpressionDynamicTermMeta

attribute_order = ('id', 'name', 'submodel', 'units', 'cell_size_units', 'identifiers', 'evidence', 'conclusions', 'comments', 'references')[source]
attributes = {'cell_size_units': <obj_tables.sci.units.UnitAttribute object>, 'comments': <wc_lang.core.CommentAttribute object>, 'conclusions': <obj_tables.core.ManyToManyAttribute object>, 'evidence': <wc_lang.core.EvidenceManyToManyAttribute object>, 'id': <obj_tables.core.SlugAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'references': <obj_tables.core.ManyToManyAttribute object>, 'submodel': <obj_tables.core.ManyToOneAttribute object>, 'units': <obj_tables.sci.units.UnitAttribute object>}[source]
child_attrs = {'sbml': ('id', 'name', 'model', 'submodel', 'units', 'cell_size_units', 'identifiers', 'comments'), 'wc_sim': ('id', 'model', 'submodel', 'units', 'cell_size_units')}[source]
children = {'core_model': ('dfba_obj_species', 'identifiers', 'evidence', 'conclusions', 'references'), 'submodel': ('dfba_obj_species', 'identifiers', 'evidence', 'conclusions', 'references')}[source]
expression_term_units = 'units'[source]
indexed_attrs_tuples = (('id',),)[source]
inheritance = (<class 'wc_lang.core.DfbaObjReaction'>,)[source]
local_attributes = {'cell_size_units': <obj_tables.core.LocalAttribute object>, 'comments': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'dfba_obj_expression': <obj_tables.core.LocalAttribute object>, 'dfba_obj_species': <obj_tables.core.LocalAttribute object>, 'evidence': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>, 'submodel': <obj_tables.core.LocalAttribute object>, 'units': <obj_tables.core.LocalAttribute object>}[source]
merge = 2[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.SlugAttribute object>[source]
related_attributes = {'dfba_obj_expression': <obj_tables.core.OneToManyAttribute object>, 'dfba_obj_species': <obj_tables.core.ManyToOneAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'dFBA objective reaction'[source]
verbose_name_plural = 'dFBA objective reactions'[source]
cell_size_units = <obj_tables.sci.units.UnitAttribute object>[source]
comments = <wc_lang.core.CommentAttribute object>[source]
conclusions = <obj_tables.core.ManyToManyAttribute object>[source]
evidence = <wc_lang.core.EvidenceManyToManyAttribute object>[source]
export_relations_to_sbml(sbml_model, sbml_rxn)[source]

Add relationships to/from object to SBML reaction.

Parameters
  • sbml_model (libsbml.Model) – SBML model

  • sbml_rxn (libsbml.Reaction) – SBML reaction

export_to_sbml(sbml_model)[source]

Add a dFBA objective reaction to a SBML model.

DfbaObjReactions are added to the SBML model because they can be used in a dFBA submodel’s objective function. In fact the default objective function is the submodel’s dFBA objective reaction. Since SBML does not define DfbaObjReaction as a separate class, DfbaObjReactions are added to the SBML model as SBML reactions. CheckModel ensures that wc_lang DfbaObjReactions and Reactions have distinct ids.

Parameters

sbml_model (libsbml.Model) – SBML model

Returns

SBML reaction

Return type

libsbml.Reaction

id = <obj_tables.core.SlugAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
import_from_sbml(sbml_rxn)[source]

Load from SBML reaction

Parameters

sbml (libsbml.Reaction) – SBML reaction

import_relations_from_sbml(sbml_rxn, objs)[source]

Load relationships from SBML reaction

Parameters
  • sbml (libsbml.Reaction) – SBML reaction

  • objs (dict) – dictionary that maps WC-Lang types to dictionaries that map the ids of WC-Lang objects to WC-Lang objects

model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
references = <obj_tables.core.ManyToManyAttribute object>[source]
submodel = <obj_tables.core.ManyToOneAttribute object>[source]
units = <obj_tables.sci.units.UnitAttribute object>[source]
class wc_lang.core.DfbaObjSpecies(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

A dFBA objective reaction contains a list of DfbaObjSpecies instances. Distinct DfbaObjSpecies enable separate comments and references for each one.

id[source]

unique identifier per DfbaObjSpecies equal to dfba-net-species-{dfba_obj_reaction.id}-{species.id}

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

dfba_obj_reaction[source]

the dFBA objective reaction that uses the dFBA objective species

Type

DfbaObjReaction

species[source]

species

Type

Species

value[source]

the specie’s reaction coefficient

Type

float

units[source]

units of the value

Type

unit_registry.Unit

identifiers[source]

identifiers

Type

list of Identifier

evidence[source]

observation that supports/disputes a conclusion

Type

list of Evidence

conclusions[source]

conclusions

Type

list of Conclusion

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('id', 'name', 'dfba_obj_reaction', 'species', 'value', 'units', 'identifiers', 'evidence', 'conclusions', 'comments', 'references')[source]
attributes = {'comments': <wc_lang.core.CommentAttribute object>, 'conclusions': <obj_tables.core.ManyToManyAttribute object>, 'dfba_obj_reaction': <obj_tables.core.ManyToOneAttribute object>, 'evidence': <wc_lang.core.EvidenceManyToManyAttribute object>, 'id': <obj_tables.core.StringAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'references': <obj_tables.core.ManyToManyAttribute object>, 'species': <obj_tables.core.ManyToOneAttribute object>, 'units': <obj_tables.sci.units.UnitAttribute object>, 'value': <obj_tables.core.FloatAttribute object>}[source]
child_attrs = {'sbml': ('id', 'name', 'model', 'dfba_obj_reaction', 'species', 'value', 'units', 'identifiers', 'comments'), 'wc_sim': ('id', 'model', 'dfba_obj_reaction', 'species', 'value', 'units')}[source]
children = {'core_model': ('dfba_obj_reaction', 'species', 'identifiers', 'evidence', 'conclusions', 'references'), 'submodel': ('dfba_obj_reaction', 'species', 'identifiers', 'evidence', 'conclusions', 'references')}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.DfbaObjSpecies'>,)[source]
local_attributes = {'comments': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'dfba_obj_reaction': <obj_tables.core.LocalAttribute object>, 'evidence': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>, 'species': <obj_tables.core.LocalAttribute object>, 'units': <obj_tables.core.LocalAttribute object>, 'value': <obj_tables.core.LocalAttribute object>}[source]
merge = 2[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.StringAttribute object>[source]
related_attributes = {}[source]
unique_together = ()[source]
verbose_name = 'dFBA objective species'[source]
verbose_name_plural = 'dFBA objective species'[source]
comments = <wc_lang.core.CommentAttribute object>[source]
conclusions = <obj_tables.core.ManyToManyAttribute object>[source]
dfba_obj_reaction = <obj_tables.core.ManyToOneAttribute object>[source]
evidence = <wc_lang.core.EvidenceManyToManyAttribute object>[source]
gen_id()[source]

Generate identifier equal to dfba-net-species-{dfba_obj_reaction.id}-{species.id}

Returns

identifier

Return type

str

id = <obj_tables.core.StringAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
references = <obj_tables.core.ManyToManyAttribute object>[source]
species = <obj_tables.core.ManyToOneAttribute object>[source]
units = <obj_tables.sci.units.UnitAttribute object>[source]
validate()[source]

Validate that the dFBA objective is valid

  • Check if the identifier is equal to dfba-net-species-{dfba_obj_reaction.id}-{species.id}

  • Units consistent with units of cell size

Returns

None if the object is valid,

otherwise return a list of errors as an instance of InvalidObject

Return type

InvalidObject or None

value = <obj_tables.core.FloatAttribute object>[source]
class wc_lang.core.DfbaObjective(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

dFBA objective function

id[source]

identifier equal to dfba-obj-{submodel.id}

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

submodel[source]

the Submodel which uses this DfbaObjective

Type

Submodel

expression[source]

mathematical expression of the objective function

Type

DfbaObjectiveExpression

units[source]

units

Type

unit_registry.Unit

reaction_rate_units[source]

reaction rate units

Type

unit_registry.Unit

coefficient_units[source]

coefficient units

Type

unit_registry.Unit

identifiers[source]

identifiers

Type

list of Identifier

evidence[source]

observation that supports/disputes a conclusion

Type

list of Evidence

conclusions[source]

conclusions

Type

list of Conclusion

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

class Meta[source]

Bases: obj_tables.core.Meta, obj_tables.math.expression.ExpressionExpressionTermMeta

attribute_order = ('id', 'name', 'submodel', 'expression', 'units', 'reaction_rate_units', 'coefficient_units', 'identifiers', 'evidence', 'conclusions', 'comments', 'references')[source]
attributes = {'coefficient_units': <obj_tables.sci.units.UnitAttribute object>, 'comments': <wc_lang.core.CommentAttribute object>, 'conclusions': <obj_tables.core.ManyToManyAttribute object>, 'evidence': <wc_lang.core.EvidenceManyToManyAttribute object>, 'expression': <obj_tables.math.expression.OneToOneExpressionAttribute object>, 'id': <obj_tables.core.StringAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'reaction_rate_units': <obj_tables.sci.units.UnitAttribute object>, 'references': <obj_tables.core.ManyToManyAttribute object>, 'submodel': <obj_tables.core.OneToOneAttribute object>, 'units': <obj_tables.sci.units.UnitAttribute object>}[source]
child_attrs = {'sbml': ('id', 'name', 'model', 'submodel', 'expression', 'units', 'reaction_rate_units', 'coefficient_units', 'identifiers', 'comments'), 'wc_sim': ('id', 'model', 'submodel', 'expression', 'units', 'reaction_rate_units', 'coefficient_units')}[source]
children = {'core_model': ('expression', 'identifiers', 'evidence', 'conclusions', 'references'), 'submodel': ('expression', 'identifiers', 'evidence', 'conclusions', 'references')}[source]
expression_term_model[source]

alias of DfbaObjectiveExpression

expression_term_units = 'units'[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.DfbaObjective'>,)[source]
local_attributes = {'coefficient_units': <obj_tables.core.LocalAttribute object>, 'comments': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'evidence': <obj_tables.core.LocalAttribute object>, 'expression': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'reaction_rate_units': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>, 'submodel': <obj_tables.core.LocalAttribute object>, 'units': <obj_tables.core.LocalAttribute object>}[source]
merge = 2[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.StringAttribute object>[source]
related_attributes = {}[source]
unique_together = ()[source]
verbose_name = 'dFBA objective'[source]
verbose_name_plural = 'dFBA objectives'[source]
coefficient_units = <obj_tables.sci.units.UnitAttribute object>[source]
comments = <wc_lang.core.CommentAttribute object>[source]
conclusions = <obj_tables.core.ManyToManyAttribute object>[source]
evidence = <wc_lang.core.EvidenceManyToManyAttribute object>[source]
export_relations_to_sbml(sbml_model, sbml)[source]

Add relationships to/from object to SBML objective.

Parameters
  • sbml_model (libsbml.Model) – SBML model

  • sbml (libsbml.Objective) – SBML objective

export_to_sbml(sbml_model)[source]

Add this dFBA objective to a SBML model.

This uses version 2 of the ‘Flux Balance Constraints’ extension. SBML assumes that an DfbaObjective is a linear combination of reaction fluxes.

Parameters

sbml_model (libsbml.Model) – SBML model

Returns

SBML objective

Return type

libsbml.Objective

expression = <obj_tables.math.expression.OneToOneExpressionAttribute object>[source]
gen_id()[source]

Generate identifier

Returns

identifier

Return type

str

get_products(_DfbaObjective__type=None, **kwargs)[source]

Get the species produced by this objective function

Parameters
  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs to find matching objects

Returns

species produced by this objective function

Return type

list of Species

id = <obj_tables.core.StringAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
import_from_sbml(sbml)[source]

Load from SBML objective

Parameters

sbml (libsbml.Objective) – SBML objective

import_relations_from_sbml(sbml, objs)[source]

Load relationships from SBML objective

Parameters
  • sbml (libsbml.Objective) – SBML objective

  • objs (dict) – dictionary that maps WC-Lang types to dictionaries that map the ids of WC-Lang objects to WC-Lang objects

model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
reaction_rate_units = <obj_tables.sci.units.UnitAttribute object>[source]
references = <obj_tables.core.ManyToManyAttribute object>[source]
submodel = <obj_tables.core.OneToOneAttribute object>[source]
units = <obj_tables.sci.units.UnitAttribute object>[source]
validate()[source]

Validate that the dFBA objective is valid

  • Check if the identifier is equal to dfba-obj-{submodel.id}]

Returns

None if the object is valid,

otherwise return a list of errors as an instance of InvalidObject

Return type

InvalidObject or None

class wc_lang.core.DfbaObjectiveExpression(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, obj_tables.math.expression.Expression, wc_lang.sbml.util.SbmlModelMixin

A mathematical expression of Reactions and DfbaObjReactions

The expression used by a DfbaObjective.

expression[source]

mathematical expression

Type

str

_parsed_expression[source]

an analyzed expression; not an obj_tables.Model

Type

ParsedExpression

reactions[source]

reactions used by this expression

Type

list of Reaction

dfba_obj_reactions[source]

dFBA objective reactions used by this expression

Type

list of DfbaObjReaction

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta, obj_tables.math.expression.Meta

attribute_order = ()[source]
attributes = {'dfba_obj_reactions': <obj_tables.core.OneToManyAttribute object>, 'expression': <obj_tables.core.LongStringAttribute object>, 'reactions': <obj_tables.core.OneToManyAttribute object>}[source]
child_attrs = {'sbml': ('expression', 'reactions', 'dfba_obj_reactions'), 'wc_sim': ('expression', 'reactions', 'dfba_obj_reactions')}[source]
children = {'core_model': ('reactions', 'dfba_obj_reactions'), 'submodel': ('reactions', 'dfba_obj_reactions')}[source]
expression_term_models = ('Reaction', 'DfbaObjReaction')[source]
expression_unit_registry = <pint.registry.UnitRegistry object>[source]
expression_valid_functions = ()[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.DfbaObjectiveExpression'>,)[source]
local_attributes = {'dfba_obj': <obj_tables.core.LocalAttribute object>, 'dfba_obj_reactions': <obj_tables.core.LocalAttribute object>, 'expression': <obj_tables.core.LocalAttribute object>, 'reactions': <obj_tables.core.LocalAttribute object>}[source]
merge = 2[source]
ordering = ('expression',)[source]
primary_attribute = <obj_tables.core.LongStringAttribute object>[source]
related_attributes = {'dfba_obj': <obj_tables.math.expression.OneToOneExpressionAttribute object>}[source]
table_format = 3[source]
unique_together = ()[source]
verbose_name = 'dFBA objective expression'[source]
verbose_name_plural = 'dFBA objective expressions'[source]
classmethod deserialize(value, objects)[source]

Deserialize value

Parameters
  • value (str) – String representation

  • objects (dict) – dictionary of objects, grouped by model

Returns

tuple

of cleaned value and cleaning error

Return type

tuple of DfbaObjectiveExpression, InvalidAttribute or None

dfba_obj_reactions = <obj_tables.core.OneToManyAttribute object>[source]
expression = <obj_tables.core.LongStringAttribute object>[source]
merge_attrs(other, other_objs_in_self, self_objs_in_other)[source]

Merge attributes of two objects

Parameters
  • other (obj_tables.Model) – other model

  • other_objs_in_self (dict) – dictionary that maps instances of objects in another model to objects in a model

  • self_objs_in_other (dict) – dictionary that maps instances of objects in a model to objects in another model

objects = <obj_tables.core.Manager object>[source]
reactions = <obj_tables.core.OneToManyAttribute object>[source]
serialize()[source]

Generate string representation

Returns

string representation

Return type

str

validate()[source]

Determine if the dFBA objective expression is valid

  • Check that the expression is a linear function

  • Check if expression is a function of at least one reaction or dFBA objective reaction

  • Check that the reactions and dFBA objective reactions belong to the same submodel

Returns

None if the object is valid,

otherwise return a list of errors in an InvalidObject instance

Return type

InvalidObject or None

class wc_lang.core.DistributionInitConcentration(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

Distribution of the initial concentration of a species at the beginning of each cell cycle

id[source]

identifier equal to dist-init-conc-{species.id}

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

species[source]

species

Type

Species

distribution[source]

distribution

Type

pronto.term.Term

mean[source]

mean concentration in a population of single cells at the beginning of each cell cycle

Type

float

std[source]

standard deviation of the concentration in a population of single cells at the beginning of each cell cycle

Type

float

units[source]

units; default units is M

Type

unit_registry.Unit

identifiers[source]

identifiers

Type

list of Identifier

evidence[source]

observation that supports/disputes a conclusion

Type

list of Evidence

conclusions[source]

conclusions

Type

list of Conclusion

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('id', 'name', 'species', 'distribution', 'mean', 'std', 'units', 'identifiers', 'evidence', 'conclusions', 'comments', 'references')[source]
attributes = {'comments': <wc_lang.core.CommentAttribute object>, 'conclusions': <obj_tables.core.ManyToManyAttribute object>, 'distribution': <obj_tables.sci.onto.OntoTermAttribute object>, 'evidence': <wc_lang.core.EvidenceManyToManyAttribute object>, 'id': <obj_tables.core.StringAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'mean': <obj_tables.core.FloatAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'references': <obj_tables.core.ManyToManyAttribute object>, 'species': <obj_tables.core.OneToOneAttribute object>, 'std': <obj_tables.core.FloatAttribute object>, 'units': <obj_tables.sci.units.UnitAttribute object>}[source]
child_attrs = {'sbml': ('id', 'name', 'model', 'species', 'distribution', 'mean', 'std', 'units', 'identifiers', 'comments'), 'wc_sim': ('id', 'model', 'species', 'distribution', 'mean', 'std', 'units')}[source]
children = {'core_model': ('species', 'identifiers', 'evidence', 'conclusions', 'references'), 'submodel': ('identifiers', 'evidence', 'conclusions', 'references')}[source]
frozen_columns = 1[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.DistributionInitConcentration'>,)[source]
local_attributes = {'comments': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'distribution': <obj_tables.core.LocalAttribute object>, 'evidence': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'mean': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>, 'species': <obj_tables.core.LocalAttribute object>, 'std': <obj_tables.core.LocalAttribute object>, 'units': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.StringAttribute object>[source]
related_attributes = {}[source]
unique_together = ()[source]
verbose_name = 'Init species concentration'[source]
verbose_name_plural = 'Init species concentrations'[source]
comments = <wc_lang.core.CommentAttribute object>[source]
conclusions = <obj_tables.core.ManyToManyAttribute object>[source]
distribution = <obj_tables.sci.onto.OntoTermAttribute object>[source]
evidence = <wc_lang.core.EvidenceManyToManyAttribute object>[source]
gen_id()[source]

Generate string representation

Returns

string representation

Return type

str

id = <obj_tables.core.StringAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
mean = <obj_tables.core.FloatAttribute object>[source]
model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
references = <obj_tables.core.ManyToManyAttribute object>[source]
species = <obj_tables.core.OneToOneAttribute object>[source]
std = <obj_tables.core.FloatAttribute object>[source]
units = <obj_tables.sci.units.UnitAttribute object>[source]
validate()[source]

Check that the distribution of initial concentrations at the beginning of each cell cycle is valid

  • Validate that identifier is equal to dist-init-conc-{species.id}]

Returns

None if the object is valid,

otherwise return a list of errors as an instance of InvalidObject

Return type

InvalidObject or None

class wc_lang.core.Environment(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

id[source]

unique identifier equal to ‘env’

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

temp[source]

temperature

Type

float

temp_units[source]

temperature units

Type

unit_registry.Unit

identifiers[source]

identifiers

Type

list of Identifier

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('id', 'name', 'temp', 'temp_units', 'identifiers', 'comments', 'references')[source]
attributes = {'comments': <wc_lang.core.CommentAttribute object>, 'id': <obj_tables.core.RegexAttribute object>, 'identifiers': <wc_lang.core.IdentifierOneToManyAttribute object>, 'model': <obj_tables.core.OneToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'references': <obj_tables.core.OneToManyAttribute object>, 'temp': <obj_tables.core.FloatAttribute object>, 'temp_units': <obj_tables.sci.units.UnitAttribute object>}[source]
child_attrs = {'sbml': ('id', 'name', 'model', 'temp', 'temp_units', 'identifiers', 'comments'), 'wc_sim': ()}[source]
children = {'core_model': ('identifiers', 'references'), 'submodel': ('identifiers', 'references')}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.Environment'>,)[source]
local_attributes = {'comments': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>, 'temp': <obj_tables.core.LocalAttribute object>, 'temp_units': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.RegexAttribute object>[source]
related_attributes = {}[source]
table_format = 2[source]
unique_together = ()[source]
verbose_name = 'Environment'[source]
verbose_name_plural = 'Environments'[source]
comments = <wc_lang.core.CommentAttribute object>[source]
id = <obj_tables.core.RegexAttribute object>[source]
identifiers = <wc_lang.core.IdentifierOneToManyAttribute object>[source]
model = <obj_tables.core.OneToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
references = <obj_tables.core.OneToManyAttribute object>[source]
temp = <obj_tables.core.FloatAttribute object>[source]
temp_units = <obj_tables.sci.units.UnitAttribute object>[source]
class wc_lang.core.Evidence(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model

Observation that supports/disputes a conclusion

observation[source]

observation which supports the conclusion

Type

Observation

type[source]

how the observation supports the conclusion (e.g. supporting, inconclusive, disputing)

Type

pronto.Term

strength (

obj:`float): how much the observation supports the conclusion

quality[source]

the reliability of the observation

Type

float

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('observation', 'type', 'strength', 'quality')[source]
attributes = {'observation': <obj_tables.core.ManyToOneAttribute object>, 'quality': <obj_tables.core.FloatAttribute object>, 'strength': <obj_tables.core.FloatAttribute object>, 'type': <obj_tables.sci.onto.OntoTermAttribute object>}[source]
child_attrs = {'sbml': (), 'wc_sim': ()}[source]
children = {'core_model': ('observation',), 'submodel': ('observation',)}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.Evidence'>,)[source]
local_attributes = {'changes': <obj_tables.core.LocalAttribute object>, 'compartments': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'dfba_obj_reactions': <obj_tables.core.LocalAttribute object>, 'dfba_obj_species': <obj_tables.core.LocalAttribute object>, 'dfba_objs': <obj_tables.core.LocalAttribute object>, 'distribution_init_concentrations': <obj_tables.core.LocalAttribute object>, 'functions': <obj_tables.core.LocalAttribute object>, 'observables': <obj_tables.core.LocalAttribute object>, 'observation': <obj_tables.core.LocalAttribute object>, 'parameters': <obj_tables.core.LocalAttribute object>, 'quality': <obj_tables.core.LocalAttribute object>, 'rate_laws': <obj_tables.core.LocalAttribute object>, 'reactions': <obj_tables.core.LocalAttribute object>, 'species': <obj_tables.core.LocalAttribute object>, 'species_types': <obj_tables.core.LocalAttribute object>, 'stop_conditions': <obj_tables.core.LocalAttribute object>, 'strength': <obj_tables.core.LocalAttribute object>, 'submodels': <obj_tables.core.LocalAttribute object>, 'type': <obj_tables.core.LocalAttribute object>}[source]
ordering = ()[source]
primary_attribute = None[source]
related_attributes = {'changes': <wc_lang.core.EvidenceManyToManyAttribute object>, 'compartments': <wc_lang.core.EvidenceManyToManyAttribute object>, 'conclusions': <wc_lang.core.EvidenceManyToManyAttribute object>, 'dfba_obj_reactions': <wc_lang.core.EvidenceManyToManyAttribute object>, 'dfba_obj_species': <wc_lang.core.EvidenceManyToManyAttribute object>, 'dfba_objs': <wc_lang.core.EvidenceManyToManyAttribute object>, 'distribution_init_concentrations': <wc_lang.core.EvidenceManyToManyAttribute object>, 'functions': <wc_lang.core.EvidenceManyToManyAttribute object>, 'observables': <wc_lang.core.EvidenceManyToManyAttribute object>, 'parameters': <wc_lang.core.EvidenceManyToManyAttribute object>, 'rate_laws': <wc_lang.core.EvidenceManyToManyAttribute object>, 'reactions': <wc_lang.core.EvidenceManyToManyAttribute object>, 'species': <wc_lang.core.EvidenceManyToManyAttribute object>, 'species_types': <wc_lang.core.EvidenceManyToManyAttribute object>, 'stop_conditions': <wc_lang.core.EvidenceManyToManyAttribute object>, 'submodels': <wc_lang.core.EvidenceManyToManyAttribute object>}[source]
table_format = 3[source]
unique_together = ()[source]
verbose_name = 'Evidence'[source]
verbose_name_plural = 'Evidences'[source]
objects = <obj_tables.core.Manager object>[source]
observation = <obj_tables.core.ManyToOneAttribute object>[source]
quality = <obj_tables.core.FloatAttribute object>[source]
serialize()[source]

Generate string representation

Returns

string representation

Return type

str

strength = <obj_tables.core.FloatAttribute object>[source]
type = <obj_tables.sci.onto.OntoTermAttribute object>[source]
class wc_lang.core.EvidenceManyToManyAttribute(related_class, grammar=None, **kwargs)[source]

Bases: obj_tables.grammar.ToManyGrammarAttribute, obj_tables.core.ManyToManyAttribute

Many to many attribute for evidence

class Transformer(objects)[source]

Bases: obj_tables.grammar.ToManyGrammarTransformer

Transforms parse trees into a list of instances of core.Model

evidence(*args)[source]
get_xlsx_validation(sheet_models=None, doc_metadata_model=None)[source]

Get Excel validation

Parameters
  • sheet_models (list of Model, optional) – models encoded as separate sheets

  • doc_metadata_model (type) – model whose worksheet contains the document metadata

Returns

validation

Return type

wc_utils.workbook.io.FieldValidation

grammar_path = '/root/project/wc_lang/grammar/evidences.lark'[source]
serialize(evidence, encoded=None)[source]

Serialize related object

Parameters
  • evidence (list of Evidence) – Python representation of evidence

  • encoded (dict, optional) – dictionary of objects that have already been encoded

Returns

simple Python representation

Return type

str

class wc_lang.core.FluxBounds(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

Flux bounds for reactions modeled by dFBA submodels

min[source]

minimum flux bound for solving an FBA model; negative for reversible reactions

Type

float

max[source]

maximum flux bound for solving an FBA model

Type

float

units[source]

units for the minimum and maximum fluxes

Type

unit_registry.Unit

Related attributes:

  • reactions (list of Reaction): reactions

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('min', 'max', 'units')[source]
attributes = {'max': <obj_tables.core.FloatAttribute object>, 'min': <obj_tables.core.FloatAttribute object>, 'units': <obj_tables.sci.units.UnitAttribute object>}[source]
child_attrs = {'sbml': ('min', 'max', 'units'), 'wc_sim': ('min', 'max', 'units')}[source]
children = {'core_model': (), 'submodel': ()}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.FluxBounds'>,)[source]
local_attributes = {'max': <obj_tables.core.LocalAttribute object>, 'min': <obj_tables.core.LocalAttribute object>, 'reactions': <obj_tables.core.LocalAttribute object>, 'units': <obj_tables.core.LocalAttribute object>}[source]
ordering = ()[source]
primary_attribute = None[source]
related_attributes = {'reactions': <obj_tables.core.ManyToOneAttribute object>}[source]
table_format = 4[source]
unique_together = ()[source]
verbose_name = 'Flux bounds'[source]
verbose_name_plural = 'Flux boundss'[source]
max = <obj_tables.core.FloatAttribute object>[source]
min = <obj_tables.core.FloatAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
serialize()[source]

Generate string representation

Returns

string representation

Return type

str

units = <obj_tables.sci.units.UnitAttribute object>[source]
class wc_lang.core.Function(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlAssignmentRuleMixin

Function: a mathematical expression of Functions, Observbles, Parameters and Python functions

id[source]

unique id

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

expression[source]

mathematical expression for a Function

Type

FunctionExpression

units[source]

units

Type

unit_registry.Unit

identifiers[source]

identifiers

Type

list of Identifier

evidence[source]

observation that supports/disputes a conclusion

Type

list of Evidence

conclusions[source]

conclusions

Type

list of Conclusion

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta, obj_tables.math.expression.ExpressionExpressionTermMeta

attribute_order = ('id', 'name', 'expression', 'units', 'identifiers', 'evidence', 'conclusions', 'comments', 'references')[source]
attributes = {'comments': <wc_lang.core.CommentAttribute object>, 'conclusions': <obj_tables.core.ManyToManyAttribute object>, 'evidence': <wc_lang.core.EvidenceManyToManyAttribute object>, 'expression': <obj_tables.math.expression.OneToOneExpressionAttribute object>, 'id': <obj_tables.core.SlugAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'references': <obj_tables.core.ManyToManyAttribute object>, 'units': <obj_tables.sci.units.UnitAttribute object>}[source]
child_attrs = {'sbml': ('id', 'name', 'model', 'expression', 'units', 'identifiers', 'comments'), 'wc_sim': ('id', 'model', 'expression', 'units')}[source]
children = {'core_model': ('expression', 'identifiers', 'evidence', 'conclusions', 'references'), 'submodel': ('expression', 'identifiers', 'evidence', 'conclusions', 'references')}[source]
expression_term_model[source]

alias of FunctionExpression

expression_term_units = 'units'[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.Function'>,)[source]
local_attributes = {'comments': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'evidence': <obj_tables.core.LocalAttribute object>, 'expression': <obj_tables.core.LocalAttribute object>, 'function_expressions': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'rate_law_expressions': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>, 'stop_condition_expressions': <obj_tables.core.LocalAttribute object>, 'units': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.SlugAttribute object>[source]
related_attributes = {'function_expressions': <obj_tables.core.ManyToManyAttribute object>, 'rate_law_expressions': <obj_tables.core.ManyToManyAttribute object>, 'stop_condition_expressions': <obj_tables.core.ManyToManyAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Function'[source]
verbose_name_plural = 'Functions'[source]
comments = <wc_lang.core.CommentAttribute object>[source]
conclusions = <obj_tables.core.ManyToManyAttribute object>[source]
evidence = <wc_lang.core.EvidenceManyToManyAttribute object>[source]
expression = <obj_tables.math.expression.OneToOneExpressionAttribute object>[source]
id = <obj_tables.core.SlugAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
references = <obj_tables.core.ManyToManyAttribute object>[source]
units = <obj_tables.sci.units.UnitAttribute object>[source]
validate()[source]

Check that the Function is valid

  • Check that expression has units units

Returns

None if the object is valid,

otherwise return a list of errors as an instance of InvalidObject

Return type

InvalidObject or None

class wc_lang.core.FunctionExpression(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, obj_tables.math.expression.Expression, wc_lang.sbml.util.SbmlModelMixin

A mathematical expression of Functions, Observbles, Parameters and Python functions

The expression used by a Function.

expression[source]

mathematical expression for a Function

Type

str

_parsed_expression[source]

an analyzed expression; not an obj_tables.Model

Type

ParsedExpression

species[source]

Species used by this function expression

Type

list of Species

observables[source]

Observables used by this function expression

Type

list of Observable

parameters[source]

Parameters used by this function expression

Type

list of Parameter

functions[source]

other Functions used by this function expression

Type

list of Function

compartments[source]

Compartments used by this function expression

Type

list of Compartment

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta, obj_tables.math.expression.Meta

attribute_order = ()[source]
attributes = {'compartments': <obj_tables.core.ManyToManyAttribute object>, 'expression': <obj_tables.core.LongStringAttribute object>, 'functions': <obj_tables.core.ManyToManyAttribute object>, 'observables': <obj_tables.core.ManyToManyAttribute object>, 'parameters': <obj_tables.core.ManyToManyAttribute object>, 'species': <obj_tables.core.ManyToManyAttribute object>}[source]
child_attrs = {'sbml': ('expression', 'parameters', 'species', 'observables', 'functions', 'compartments'), 'wc_sim': ('expression', 'parameters', 'species', 'observables', 'functions', 'compartments')}[source]
children = {'core_model': ('parameters', 'species', 'observables', 'functions', 'compartments'), 'submodel': ('parameters', 'species', 'observables', 'functions', 'compartments')}[source]
expression_term_models = ('Parameter', 'Species', 'Observable', 'Function', 'Compartment')[source]
expression_unit_registry = <pint.registry.UnitRegistry object>[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.FunctionExpression'>,)[source]
local_attributes = {'compartments': <obj_tables.core.LocalAttribute object>, 'expression': <obj_tables.core.LocalAttribute object>, 'function': <obj_tables.core.LocalAttribute object>, 'functions': <obj_tables.core.LocalAttribute object>, 'observables': <obj_tables.core.LocalAttribute object>, 'parameters': <obj_tables.core.LocalAttribute object>, 'species': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('expression',)[source]
primary_attribute = <obj_tables.core.LongStringAttribute object>[source]
related_attributes = {'function': <obj_tables.math.expression.OneToOneExpressionAttribute object>}[source]
table_format = 3[source]
unique_together = ()[source]
verbose_name = 'Function expression'[source]
verbose_name_plural = 'Function expressions'[source]
compartments = <obj_tables.core.ManyToManyAttribute object>[source]
classmethod deserialize(value, objects)[source]

Deserialize value

Parameters
  • value (str) – String representation

  • objects (dict) – dictionary of objects, grouped by model

Returns

tuple of cleaned value

and cleaning error

Return type

tuple of FunctionExpression, InvalidAttribute or None

expression = <obj_tables.core.LongStringAttribute object>[source]
functions = <obj_tables.core.ManyToManyAttribute object>[source]
merge_attrs(other, other_objs_in_self, self_objs_in_other)[source]

Merge attributes of two objects

Parameters
  • other (obj_tables.Model) – other model

  • other_objs_in_self (dict) – dictionary that maps instances of objects in another model to objects in a model

  • self_objs_in_other (dict) – dictionary that maps instances of objects in a model to objects in another model

objects = <obj_tables.core.Manager object>[source]
observables = <obj_tables.core.ManyToManyAttribute object>[source]
parameters = <obj_tables.core.ManyToManyAttribute object>[source]
serialize()[source]

Generate string representation

Returns

string representation

Return type

str

species = <obj_tables.core.ManyToManyAttribute object>[source]
validate()[source]

Check that the function is valid

  • Check that the expression is a valid Python function

Returns

None if the object is valid,

otherwise return a list of errors as an instance of InvalidObject

Return type

InvalidObject or None

class wc_lang.core.Identifier(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

Reference to an entry in a namespace

namespace[source]

namespace name

Type

str

id[source]

id of entry in namespace

Type

str

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('namespace', 'id')[source]
attributes = {'id': <obj_tables.core.StringAttribute object>, 'namespace': <obj_tables.core.StringAttribute object>}[source]
child_attrs = {'sbml': ('namespace', 'id'), 'wc_sim': ()}[source]
frozen_columns = 2[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.Identifier'>,)[source]
local_attributes = {'authors': <obj_tables.core.LocalAttribute object>, 'changes': <obj_tables.core.LocalAttribute object>, 'compartments': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'dfba_obj_reactions': <obj_tables.core.LocalAttribute object>, 'dfba_obj_species': <obj_tables.core.LocalAttribute object>, 'dfba_objs': <obj_tables.core.LocalAttribute object>, 'distribution_init_concentrations': <obj_tables.core.LocalAttribute object>, 'env': <obj_tables.core.LocalAttribute object>, 'functions': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'namespace': <obj_tables.core.LocalAttribute object>, 'observables': <obj_tables.core.LocalAttribute object>, 'observation_sets': <obj_tables.core.LocalAttribute object>, 'observations': <obj_tables.core.LocalAttribute object>, 'parameters': <obj_tables.core.LocalAttribute object>, 'rate_laws': <obj_tables.core.LocalAttribute object>, 'reactions': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>, 'species': <obj_tables.core.LocalAttribute object>, 'species_types': <obj_tables.core.LocalAttribute object>, 'stop_conditions': <obj_tables.core.LocalAttribute object>, 'submodels': <obj_tables.core.LocalAttribute object>, 'taxon': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('namespace', 'id')[source]
primary_attribute = None[source]
related_attributes = {'authors': <wc_lang.core.IdentifierManyToManyAttribute object>, 'changes': <wc_lang.core.IdentifierManyToManyAttribute object>, 'compartments': <wc_lang.core.IdentifierManyToManyAttribute object>, 'conclusions': <wc_lang.core.IdentifierManyToManyAttribute object>, 'dfba_obj_reactions': <wc_lang.core.IdentifierManyToManyAttribute object>, 'dfba_obj_species': <wc_lang.core.IdentifierManyToManyAttribute object>, 'dfba_objs': <wc_lang.core.IdentifierManyToManyAttribute object>, 'distribution_init_concentrations': <wc_lang.core.IdentifierManyToManyAttribute object>, 'env': <wc_lang.core.IdentifierOneToManyAttribute object>, 'functions': <wc_lang.core.IdentifierManyToManyAttribute object>, 'model': <wc_lang.core.IdentifierOneToManyAttribute object>, 'observables': <wc_lang.core.IdentifierManyToManyAttribute object>, 'observation_sets': <wc_lang.core.IdentifierManyToManyAttribute object>, 'observations': <wc_lang.core.IdentifierManyToManyAttribute object>, 'parameters': <wc_lang.core.IdentifierManyToManyAttribute object>, 'rate_laws': <wc_lang.core.IdentifierManyToManyAttribute object>, 'reactions': <wc_lang.core.IdentifierManyToManyAttribute object>, 'references': <wc_lang.core.IdentifierManyToManyAttribute object>, 'species': <wc_lang.core.IdentifierManyToManyAttribute object>, 'species_types': <wc_lang.core.IdentifierManyToManyAttribute object>, 'stop_conditions': <wc_lang.core.IdentifierManyToManyAttribute object>, 'submodels': <wc_lang.core.IdentifierManyToManyAttribute object>, 'taxon': <wc_lang.core.IdentifierOneToManyAttribute object>}[source]
table_format = 3[source]
unique_together = (('id', 'namespace'),)[source]
verbose_name = 'Identifier'[source]
verbose_name_plural = 'Identifiers'[source]
id = <obj_tables.core.StringAttribute object>[source]
namespace = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
serialize()[source]

Generate string representation

Returns

value of primary attribute

Return type

str

class wc_lang.core.IdentifierManyToManyAttribute(related_name='', verbose_name='Identifiers', verbose_related_name='', description='')[source]

Bases: wc_lang.core.IdentifierToManyGrammarAttribute, obj_tables.core.ManyToManyAttribute

class wc_lang.core.IdentifierOneToManyAttribute(related_name='', verbose_name='Identifiers', verbose_related_name='', description='')[source]

Bases: wc_lang.core.IdentifierToManyGrammarAttribute, obj_tables.core.OneToManyAttribute

class wc_lang.core.IdentifierToManyGrammarAttribute(related_class, grammar=None, **kwargs)[source]

Bases: obj_tables.grammar.ToManyGrammarAttribute

get_xlsx_validation(sheet_models=None, doc_metadata_model=None)[source]

Get Excel validation

Parameters
  • sheet_models (list of Model, optional) – models encoded as separate sheets

  • doc_metadata_model (type) – model whose worksheet contains the document metadata

Returns

validation

Return type

wc_utils.workbook.io.FieldValidation

grammar_path = '/root/project/wc_lang/grammar/identifiers.lark'[source]
serialize(identifiers, encoded=None)[source]

Serialize related object

Parameters
  • identifiers (list of Identifier) – Python representation of identifiers

  • encoded (dict, optional) – dictionary of objects that have already been encoded

Returns

string representation

Return type

str

class wc_lang.core.InitVolume(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

Initial volume of a compartment

distribution[source]

distribution

Type

proto.Term

mean[source]

mean initial volume

Type

float

std[source]

standard deviation of the mean initial volume

Type

float

units[source]

units of volume

Type

unit_registry.Unit

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('distribution', 'mean', 'std', 'units')[source]
attributes = {'distribution': <obj_tables.sci.onto.OntoTermAttribute object>, 'mean': <obj_tables.core.FloatAttribute object>, 'std': <obj_tables.core.FloatAttribute object>, 'units': <obj_tables.sci.units.UnitAttribute object>}[source]
child_attrs = {'sbml': ('distribution', 'mean', 'std', 'units'), 'wc_sim': ('distribution', 'mean', 'std', 'units')}[source]
children = {'core_model': (), 'submodel': ()}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.InitVolume'>,)[source]
local_attributes = {'compartments': <obj_tables.core.LocalAttribute object>, 'distribution': <obj_tables.core.LocalAttribute object>, 'mean': <obj_tables.core.LocalAttribute object>, 'std': <obj_tables.core.LocalAttribute object>, 'units': <obj_tables.core.LocalAttribute object>}[source]
ordering = ()[source]
primary_attribute = None[source]
related_attributes = {'compartments': <obj_tables.core.ManyToOneAttribute object>}[source]
table_format = 4[source]
unique_together = (('distribution', 'mean', 'std', 'units'),)[source]
verbose_name = 'Init volume'[source]
verbose_name_plural = 'Init volumes'[source]
distribution = <obj_tables.sci.onto.OntoTermAttribute object>[source]
mean = <obj_tables.core.FloatAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
serialize()[source]

Generate string representation

Returns

string representation

Return type

str

std = <obj_tables.core.FloatAttribute object>[source]
units = <obj_tables.sci.units.UnitAttribute object>[source]
class wc_lang.core.Model(**kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

id[source]

unique identifier

Type

str

name[source]

name

Type

str

version[source]

version of the model

Type

str

url[source]

url of the model Git repository

Type

str

branch[source]

branch of the model Git repository

Type

str

revision[source]

hash for git commit of the wc_lang version used by a model

Type

str

wc_lang_version[source]

version of wc_lang

Type

str

time_units[source]

time units

Type

unit_registry.Unit

identifiers[source]

identifiers

Type

list of Identifier

comments[source]

comments

Type

str

created[source]

date created

Type

datetime.datetime

updated[source]

date updated

Type

datetime.datetime

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('id', 'name', 'version', 'url', 'branch', 'revision', 'wc_lang_version', 'time_units', 'identifiers', 'comments', 'created', 'updated')[source]
attributes = {'branch': <obj_tables.core.StringAttribute object>, 'comments': <wc_lang.core.CommentAttribute object>, 'created': <obj_tables.core.DateTimeAttribute object>, 'id': <obj_tables.core.SlugAttribute object>, 'identifiers': <wc_lang.core.IdentifierOneToManyAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'revision': <obj_tables.core.StringAttribute object>, 'time_units': <obj_tables.sci.units.UnitAttribute object>, 'updated': <obj_tables.core.DateTimeAttribute object>, 'url': <obj_tables.core.UrlAttribute object>, 'version': <obj_tables.core.RegexAttribute object>, 'wc_lang_version': <obj_tables.core.RegexAttribute object>}[source]
child_attrs = {'sbml': ('id', 'name', 'version', 'url', 'branch', 'revision', 'wc_lang_version', 'time_units', 'identifiers', 'comments', 'updated', 'created'), 'wc_sim': ('id', 'version', 'wc_lang_version', 'time_units')}[source]
children = {'core_model': ('taxon', 'env', 'compartments', 'species_types', 'species', 'distribution_init_concentrations', 'observables', 'functions', 'stop_conditions'), 'submodel': ('taxon', 'env')}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.Model'>,)[source]
local_attributes = {'authors': <obj_tables.core.LocalAttribute object>, 'branch': <obj_tables.core.LocalAttribute object>, 'changes': <obj_tables.core.LocalAttribute object>, 'comments': <obj_tables.core.LocalAttribute object>, 'compartments': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'created': <obj_tables.core.LocalAttribute object>, 'dfba_obj_reactions': <obj_tables.core.LocalAttribute object>, 'dfba_obj_species': <obj_tables.core.LocalAttribute object>, 'dfba_objs': <obj_tables.core.LocalAttribute object>, 'distribution_init_concentrations': <obj_tables.core.LocalAttribute object>, 'env': <obj_tables.core.LocalAttribute object>, 'functions': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'observables': <obj_tables.core.LocalAttribute object>, 'observation_sets': <obj_tables.core.LocalAttribute object>, 'observations': <obj_tables.core.LocalAttribute object>, 'parameters': <obj_tables.core.LocalAttribute object>, 'rate_laws': <obj_tables.core.LocalAttribute object>, 'reactions': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>, 'revision': <obj_tables.core.LocalAttribute object>, 'species': <obj_tables.core.LocalAttribute object>, 'species_types': <obj_tables.core.LocalAttribute object>, 'stop_conditions': <obj_tables.core.LocalAttribute object>, 'submodels': <obj_tables.core.LocalAttribute object>, 'taxon': <obj_tables.core.LocalAttribute object>, 'time_units': <obj_tables.core.LocalAttribute object>, 'updated': <obj_tables.core.LocalAttribute object>, 'url': <obj_tables.core.LocalAttribute object>, 'version': <obj_tables.core.LocalAttribute object>, 'wc_lang_version': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.SlugAttribute object>[source]
related_attributes = {'authors': <obj_tables.core.ManyToOneAttribute object>, 'changes': <obj_tables.core.ManyToOneAttribute object>, 'compartments': <obj_tables.core.ManyToOneAttribute object>, 'conclusions': <obj_tables.core.ManyToOneAttribute object>, 'dfba_obj_reactions': <obj_tables.core.ManyToOneAttribute object>, 'dfba_obj_species': <obj_tables.core.ManyToOneAttribute object>, 'dfba_objs': <obj_tables.core.ManyToOneAttribute object>, 'distribution_init_concentrations': <obj_tables.core.ManyToOneAttribute object>, 'env': <obj_tables.core.OneToOneAttribute object>, 'functions': <obj_tables.core.ManyToOneAttribute object>, 'observables': <obj_tables.core.ManyToOneAttribute object>, 'observation_sets': <obj_tables.core.ManyToOneAttribute object>, 'observations': <obj_tables.core.ManyToOneAttribute object>, 'parameters': <obj_tables.core.ManyToOneAttribute object>, 'rate_laws': <obj_tables.core.ManyToOneAttribute object>, 'reactions': <obj_tables.core.ManyToOneAttribute object>, 'references': <obj_tables.core.ManyToOneAttribute object>, 'species': <obj_tables.core.ManyToOneAttribute object>, 'species_types': <obj_tables.core.ManyToOneAttribute object>, 'stop_conditions': <obj_tables.core.ManyToOneAttribute object>, 'submodels': <obj_tables.core.ManyToOneAttribute object>, 'taxon': <obj_tables.core.OneToOneAttribute object>}[source]
table_format = 2[source]
unique_together = ()[source]
verbose_name = 'Model'[source]
verbose_name_plural = 'Models'[source]
branch = <obj_tables.core.StringAttribute object>[source]
comments = <wc_lang.core.CommentAttribute object>[source]
created = <obj_tables.core.DateTimeAttribute object>[source]
export_relations_to_sbml(sbml_model, sbml)[source]

Add relationships to/from object to SBML model.

Parameters
  • sbml_model (libsbml.Model) – SBML model

  • sbml (libsbml.Model) – SBML model

export_to_sbml(sbml_model)[source]

Add this metadata about this model to a SBML model.

Parameters

sbml_model (libsbml.Model) – SBML model

Returns

SBML model

Return type

libsbml.Model

get_authors(_Model__type=None, **kwargs)[source]

Get all authors from model and children

Parameters
  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs to find matching objects

Returns

authors

Return type

list of Author

get_changes(_Model__type=None, **kwargs)[source]

Get all changes from model and children

Parameters
  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs to find matching objects

Returns

changes

Return type

list of Change

get_compartments(_Model__type=None, **kwargs)[source]

Get all compartments that satisfy the matching criteria

Parameters
  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs to find matching objects

Returns

compartments

Return type

list of Compartment

get_components(_Model__type=None, **kwargs)[source]

Find model component of type with id

Parameters
  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs to find matching objects

Returns

component with id, or None if there is no component with id`=`id

Return type

obj_tables.Model

get_conclusions(_Model__type=None, **kwargs)[source]

Get all conclusions for model

Returns

conclusions for model

Return type

list of Conclusion

get_dfba_obj_reactions(_Model__type=None, **kwargs)[source]

Get all dFBA objective reactions used by submodels

Parameters
  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs to find matching objects

Returns

dFBA objective reactions

Return type

list of DfbaObjReaction

get_dfba_obj_species(_Model__type=None, **kwargs)[source]

Get all dFBA objective species used by submodels

Parameters
  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs to find matching objects

Returns

dFBA objective species

Return type

list of DfbaObjSpecies

get_dfba_objs(_Model__type=None, **kwargs)[source]

Get all dFBA objectives

Returns

dFBA objectives

Return type

list of DfbaObjective

get_distribution_init_concentrations(_Model__type=None, **kwargs)[source]

Get all initial distributions of concentrations of species at the beginning of each cell cycle

Parameters
  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs to find matching objects

Returns

initial distributions

of concentrations of species at the beginning of each cell cycle

Return type

list of DistributionInitConcentration

get_evidence(_Model__type=None, **kwargs)[source]

Get all evidence for model

Returns

evidence for model

Return type

list of Evidence

get_functions(_Model__type=None, **kwargs)[source]

Get all functions

Parameters
  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs to find matching objects

Returns

functions

Return type

list of Function

get_observables(_Model__type=None, **kwargs)[source]

Get all observables

Parameters
  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs to find matching objects

Returns

observables

Return type

list of Observables

get_observation_sets(_Model__type=None, **kwargs)[source]

Get all observation sets for model

Returns

observation sets for model

Return type

list of ObservationSet

get_observations(_Model__type=None, **kwargs)[source]

Get all observations for model

Returns

observations for model

Return type

list of Observation

get_parameters(_Model__type=None, **kwargs)[source]

Get all parameters from model and submodels

Parameters
  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs to find matching objects

Returns

parameters

Return type

list of Parameter

get_rate_laws(_Model__type=None, **kwargs)[source]

Get all rate laws from reactions

Parameters
  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs to find matching objects

Returns

rate laws

Return type

list of RateLaw

get_reactions(_Model__type=None, **kwargs)[source]

Get all reactions from submodels

Parameters
  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs to find matching objects

Returns

reactions

Return type

list of Reaction

get_references(_Model__type=None, **kwargs)[source]

Get all references from model and children

Parameters
  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs to find matching objects

Returns

references

Return type

list of Reference

get_root_compartments(_Model__type=None, **kwargs)[source]

Get the root compartments (compartments that either have no parent compartment or whose parent compartment is not cellular)

Returns

root compartments

Return type

list of Compartment

get_species(_Model__type=None, **kwargs)[source]

Get all species from submodels

Parameters
  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs to find matching objects

Returns

species

Return type

list of Species

get_species_types(_Model__type=None, **kwargs)[source]

Get all species types

Parameters
  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs to find matching objects

Returns

species types

Return type

list of SpeciesType

get_stop_conditions(_Model__type=None, **kwargs)[source]

Get all stop conditions

Parameters
  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs to find matching objects

Returns

stop conditions

Return type

list of StopCondition

get_submodels(_Model__type=None, **kwargs)[source]

Get all submodels

Parameters
  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs to find matching objects

Returns

submodels

Return type

list of Submodel

id = <obj_tables.core.SlugAttribute object>[source]
identifiers = <wc_lang.core.IdentifierOneToManyAttribute object>[source]
import_from_sbml(sbml)[source]

Load from SBML model

Parameters

sbml (libsbml.Model) – SBML model

import_relations_from_sbml(sbml, objs)[source]

Load relationships from SBML model

Parameters
  • sbml (libsbml.Model) – SBML model

  • objs (dict) – dictionary that maps WC-Lang types to dictionaries that map the ids of WC-Lang objects to WC-Lang objects

merge_attrs(other, other_objs_in_self, self_objs_in_other)[source]

Merge attributes of two objects

Parameters
  • other (Model) – other model

  • other_objs_in_self (dict) – dictionary that maps instances of objects in another model to objects in a model

  • self_objs_in_other (dict) – dictionary that maps instances of objects in a model to objects in another model

name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
revision = <obj_tables.core.StringAttribute object>[source]
time_units = <obj_tables.sci.units.UnitAttribute object>[source]
updated = <obj_tables.core.DateTimeAttribute object>[source]
url = <obj_tables.core.UrlAttribute object>[source]
validate()[source]

Determine if the model is valid

  • Network of compartments is rooted and acyclic

  • Networks of observables and functions are acyclic

Returns

None if the object is valid,

otherwise return a list of errors as an instance of InvalidObject

Return type

InvalidObject or None

version = <obj_tables.core.RegexAttribute object>[source]
wc_lang_version = <obj_tables.core.RegexAttribute object>[source]
class wc_lang.core.Observable(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlAssignmentRuleMixin

Observable: a linear function of other Observbles and Species

id[source]

unique id

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

expression[source]

mathematical expression for an Observable

Type

ObservableExpression

units[source]

units of expression

Type

unit_registry.Unit

identifiers[source]

identifiers

Type

list of Identifier

evidence[source]

observation that supports/disputes a conclusion

Type

list of Evidence

conclusions[source]

conclusions

Type

list of Conclusion

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta, obj_tables.math.expression.ExpressionExpressionTermMeta

attribute_order = ('id', 'name', 'expression', 'units', 'identifiers', 'evidence', 'conclusions', 'comments', 'references')[source]
attributes = {'comments': <wc_lang.core.CommentAttribute object>, 'conclusions': <obj_tables.core.ManyToManyAttribute object>, 'evidence': <wc_lang.core.EvidenceManyToManyAttribute object>, 'expression': <obj_tables.math.expression.OneToOneExpressionAttribute object>, 'id': <obj_tables.core.SlugAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'references': <obj_tables.core.ManyToManyAttribute object>, 'units': <obj_tables.sci.units.UnitAttribute object>}[source]
child_attrs = {'sbml': ('id', 'name', 'model', 'expression', 'units', 'identifiers', 'comments'), 'wc_sim': ('id', 'model', 'expression', 'units')}[source]
children = {'core_model': ('expression', 'identifiers', 'evidence', 'conclusions', 'references'), 'submodel': ('expression', 'identifiers', 'evidence', 'conclusions', 'references')}[source]
expression_term_model[source]

alias of ObservableExpression

expression_term_units = 'units'[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.Observable'>,)[source]
local_attributes = {'comments': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'evidence': <obj_tables.core.LocalAttribute object>, 'expression': <obj_tables.core.LocalAttribute object>, 'function_expressions': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'observable_expressions': <obj_tables.core.LocalAttribute object>, 'rate_law_expressions': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>, 'stop_condition_expressions': <obj_tables.core.LocalAttribute object>, 'units': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.SlugAttribute object>[source]
related_attributes = {'function_expressions': <obj_tables.core.ManyToManyAttribute object>, 'observable_expressions': <obj_tables.core.ManyToManyAttribute object>, 'rate_law_expressions': <obj_tables.core.ManyToManyAttribute object>, 'stop_condition_expressions': <obj_tables.core.ManyToManyAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Observable'[source]
verbose_name_plural = 'Observables'[source]
comments = <wc_lang.core.CommentAttribute object>[source]
conclusions = <obj_tables.core.ManyToManyAttribute object>[source]
evidence = <wc_lang.core.EvidenceManyToManyAttribute object>[source]
expression = <obj_tables.math.expression.OneToOneExpressionAttribute object>[source]
id = <obj_tables.core.SlugAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
references = <obj_tables.core.ManyToManyAttribute object>[source]
units = <obj_tables.sci.units.UnitAttribute object>[source]
class wc_lang.core.ObservableExpression(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, obj_tables.math.expression.Expression, wc_lang.sbml.util.SbmlModelMixin

A mathematical expression of Observables and Species

The expression used by a Observable.

expression[source]

mathematical expression for an Observable

Type

str

_parsed_expression[source]

an analyzed expression; not an obj_tables.Model

Type

ParsedExpression

species[source]

Species used by this Observable expression

Type

list of Species

observables[source]

other Observables used by this Observable expression

Type

list of Observable

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta, obj_tables.math.expression.Meta

attribute_order = ()[source]
attributes = {'expression': <obj_tables.core.LongStringAttribute object>, 'observables': <obj_tables.core.ManyToManyAttribute object>, 'species': <obj_tables.core.ManyToManyAttribute object>}[source]
child_attrs = {'sbml': ('expression', 'species', 'observables'), 'wc_sim': ('expression', 'species', 'observables')}[source]
children = {'core_model': ('species', 'observables'), 'submodel': ('species', 'observables')}[source]
expression_is_linear = True[source]
expression_term_models = ('Species', 'Observable')[source]
expression_unit_registry = <pint.registry.UnitRegistry object>[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.ObservableExpression'>,)[source]
local_attributes = {'expression': <obj_tables.core.LocalAttribute object>, 'observable': <obj_tables.core.LocalAttribute object>, 'observables': <obj_tables.core.LocalAttribute object>, 'species': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('expression',)[source]
primary_attribute = <obj_tables.core.LongStringAttribute object>[source]
related_attributes = {'observable': <obj_tables.math.expression.OneToOneExpressionAttribute object>}[source]
table_format = 3[source]
unique_together = ()[source]
verbose_name = 'Observable expression'[source]
verbose_name_plural = 'Observable expressions'[source]
classmethod deserialize(value, objects)[source]

Deserialize value

Parameters
  • value (str) – String representation

  • objects (dict) – dictionary of objects, grouped by model

Returns

tuple of cleaned value and cleaning error

Return type

tuple of ObservableExpression, InvalidAttribute or None

expression = <obj_tables.core.LongStringAttribute object>[source]
merge_attrs(other, other_objs_in_self, self_objs_in_other)[source]

Merge attributes of two objects

Parameters
  • other (obj_tables.Model) – other model

  • other_objs_in_self (dict) – dictionary that maps instances of objects in another model to objects in a model

  • self_objs_in_other (dict) – dictionary that maps instances of objects in a model to objects in another model

objects = <obj_tables.core.Manager object>[source]
observables = <obj_tables.core.ManyToManyAttribute object>[source]
serialize()[source]

Generate string representation

Returns

string representation

Return type

str

species = <obj_tables.core.ManyToManyAttribute object>[source]
validate()[source]

Check that the observable is valid

  • Check that the expression is a linear function

Returns

None if the object is valid,

otherwise return a list of errors as an instance of InvalidObject

Return type

InvalidObject or None

class wc_lang.core.Observation(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model

id[source]

unique identifier

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

value[source]

value

Type

str

std[source]

standard error of the value

Type

str

units[source]

units

Type

unit_registry.Unit

type[source]

type

Type

pronto.term.Term

genotype[source]

genotype

Type

ObservationGenotype

env[source]

environment

Type

ObservationEnv

experiment_type[source]

type of experiment (e.g. RNA-seq)

Type

str

experiment_design[source]

experimental design

Type

str

data_generation_process[source]

process used to measure data (e.g. deep sequencing)

Type

Process

data_analysis_process[source]

process used to analyze data (e.g. Cufflinks)

Type

Process

identifiers[source]

identifiers

Type

list of Identifier

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('id', 'name', 'value', 'std', 'units', 'type', 'genotype', 'env', 'experiment_type', 'experiment_design', 'data_generation_process', 'data_analysis_process', 'identifiers', 'comments', 'references')[source]
attributes = {'comments': <wc_lang.core.CommentAttribute object>, 'data_analysis_process': <obj_tables.core.ManyToOneAttribute object>, 'data_generation_process': <obj_tables.core.ManyToOneAttribute object>, 'env': <obj_tables.core.ManyToOneAttribute object>, 'experiment_design': <obj_tables.core.LongStringAttribute object>, 'experiment_type': <obj_tables.core.LongStringAttribute object>, 'genotype': <obj_tables.core.ManyToOneAttribute object>, 'id': <obj_tables.core.SlugAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'references': <obj_tables.core.ManyToManyAttribute object>, 'std': <obj_tables.core.StringAttribute object>, 'type': <obj_tables.sci.onto.OntoTermAttribute object>, 'units': <obj_tables.sci.units.UnitAttribute object>, 'value': <obj_tables.core.StringAttribute object>}[source]
child_attrs = {'sbml': (), 'wc_sim': ()}[source]
children = {'core_model': ('genotype', 'env', 'data_generation_process', 'data_analysis_process', 'identifiers', 'references'), 'submodel': ('genotype', 'env', 'data_generation_process', 'data_analysis_process', 'identifiers', 'references')}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.Observation'>,)[source]
local_attributes = {'comments': <obj_tables.core.LocalAttribute object>, 'data_analysis_process': <obj_tables.core.LocalAttribute object>, 'data_generation_process': <obj_tables.core.LocalAttribute object>, 'env': <obj_tables.core.LocalAttribute object>, 'evidence': <obj_tables.core.LocalAttribute object>, 'experiment_design': <obj_tables.core.LocalAttribute object>, 'experiment_type': <obj_tables.core.LocalAttribute object>, 'genotype': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'observation_sets': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>, 'std': <obj_tables.core.LocalAttribute object>, 'type': <obj_tables.core.LocalAttribute object>, 'units': <obj_tables.core.LocalAttribute object>, 'value': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.SlugAttribute object>[source]
related_attributes = {'evidence': <obj_tables.core.ManyToOneAttribute object>, 'observation_sets': <obj_tables.core.ManyToManyAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Observation'[source]
verbose_name_plural = 'Observations'[source]
comments = <wc_lang.core.CommentAttribute object>[source]
data_analysis_process = <obj_tables.core.ManyToOneAttribute object>[source]
data_generation_process = <obj_tables.core.ManyToOneAttribute object>[source]
env = <obj_tables.core.ManyToOneAttribute object>[source]
experiment_design = <obj_tables.core.LongStringAttribute object>[source]
experiment_type = <obj_tables.core.LongStringAttribute object>[source]
genotype = <obj_tables.core.ManyToOneAttribute object>[source]
id = <obj_tables.core.SlugAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
references = <obj_tables.core.ManyToManyAttribute object>[source]
std = <obj_tables.core.StringAttribute object>[source]
type = <obj_tables.sci.onto.OntoTermAttribute object>[source]
units = <obj_tables.sci.units.UnitAttribute object>[source]
value = <obj_tables.core.StringAttribute object>[source]
class wc_lang.core.ObservationEnv(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

Environment of an observation

temp[source]

temperature at which the observation was observed

Type

float

temp_units[source]

temperature units

Type

unit_registry.Unit

ph[source]

pH at which the observation was observed

Type

float

ph_units[source]

pH units

Type

unit_registry.Unit

growth_media[source]

growth media at which the observation was observed

Type

str

condition[source]

experimental conditions (e.g. control)

Type

str

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('temp', 'temp_units', 'ph', 'ph_units', 'growth_media', 'condition')[source]
attributes = {'condition': <obj_tables.core.LongStringAttribute object>, 'growth_media': <obj_tables.core.LongStringAttribute object>, 'ph': <obj_tables.core.FloatAttribute object>, 'ph_units': <obj_tables.sci.units.UnitAttribute object>, 'temp': <obj_tables.core.FloatAttribute object>, 'temp_units': <obj_tables.sci.units.UnitAttribute object>}[source]
child_attrs = {'sbml': (), 'wc_sim': ()}[source]
children = {'core_model': (), 'submodel': ()}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.ObservationEnv'>,)[source]
local_attributes = {'condition': <obj_tables.core.LocalAttribute object>, 'env_observations': <obj_tables.core.LocalAttribute object>, 'growth_media': <obj_tables.core.LocalAttribute object>, 'ph': <obj_tables.core.LocalAttribute object>, 'ph_units': <obj_tables.core.LocalAttribute object>, 'temp': <obj_tables.core.LocalAttribute object>, 'temp_units': <obj_tables.core.LocalAttribute object>}[source]
ordering = ()[source]
primary_attribute = None[source]
related_attributes = {'env_observations': <obj_tables.core.ManyToOneAttribute object>}[source]
table_format = 4[source]
unique_together = (('condition', 'growth_media', 'ph', 'ph_units', 'temp', 'temp_units'),)[source]
verbose_name = 'Observation env'[source]
verbose_name_plural = 'Observation envs'[source]
condition = <obj_tables.core.LongStringAttribute object>[source]
growth_media = <obj_tables.core.LongStringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
ph = <obj_tables.core.FloatAttribute object>[source]
ph_units = <obj_tables.sci.units.UnitAttribute object>[source]
serialize()[source]

Generate string representation

Returns

string representation

Return type

str

temp = <obj_tables.core.FloatAttribute object>[source]
temp_units = <obj_tables.sci.units.UnitAttribute object>[source]
validate()[source]

Determine if the environment is valid

  • temperature units are defined if the temperature is not None

  • pH units are defined if the pH is not None

Returns

None if the object is valid,

otherwise return a list of errors as an instance of InvalidObject

Return type

InvalidObject or None

class wc_lang.core.ObservationGenotype(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

Genotype of an observation

taxon[source]

taxon in which the observation was observed

Type

str

genetic_variant[source]

genetic variant in which the observation was observed

Type

str

Related attributes:

  • genotype_observations (list of Observation): observations

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('taxon', 'variant')[source]
attributes = {'taxon': <obj_tables.core.StringAttribute object>, 'variant': <obj_tables.core.StringAttribute object>}[source]
child_attrs = {'sbml': (), 'wc_sim': ()}[source]
children = {'core_model': (), 'submodel': ()}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.ObservationGenotype'>,)[source]
local_attributes = {'genotype_observations': <obj_tables.core.LocalAttribute object>, 'taxon': <obj_tables.core.LocalAttribute object>, 'variant': <obj_tables.core.LocalAttribute object>}[source]
ordering = ()[source]
primary_attribute = None[source]
related_attributes = {'genotype_observations': <obj_tables.core.ManyToOneAttribute object>}[source]
table_format = 4[source]
unique_together = (('taxon', 'variant'),)[source]
verbose_name = 'Observation genotype'[source]
verbose_name_plural = 'Observation genotypes'[source]
objects = <obj_tables.core.Manager object>[source]
serialize()[source]

Generate string representation

Returns

string representation

Return type

str

taxon = <obj_tables.core.StringAttribute object>[source]
variant = <obj_tables.core.StringAttribute object>[source]
class wc_lang.core.ObservationSet(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

Set of co-observed observations

id[source]

unique identifier

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

observations[source]

observations

Type

list of Observation

identifiers[source]

identifiers

Type

list of Identifier

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('id', 'name', 'observations', 'identifiers', 'comments', 'references')[source]
attributes = {'comments': <wc_lang.core.CommentAttribute object>, 'id': <obj_tables.core.SlugAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'observations': <obj_tables.core.ManyToManyAttribute object>, 'references': <obj_tables.core.ManyToManyAttribute object>}[source]
child_attrs = {'sbml': (), 'wc_sim': ()}[source]
children = {'core_model': ('observations', 'identifiers', 'references'), 'submodel': ('observations', 'identifiers', 'references')}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.ObservationSet'>,)[source]
local_attributes = {'comments': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'observations': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.SlugAttribute object>[source]
related_attributes = {}[source]
unique_together = ()[source]
verbose_name = 'Observation set'[source]
verbose_name_plural = 'Observation sets'[source]
comments = <wc_lang.core.CommentAttribute object>[source]
id = <obj_tables.core.SlugAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
observations = <obj_tables.core.ManyToManyAttribute object>[source]
references = <obj_tables.core.ManyToManyAttribute object>[source]
class wc_lang.core.Parameter(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

id[source]

unique identifier per model/submodel

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

type[source]

parameter type

Type

pronto.term.Term

value[source]

value

Type

float

std[source]

standard error of the value

Type

float

units[source]

units of the value and standard error

Type

unit_registry.Unit

identifiers[source]

identifiers

Type

list of Identifier

evidence[source]

observation that supports/disputes a conclusion

Type

list of Evidence

conclusions[source]

conclusions

Type

list of Conclusion

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta, obj_tables.math.expression.ExpressionStaticTermMeta

attribute_order = ('id', 'name', 'type', 'value', 'std', 'units', 'identifiers', 'evidence', 'conclusions', 'comments', 'references')[source]
attributes = {'comments': <wc_lang.core.CommentAttribute object>, 'conclusions': <obj_tables.core.ManyToManyAttribute object>, 'evidence': <wc_lang.core.EvidenceManyToManyAttribute object>, 'id': <obj_tables.core.SlugAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'references': <obj_tables.core.ManyToManyAttribute object>, 'std': <obj_tables.core.FloatAttribute object>, 'type': <obj_tables.sci.onto.OntoTermAttribute object>, 'units': <obj_tables.sci.units.UnitAttribute object>, 'value': <obj_tables.core.FloatAttribute object>}[source]
child_attrs = {'sbml': ('id', 'name', 'model', 'type', 'value', 'std', 'units', 'identifiers', 'comments'), 'wc_sim': ('id', 'model', 'type', 'value', 'std', 'units')}[source]
children = {'core_model': ('identifiers', 'evidence', 'conclusions', 'references'), 'submodel': ('identifiers', 'evidence', 'conclusions', 'references')}[source]
expression_term_units = 'units'[source]
expression_term_value = 'value'[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.Parameter'>,)[source]
local_attributes = {'comments': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'density_compartment': <obj_tables.core.LocalAttribute object>, 'evidence': <obj_tables.core.LocalAttribute object>, 'function_expressions': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'rate_law_expressions': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>, 'std': <obj_tables.core.LocalAttribute object>, 'stop_condition_expressions': <obj_tables.core.LocalAttribute object>, 'type': <obj_tables.core.LocalAttribute object>, 'units': <obj_tables.core.LocalAttribute object>, 'value': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.SlugAttribute object>[source]
related_attributes = {'density_compartment': <obj_tables.core.OneToOneAttribute object>, 'function_expressions': <obj_tables.core.ManyToManyAttribute object>, 'rate_law_expressions': <obj_tables.core.ManyToManyAttribute object>, 'stop_condition_expressions': <obj_tables.core.ManyToManyAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Parameter'[source]
verbose_name_plural = 'Parameters'[source]
comments = <wc_lang.core.CommentAttribute object>[source]
conclusions = <obj_tables.core.ManyToManyAttribute object>[source]
evidence = <wc_lang.core.EvidenceManyToManyAttribute object>[source]
export_relations_to_sbml(sbml_model, sbml)[source]

Add relationships to/from object to SBML parameter.

Parameters
  • sbml_model (libsbml.Model) – SBML model

  • sbml (libsbml.Parameter) – SBML parameter

export_to_sbml(sbml_model)[source]

Add this parameter to a SBML model.

Parameters

sbml_model (libsbml.Model) – SBML model

Returns

SBML parameter

Return type

libsbml.Parameter

id = <obj_tables.core.SlugAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
import_from_sbml(sbml)[source]

Load from SBML parameter

Parameters

sbml (libsbml.Parameter) – SBML parameter

import_relations_from_sbml(sbml, objs)[source]

Load relationships from SBML parameter

Parameters
  • sbml (libsbml.Parameter) – SBML parameter

  • objs (dict) – dictionary that maps WC-Lang types to dictionaries that map the ids of WC-Lang objects to WC-Lang objects

model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
references = <obj_tables.core.ManyToManyAttribute object>[source]
std = <obj_tables.core.FloatAttribute object>[source]
type = <obj_tables.sci.onto.OntoTermAttribute object>[source]
units = <obj_tables.sci.units.UnitAttribute object>[source]
value = <obj_tables.core.FloatAttribute object>[source]
class wc_lang.core.Ph(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

pH of a compartment

distribution[source]

distribution

Type

proto.Term

mean[source]

mean initial pH

Type

float

std[source]

standard deviation of the mean initial pH

Type

float

units[source]

units of pH

Type

unit_registry.Unit

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('distribution', 'mean', 'std', 'units')[source]
attributes = {'distribution': <obj_tables.sci.onto.OntoTermAttribute object>, 'mean': <obj_tables.core.FloatAttribute object>, 'std': <obj_tables.core.FloatAttribute object>, 'units': <obj_tables.sci.units.UnitAttribute object>}[source]
child_attrs = {'sbml': ('distribution', 'mean', 'std', 'units'), 'wc_sim': ()}[source]
children = {'core_model': (), 'submodel': ()}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.Ph'>,)[source]
local_attributes = {'compartments': <obj_tables.core.LocalAttribute object>, 'distribution': <obj_tables.core.LocalAttribute object>, 'mean': <obj_tables.core.LocalAttribute object>, 'std': <obj_tables.core.LocalAttribute object>, 'units': <obj_tables.core.LocalAttribute object>}[source]
ordering = ()[source]
primary_attribute = None[source]
related_attributes = {'compartments': <obj_tables.core.ManyToOneAttribute object>}[source]
table_format = 4[source]
unique_together = (('distribution', 'mean', 'std', 'units'),)[source]
verbose_name = 'Ph'[source]
verbose_name_plural = 'Phs'[source]
distribution = <obj_tables.sci.onto.OntoTermAttribute object>[source]
mean = <obj_tables.core.FloatAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
serialize()[source]

Generate string representation

Returns

string representation

Return type

str

std = <obj_tables.core.FloatAttribute object>[source]
units = <obj_tables.sci.units.UnitAttribute object>[source]
class wc_lang.core.Process(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

A process of an observation or conclusion

name[source]

procedure which produced the conclusion

Type

str

version[source]

version of procedure which produced the conclusion

Type

str

Related attributes:

  • observation_analysis (list of Observation): observation

  • observation_measurement (list of Observation): observation

  • conclusions (list of Conclusion): conclusions

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('name', 'version')[source]
attributes = {'name': <obj_tables.core.LongStringAttribute object>, 'version': <obj_tables.core.StringAttribute object>}[source]
child_attrs = {'sbml': (), 'wc_sim': ()}[source]
children = {'core_model': (), 'submodel': ()}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.Process'>,)[source]
local_attributes = {'conclusions': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'observation_data_analysis': <obj_tables.core.LocalAttribute object>, 'observation_data_generation': <obj_tables.core.LocalAttribute object>, 'version': <obj_tables.core.LocalAttribute object>}[source]
ordering = ()[source]
primary_attribute = None[source]
related_attributes = {'conclusions': <obj_tables.core.ManyToOneAttribute object>, 'observation_data_analysis': <obj_tables.core.ManyToOneAttribute object>, 'observation_data_generation': <obj_tables.core.ManyToOneAttribute object>}[source]
table_format = 4[source]
unique_together = (('name', 'version'),)[source]
verbose_name = 'Process'[source]
verbose_name_plural = 'Processes'[source]
name = <obj_tables.core.LongStringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
serialize()[source]

Generate string representation

Returns

string representation

Return type

str

version = <obj_tables.core.StringAttribute object>[source]
class wc_lang.core.RateLaw(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

Rate law

id[source]

identifier equal to {reaction.id}-{direction.name}

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

reaction[source]

reaction

Type

Reaction

direction[source]

direction

Type

RateLawDirection

type[source]

type

Type

pronto.term.Term

expression[source]

expression

Type

RateLawExpression

units[source]

units

Type

unit_registry.Unit

identifiers[source]

identifiers

Type

list of Identifier

evidence[source]

observation that supports/disputes a conclusion

Type

list of Evidence

conclusions[source]

conclusions

Type

list of Conclusion

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

class Meta[source]

Bases: obj_tables.core.Meta, obj_tables.math.expression.ExpressionExpressionTermMeta

attribute_order = ('id', 'name', 'reaction', 'direction', 'type', 'expression', 'units', 'identifiers', 'evidence', 'conclusions', 'comments', 'references')[source]
attributes = {'comments': <wc_lang.core.CommentAttribute object>, 'conclusions': <obj_tables.core.ManyToManyAttribute object>, 'direction': <obj_tables.core.EnumAttribute object>, 'evidence': <wc_lang.core.EvidenceManyToManyAttribute object>, 'expression': <obj_tables.math.expression.ManyToOneExpressionAttribute object>, 'id': <obj_tables.core.StringAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'reaction': <obj_tables.core.ManyToOneAttribute object>, 'references': <obj_tables.core.ManyToManyAttribute object>, 'type': <obj_tables.sci.onto.OntoTermAttribute object>, 'units': <obj_tables.sci.units.UnitAttribute object>}[source]
child_attrs = {'sbml': ('id', 'name', 'model', 'reaction', 'direction', 'type', 'expression', 'units', 'identifiers', 'comments'), 'wc_sim': ('id', 'model', 'reaction', 'direction', 'expression', 'units')}[source]
children = {'core_model': ('expression', 'identifiers', 'evidence', 'conclusions', 'references'), 'submodel': ('expression', 'identifiers', 'evidence', 'conclusions', 'references')}[source]
expression_term_model[source]

alias of RateLawExpression

expression_term_units = 'units'[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.RateLaw'>,)[source]
local_attributes = {'comments': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'direction': <obj_tables.core.LocalAttribute object>, 'evidence': <obj_tables.core.LocalAttribute object>, 'expression': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'reaction': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>, 'type': <obj_tables.core.LocalAttribute object>, 'units': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.StringAttribute object>[source]
related_attributes = {}[source]
unique_together = ()[source]
verbose_name = 'Rate law'[source]
verbose_name_plural = 'Rate laws'[source]
comments = <wc_lang.core.CommentAttribute object>[source]
conclusions = <obj_tables.core.ManyToManyAttribute object>[source]
direction = <obj_tables.core.EnumAttribute object>[source]
evidence = <wc_lang.core.EvidenceManyToManyAttribute object>[source]
export_relations_to_sbml(sbml_model, sbml)[source]

Add relationships to/from object to SBML kinetic law.

Parameters
  • sbml_model (libsbml.Model) – SBML model

  • sbml (libsbml.KineticLaw) – SBML kinetic law

export_to_sbml(sbml_model)[source]

Add this rate law to a SBML reaction.

Parameters

sbml_model (libsbml.Model) – SBML model

Returns

SBML kinetic law

Return type

libsbml.KineticLaw

expression = <obj_tables.math.expression.ManyToOneExpressionAttribute object>[source]
gen_id()[source]

Generate identifier

Returns

identifier

Return type

str

id = <obj_tables.core.StringAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
import_from_sbml(sbml)[source]

Load from SBML kinetic law

Parameters

sbml (libsbml.KineticLaw) – SBML kinetic law

import_relations_from_sbml(sbml, objs)[source]

Load relationships from SBML kinetic law

Parameters
  • sbml (libsbml.KineticLaw) – SBML kinetic law

  • objs (dict) – dictionary that maps WC-Lang types to dictionaries that map the ids of WC-Lang objects to WC-Lang objects

model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
reaction = <obj_tables.core.ManyToOneAttribute object>[source]
references = <obj_tables.core.ManyToManyAttribute object>[source]
type = <obj_tables.sci.onto.OntoTermAttribute object>[source]
units = <obj_tables.sci.units.UnitAttribute object>[source]
validate()[source]

Determine whether this RateLaw is valid

  • Check if identifier equal to {reaction.id}-{direction.name}

Returns

None if the object is valid,

otherwise return a list of errors in an InvalidObject instance

Return type

InvalidObject or None

class wc_lang.core.RateLawDirection[source]

Bases: int, wc_utils.util.enumerate.CaseInsensitiveEnum

Rate law directions

backward = -1[source]
forward = 1[source]
class wc_lang.core.RateLawExpression(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, obj_tables.math.expression.Expression, wc_lang.sbml.util.SbmlModelMixin

A mathematical expression of Parameters, Species, Observables, Functions, Compartments and Python functions

The expression used by a RateLaw.

expression[source]

mathematical expression of the rate law

Type

str

_parsed_expression[source]

an analyzed expression; not an obj_tables.Model

Type

ParsedExpression

species[source]

species whose dynamic concentrations are used in the rate law

Type

list of Species

parameters[source]

parameters whose values are used in the rate law

Type

list of Parameter

compartments[source]

Compartments used by this rate law expression

Type

list of Compartment

Related attributes:

  • rate_law (RateLaw): the RateLaw which uses this RateLawExpression

class Meta[source]

Bases: obj_tables.core.Meta, obj_tables.math.expression.Meta

attribute_order = ('expression', 'species', 'parameters')[source]
attributes = {'compartments': <obj_tables.core.ManyToManyAttribute object>, 'expression': <obj_tables.core.LongStringAttribute object>, 'functions': <obj_tables.core.ManyToManyAttribute object>, 'observables': <obj_tables.core.ManyToManyAttribute object>, 'parameters': <obj_tables.core.ManyToManyAttribute object>, 'species': <obj_tables.core.ManyToManyAttribute object>}[source]
child_attrs = {'sbml': ('expression', 'parameters', 'species', 'observables', 'functions', 'compartments'), 'wc_sim': ('expression', 'parameters', 'species', 'observables', 'functions', 'compartments')}[source]
children = {'core_model': ('parameters', 'species', 'observables', 'functions', 'compartments'), 'submodel': ('parameters', 'species', 'observables', 'functions', 'compartments')}[source]
expression_term_models = ('Parameter', 'Species', 'Observable', 'Function', 'Compartment')[source]
expression_unit_registry = <pint.registry.UnitRegistry object>[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.RateLawExpression'>,)[source]
local_attributes = {'compartments': <obj_tables.core.LocalAttribute object>, 'expression': <obj_tables.core.LocalAttribute object>, 'functions': <obj_tables.core.LocalAttribute object>, 'observables': <obj_tables.core.LocalAttribute object>, 'parameters': <obj_tables.core.LocalAttribute object>, 'rate_laws': <obj_tables.core.LocalAttribute object>, 'species': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('expression',)[source]
primary_attribute = <obj_tables.core.LongStringAttribute object>[source]
related_attributes = {'rate_laws': <obj_tables.math.expression.ManyToOneExpressionAttribute object>}[source]
table_format = 3[source]
unique_together = ()[source]
verbose_name = 'Rate law expression'[source]
verbose_name_plural = 'Rate law expressions'[source]
compartments = <obj_tables.core.ManyToManyAttribute object>[source]
classmethod deserialize(value, objects)[source]

Deserialize value

Parameters
  • value (str) – String representation

  • objects (dict) – dictionary of objects, grouped by model

Returns

tuple of cleaned value

and cleaning error

Return type

tuple of RateLawExpression, InvalidAttribute or None

expression = <obj_tables.core.LongStringAttribute object>[source]
functions = <obj_tables.core.ManyToManyAttribute object>[source]
merge_attrs(other, other_objs_in_self, self_objs_in_other)[source]

Merge attributes of two objects

Parameters
  • other (obj_tables.Model) – other model

  • other_objs_in_self (dict) – dictionary that maps instances of objects in another model to objects in a model

  • self_objs_in_other (dict) – dictionary that maps instances of objects in a model to objects in another model

objects = <obj_tables.core.Manager object>[source]
observables = <obj_tables.core.ManyToManyAttribute object>[source]
parameters = <obj_tables.core.ManyToManyAttribute object>[source]
serialize()[source]

Generate string representation

Returns

value of primary attribute

Return type

str

species = <obj_tables.core.ManyToManyAttribute object>[source]
validate()[source]

Determine whether a RateLawExpression is valid

  • Check that all of the species and parameters contribute to the expression

  • Check that the species and parameters encompass of the named entities in the expression

Returns

None if the object is valid,

otherwise return a list of errors in an InvalidObject instance

Return type

InvalidObject or None

class wc_lang.core.Reaction(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

id[source]

unique identifier

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

submodel[source]

submodel that reaction belongs to

Type

Submodel

participants[source]

participants

Type

list of SpeciesCoefficient

reversible[source]

indicates if reaction is thermodynamically reversible

Type

bool

rate_units[source]

units of rate law(s)

Type

unit_registry.Unit

flux_bounds[source]

flux bounds

Type

FluxBounds

identifiers[source]

identifiers

Type

list of Identifier

evidence[source]

observation that supports/disputes a conclusion

Type

list of Evidence

conclusions[source]

conclusions

Type

list of Conclusion

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

Related attributes:

  • rate_laws (list of RateLaw): rate laws; if two rate laws are present, rate_laws[1] is the forward rate law, and rate_laws[0] is the backward rate law

  • dfba_obj_expression (DfbaObjectiveExpression): dFBA objective expression

class Meta[source]

Bases: obj_tables.core.Meta, obj_tables.math.expression.ExpressionDynamicTermMeta

attribute_order = ('id', 'name', 'submodel', 'participants', 'reversible', 'rate_units', 'flux_bounds', 'identifiers', 'evidence', 'conclusions', 'comments', 'references')[source]
attributes = {'comments': <wc_lang.core.CommentAttribute object>, 'conclusions': <obj_tables.core.ManyToManyAttribute object>, 'evidence': <wc_lang.core.EvidenceManyToManyAttribute object>, 'flux_bounds': <obj_tables.core.ManyToOneAttribute object>, 'id': <obj_tables.core.SlugAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'participants': <wc_lang.core.ReactionParticipantAttribute object>, 'rate_units': <obj_tables.sci.units.UnitAttribute object>, 'references': <obj_tables.core.ManyToManyAttribute object>, 'reversible': <obj_tables.core.BooleanAttribute object>, 'submodel': <obj_tables.core.ManyToOneAttribute object>}[source]
child_attrs = {'sbml': ('id', 'name', 'model', 'submodel', 'participants', 'reversible', 'rate_units', 'flux_bounds', 'identifiers', 'comments'), 'wc_sim': ('id', 'model', 'submodel', 'participants', 'reversible', 'rate_units', 'flux_bounds')}[source]
children = {'core_model': ('participants', 'rate_laws', 'flux_bounds', 'identifiers', 'evidence', 'conclusions', 'references'), 'submodel': ('participants', 'rate_laws', 'flux_bounds', 'identifiers', 'evidence', 'conclusions', 'references')}[source]
expression_term_units = 'rate_units'[source]
indexed_attrs_tuples = (('id',),)[source]
inheritance = (<class 'wc_lang.core.Reaction'>,)[source]
local_attributes = {'comments': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'dfba_obj_expression': <obj_tables.core.LocalAttribute object>, 'evidence': <obj_tables.core.LocalAttribute object>, 'flux_bounds': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'participants': <obj_tables.core.LocalAttribute object>, 'rate_laws': <obj_tables.core.LocalAttribute object>, 'rate_units': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>, 'reversible': <obj_tables.core.LocalAttribute object>, 'submodel': <obj_tables.core.LocalAttribute object>}[source]
merge = 2[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.SlugAttribute object>[source]
related_attributes = {'dfba_obj_expression': <obj_tables.core.OneToManyAttribute object>, 'rate_laws': <obj_tables.core.ManyToOneAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Reaction'[source]
verbose_name_plural = 'Reactions'[source]
comments = <wc_lang.core.CommentAttribute object>[source]
conclusions = <obj_tables.core.ManyToManyAttribute object>[source]
evidence = <wc_lang.core.EvidenceManyToManyAttribute object>[source]
export_relations_to_sbml(sbml_model, sbml_rxn)[source]

Add relationships to/from object to SBML reaction.

Parameters
  • sbml_model (libsbml.Model) – SBML model

  • sbml_rxn (libsbml.Reaction) – SBML reaction

export_to_sbml(sbml_model)[source]

Add this reaction to a SBML model.

Parameters

sbml_model (libsbml.Model) – SBML model

Returns

SBML reaction

Return type

libsbml.Reaction

Raises

ValueError – if the reaction has a backward rate law which cannot be exported to SBML

flux_bounds = <obj_tables.core.ManyToOneAttribute object>[source]
get_modifiers(direction=<RateLawDirection.forward: 1>)[source]

Get species in the expression that are not reactants in the reaction

Returns

species in the expression that are not reactants in the reaction

Return type

list of Species

get_products()[source]

Get the species produced by the reaction

Returns

product species

Return type

list of Species

get_reactants()[source]

Get the species consumed by the reaction

Returns

reactant species

Return type

list of Species

get_species(_Reaction__type=None, **kwargs)[source]

Get species

Parameters
  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs to find matching objects

Returns

list of Species

Return type

list

id = <obj_tables.core.SlugAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
import_from_sbml(sbml_rxn)[source]

Load from SBML reaction

Parameters

sbml (libsbml.Reaction) – SBML reaction

import_relations_from_sbml(sbml_rxn, objs)[source]

Load relationships from SBML reaction

Parameters
  • sbml (libsbml.Reaction) – SBML reaction

  • objs (dict) – dictionary that maps WC-Lang types to dictionaries that map the ids of WC-Lang objects to WC-Lang objects

model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
participants = <wc_lang.core.ReactionParticipantAttribute object>[source]
rate_units = <obj_tables.sci.units.UnitAttribute object>[source]
references = <obj_tables.core.ManyToManyAttribute object>[source]
reversible = <obj_tables.core.BooleanAttribute object>[source]
submodel = <obj_tables.core.ManyToOneAttribute object>[source]
validate()[source]

Check if the reaction is valid

  • If the submodel is ODE or SSA, check that the reaction has a forward rate law

  • If the submodel is ODE or SSA and the reaction is reversible, check that the reaction has a backward rate law

  • Check flux units are not None if flux_bounds.min or flux_bounds.max is defined

  • Check that flux_bounds.min <= flux_bounds.max

  • Check that reaction is element and charge balanced

Returns

None if the object is valid,

otherwise return a list of errors in an InvalidObject instance

Return type

InvalidObject or None

class wc_lang.core.ReactionParticipantAttribute(related_name='', verbose_name='', verbose_related_name='', description='')[source]

Bases: obj_tables.grammar.ToManyGrammarAttribute, obj_tables.core.ManyToManyAttribute

Reaction participants

class Transformer(objects)[source]

Bases: obj_tables.grammar.ToManyGrammarTransformer

Transforms parse trees into a list of instances of core.Model

gbl(*args)[source]
gbl_part(*args)[source]
gbl_parts(*args)[source]
lcl(*args)[source]
lcl_part(*args)[source]
lcl_parts(*args)[source]
start(parts)[source]

Collapse return into a list of related model instances

Parameters

*args (list of core.Model) – related model instances

Returns

related model instances

Return type

list of core.Model

get_xlsx_validation(sheet_models=None, doc_metadata_model=None)[source]

Get Excel validation

Parameters
  • sheet_models (list of Model, optional) – models encoded as separate sheets

  • doc_metadata_model (type) – model whose worksheet contains the document metadata

Returns

validation

Return type

wc_utils.workbook.io.FieldValidation

grammar_path = '/root/project/wc_lang/grammar/reaction_participants.lark'[source]
serialize(participants, encoded=None)[source]

Serialize related object

Parameters
  • participants (list of SpeciesCoefficient) – Python representation of reaction participants

  • encoded (dict, optional) – dictionary of objects that have already been encoded

Returns

simple Python representation

Return type

str

validate(obj, value, tolerance=1e-10)[source]

Determine if value is a valid value of the attribute

Parameters
  • obj (Reaction) – object being validated

  • value (list of SpeciesCoefficient) – value of attribute to validate

  • tolerance (float, optional) – error tolerance value, default value is 1E-10

Returns

None if attribute is valid, other return list of errors as an instance of InvalidAttribute

Return type

InvalidAttribute or None

class wc_lang.core.Reference(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model

id[source]

unique identifier

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

title[source]

title

Type

str

author[source]

author(s)

Type

str

editor[source]

editor(s)

Type

str

year[source]

year

Type

int

type[source]

type

Type

pronto.Term

publication[source]

publication title

Type

str

publisher[source]

publisher

Type

str

series[source]

series

Type

str

volume[source]

volume

Type

str

number[source]

number

Type

str

issue[source]

issue

Type

str

edition[source]

edition

Type

str

chapter[source]

chapter

Type

str

pages[source]

page range

Type

str

identifiers[source]

identifiers

Type

list of Identifier

comments[source]

comments

Type

str

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('id', 'name', 'title', 'author', 'editor', 'year', 'type', 'publication', 'publisher', 'series', 'volume', 'number', 'issue', 'edition', 'chapter', 'pages', 'identifiers', 'comments')[source]
attributes = {'author': <obj_tables.core.StringAttribute object>, 'chapter': <obj_tables.core.StringAttribute object>, 'comments': <wc_lang.core.CommentAttribute object>, 'edition': <obj_tables.core.StringAttribute object>, 'editor': <obj_tables.core.StringAttribute object>, 'id': <obj_tables.core.SlugAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'issue': <obj_tables.core.StringAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'number': <obj_tables.core.StringAttribute object>, 'pages': <obj_tables.core.StringAttribute object>, 'publication': <obj_tables.core.StringAttribute object>, 'publisher': <obj_tables.core.StringAttribute object>, 'series': <obj_tables.core.StringAttribute object>, 'title': <obj_tables.core.StringAttribute object>, 'type': <obj_tables.sci.onto.OntoTermAttribute object>, 'volume': <obj_tables.core.StringAttribute object>, 'year': <obj_tables.core.PositiveIntegerAttribute object>}[source]
child_attrs = {'sbml': (), 'wc_sim': ()}[source]
children = {'core_model': ('identifiers',), 'submodel': ('identifiers',)}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.Reference'>,)[source]
local_attributes = {'author': <obj_tables.core.LocalAttribute object>, 'changes': <obj_tables.core.LocalAttribute object>, 'chapter': <obj_tables.core.LocalAttribute object>, 'comments': <obj_tables.core.LocalAttribute object>, 'compartments': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'dfba_obj_reactions': <obj_tables.core.LocalAttribute object>, 'dfba_obj_species': <obj_tables.core.LocalAttribute object>, 'dfba_objs': <obj_tables.core.LocalAttribute object>, 'distribution_init_concentrations': <obj_tables.core.LocalAttribute object>, 'edition': <obj_tables.core.LocalAttribute object>, 'editor': <obj_tables.core.LocalAttribute object>, 'env': <obj_tables.core.LocalAttribute object>, 'functions': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'issue': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'number': <obj_tables.core.LocalAttribute object>, 'observables': <obj_tables.core.LocalAttribute object>, 'observation_sets': <obj_tables.core.LocalAttribute object>, 'observations': <obj_tables.core.LocalAttribute object>, 'pages': <obj_tables.core.LocalAttribute object>, 'parameters': <obj_tables.core.LocalAttribute object>, 'publication': <obj_tables.core.LocalAttribute object>, 'publisher': <obj_tables.core.LocalAttribute object>, 'rate_laws': <obj_tables.core.LocalAttribute object>, 'reactions': <obj_tables.core.LocalAttribute object>, 'series': <obj_tables.core.LocalAttribute object>, 'species': <obj_tables.core.LocalAttribute object>, 'species_types': <obj_tables.core.LocalAttribute object>, 'stop_conditions': <obj_tables.core.LocalAttribute object>, 'submodels': <obj_tables.core.LocalAttribute object>, 'taxon': <obj_tables.core.LocalAttribute object>, 'title': <obj_tables.core.LocalAttribute object>, 'type': <obj_tables.core.LocalAttribute object>, 'volume': <obj_tables.core.LocalAttribute object>, 'year': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.SlugAttribute object>[source]
related_attributes = {'changes': <obj_tables.core.ManyToManyAttribute object>, 'compartments': <obj_tables.core.ManyToManyAttribute object>, 'conclusions': <obj_tables.core.ManyToManyAttribute object>, 'dfba_obj_reactions': <obj_tables.core.ManyToManyAttribute object>, 'dfba_obj_species': <obj_tables.core.ManyToManyAttribute object>, 'dfba_objs': <obj_tables.core.ManyToManyAttribute object>, 'distribution_init_concentrations': <obj_tables.core.ManyToManyAttribute object>, 'env': <obj_tables.core.OneToManyAttribute object>, 'functions': <obj_tables.core.ManyToManyAttribute object>, 'observables': <obj_tables.core.ManyToManyAttribute object>, 'observation_sets': <obj_tables.core.ManyToManyAttribute object>, 'observations': <obj_tables.core.ManyToManyAttribute object>, 'parameters': <obj_tables.core.ManyToManyAttribute object>, 'rate_laws': <obj_tables.core.ManyToManyAttribute object>, 'reactions': <obj_tables.core.ManyToManyAttribute object>, 'species': <obj_tables.core.ManyToManyAttribute object>, 'species_types': <obj_tables.core.ManyToManyAttribute object>, 'stop_conditions': <obj_tables.core.ManyToManyAttribute object>, 'submodels': <obj_tables.core.ManyToManyAttribute object>, 'taxon': <obj_tables.core.OneToManyAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Reference'[source]
verbose_name_plural = 'References'[source]
author = <obj_tables.core.StringAttribute object>[source]
chapter = <obj_tables.core.StringAttribute object>[source]
comments = <wc_lang.core.CommentAttribute object>[source]
edition = <obj_tables.core.StringAttribute object>[source]
editor = <obj_tables.core.StringAttribute object>[source]
id = <obj_tables.core.SlugAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
issue = <obj_tables.core.StringAttribute object>[source]
model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
number = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
pages = <obj_tables.core.StringAttribute object>[source]
publication = <obj_tables.core.StringAttribute object>[source]
publisher = <obj_tables.core.StringAttribute object>[source]
series = <obj_tables.core.StringAttribute object>[source]
title = <obj_tables.core.StringAttribute object>[source]
type = <obj_tables.sci.onto.OntoTermAttribute object>[source]
volume = <obj_tables.core.StringAttribute object>[source]
year = <obj_tables.core.PositiveIntegerAttribute object>[source]
class wc_lang.core.Species(tuple of species type, compartment)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

id[source]

identifier equal to {species_type.id}[{compartment.id}]

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

species_type[source]

species type

Type

SpeciesType

compartment[source]

compartment

Type

Compartment

units[source]

units of counts

Type

unit_registry.Unit

identifiers[source]

identifiers

Type

list of Identifier

evidence[source]

observation that supports/disputes a conclusion

Type

list of Evidence

conclusions[source]

conclusions

Type

list of Conclusion

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta, obj_tables.math.expression.ExpressionDynamicTermMeta

attribute_order = ('id', 'name', 'species_type', 'compartment', 'units', 'identifiers', 'evidence', 'conclusions', 'comments', 'references')[source]
attributes = {'comments': <wc_lang.core.CommentAttribute object>, 'compartment': <obj_tables.core.ManyToOneAttribute object>, 'conclusions': <obj_tables.core.ManyToManyAttribute object>, 'evidence': <wc_lang.core.EvidenceManyToManyAttribute object>, 'id': <obj_tables.core.StringAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'references': <obj_tables.core.ManyToManyAttribute object>, 'species_type': <obj_tables.core.ManyToOneAttribute object>, 'units': <obj_tables.sci.units.UnitAttribute object>}[source]
child_attrs = {'sbml': ('id', 'name', 'model', 'species_type', 'compartment', 'units', 'identifiers', 'comments'), 'wc_sim': ('id', 'model', 'species_type', 'compartment', 'units')}[source]
children = {'core_model': ('species_type', 'compartment', 'distribution_init_concentration', 'identifiers', 'evidence', 'conclusions', 'references'), 'submodel': ('species_type', 'compartment', 'distribution_init_concentration', 'identifiers', 'evidence', 'conclusions', 'references')}[source]
expression_term_token_pattern = (1, 9, 1, 10)[source]
expression_term_units = 'units'[source]
frozen_columns = 1[source]
indexed_attrs_tuples = (('compartment', 'species_type'),)[source]
inheritance = (<class 'wc_lang.core.Species'>,)[source]
local_attributes = {'comments': <obj_tables.core.LocalAttribute object>, 'compartment': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'dfba_obj_species': <obj_tables.core.LocalAttribute object>, 'distribution_init_concentration': <obj_tables.core.LocalAttribute object>, 'evidence': <obj_tables.core.LocalAttribute object>, 'function_expressions': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'observable_expressions': <obj_tables.core.LocalAttribute object>, 'rate_law_expressions': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>, 'species_coefficients': <obj_tables.core.LocalAttribute object>, 'species_type': <obj_tables.core.LocalAttribute object>, 'stop_condition_expressions': <obj_tables.core.LocalAttribute object>, 'units': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.StringAttribute object>[source]
related_attributes = {'dfba_obj_species': <obj_tables.core.ManyToOneAttribute object>, 'distribution_init_concentration': <obj_tables.core.OneToOneAttribute object>, 'function_expressions': <obj_tables.core.ManyToManyAttribute object>, 'observable_expressions': <obj_tables.core.ManyToManyAttribute object>, 'rate_law_expressions': <obj_tables.core.ManyToManyAttribute object>, 'species_coefficients': <obj_tables.core.ManyToOneAttribute object>, 'stop_condition_expressions': <obj_tables.core.ManyToManyAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Species'[source]
verbose_name_plural = 'Species'[source]
comments = <wc_lang.core.CommentAttribute object>[source]
compartment = <obj_tables.core.ManyToOneAttribute object>[source]
conclusions = <obj_tables.core.ManyToManyAttribute object>[source]
evidence = <wc_lang.core.EvidenceManyToManyAttribute object>[source]
export_relations_to_sbml(sbml_model, sbml)[source]

Add relationships to/from object to SBML species.

Parameters
  • sbml_model (libsbml.Model) – SBML model

  • sbml (libsbml.Species) – SBML species

export_to_sbml(sbml_model)[source]

Add this species to a SBML model.

Parameters

sbml_model (libsbml.Model) – SBML model

Returns

SBML species

Return type

libsbml.Species

gen_id()[source]

Generate identifier

Returns

identifier

Return type

str

static get(ids, species_iterator)[source]

Find some Species instances

Parameters
  • ids (Iterator of str) – an iterator over some species identifiers

  • species_iterator (Iterator) – an iterator over some species

Returns

each element of the list corresponds to an element

of ids and contains either a Species with id() equal to the element in ids, or None indicating that species_iterator does not contain a matching Species

Return type

list of Species or None

id = <obj_tables.core.StringAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
import_from_sbml(sbml)[source]

Load from SBML species

Parameters

sbml (libsbml.Species) – SBML species

import_relations_from_sbml(sbml, objs)[source]

Load relationships from SBML species

Parameters
  • sbml (libsbml.Species) – SBML species

  • objs (dict) – dictionary that maps WC-Lang types to dictionaries that map the ids of WC-Lang objects to WC-Lang objects

model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
classmethod parse_id(id)[source]
Parameters

id (str) – identifier

Returns

species type id str: compartment id

Return type

str

Raises

ValueError – if the id does not have the format {species.id}[{compartment.id}]

references = <obj_tables.core.ManyToManyAttribute object>[source]
species_type = <obj_tables.core.ManyToOneAttribute object>[source]
units = <obj_tables.sci.units.UnitAttribute object>[source]
validate()[source]

Check that the species is valid

  • Check if the identifier is equal to {species_type.id}[{compartment.id}]

Returns

None if the object is valid,

otherwise return a list of errors as an instance of InvalidObject

Return type

InvalidObject or None

class wc_lang.core.SpeciesCoefficient(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

A tuple of a species and a coefficient

species[source]

species

Type

Species

coefficient[source]

coefficient

Type

float

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('species', 'coefficient')[source]
attributes = {'coefficient': <obj_tables.core.FloatAttribute object>, 'species': <obj_tables.core.ManyToOneAttribute object>}[source]
child_attrs = {'sbml': ('species', 'coefficient'), 'wc_sim': ('species', 'coefficient')}[source]
children = {'core_model': ('species',), 'submodel': ('species',)}[source]
frozen_columns = 1[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.SpeciesCoefficient'>,)[source]
local_attributes = {'coefficient': <obj_tables.core.LocalAttribute object>, 'reactions': <obj_tables.core.LocalAttribute object>, 'species': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('species', 'coefficient')[source]
primary_attribute = None[source]
related_attributes = {'reactions': <wc_lang.core.ReactionParticipantAttribute object>}[source]
table_format = 3[source]
unique_together = (('coefficient', 'species'),)[source]
verbose_name = 'Species coefficient'[source]
verbose_name_plural = 'Species coefficients'[source]
coefficient = <obj_tables.core.FloatAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
serialize(show_compartment=True, show_coefficient_sign=True)[source]

Serialize related object

Parameters
  • show_compartment (bool, optional) – if true, show compartment

  • show_coefficient_sign (bool, optional) – if true, show coefficient sign

Returns

simple Python representation

Return type

str

species = <obj_tables.core.ManyToOneAttribute object>[source]
class wc_lang.core.SpeciesType(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

Species type

id[source]

unique identifier

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

structure[source]

structure (InChI for metabolites; sequence for DNA, RNA, proteins)

Type

ChemicalStructure

type[source]

type

Type

pronto.term.Term

identifiers[source]

identifiers

Type

list of Identifier

evidence[source]

observation that supports/disputes a conclusion

Type

list of Evidence

conclusions[source]

conclusions

Type

list of Conclusion

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

Related attributes:

  • species (list of Species): species

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('id', 'name', 'structure', 'type', 'identifiers', 'evidence', 'conclusions', 'comments', 'references')[source]
attributes = {'comments': <wc_lang.core.CommentAttribute object>, 'conclusions': <obj_tables.core.ManyToManyAttribute object>, 'evidence': <wc_lang.core.EvidenceManyToManyAttribute object>, 'id': <obj_tables.core.SlugAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'references': <obj_tables.core.ManyToManyAttribute object>, 'structure': <obj_tables.core.ManyToOneAttribute object>, 'type': <obj_tables.sci.onto.OntoTermAttribute object>}[source]
child_attrs = {'sbml': ('id', 'name', 'model', 'structure', 'type', 'identifiers', 'comments'), 'wc_sim': ('id', 'model', 'structure')}[source]
children = {'core_model': ('structure', 'species', 'identifiers', 'evidence', 'conclusions', 'references'), 'submodel': ('structure', 'identifiers', 'evidence', 'conclusions', 'references')}[source]
indexed_attrs_tuples = (('id',),)[source]
inheritance = (<class 'wc_lang.core.SpeciesType'>,)[source]
local_attributes = {'comments': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'evidence': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>, 'species': <obj_tables.core.LocalAttribute object>, 'structure': <obj_tables.core.LocalAttribute object>, 'type': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.SlugAttribute object>[source]
related_attributes = {'species': <obj_tables.core.ManyToOneAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Species type'[source]
verbose_name_plural = 'Species types'[source]
comments = <wc_lang.core.CommentAttribute object>[source]
conclusions = <obj_tables.core.ManyToManyAttribute object>[source]
evidence = <wc_lang.core.EvidenceManyToManyAttribute object>[source]
id = <obj_tables.core.SlugAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
references = <obj_tables.core.ManyToManyAttribute object>[source]
structure = <obj_tables.core.ManyToOneAttribute object>[source]
type = <obj_tables.sci.onto.OntoTermAttribute object>[source]
class wc_lang.core.StopCondition(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model

StopCondition: Simulation of a model terminates when one of its stop conditions is true.

A Boolean expression of Functions, Observbles, Parameters and Python functions. Stop conditions are optional.

id[source]

unique id

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

expression[source]

mathematical expression for a StopCondition

Type

StopConditionExpression

units[source]

units, which must be dimensionless

Type

unit_registry.Unit

identifiers[source]

identifiers

Type

list of Identifier

evidence[source]

observation that supports/disputes a conclusion

Type

list of Evidence

conclusions[source]

conclusions

Type

list of Conclusion

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

Related attributes:

  • expressions (Expressions): expressions

class Meta[source]

Bases: obj_tables.core.Meta, obj_tables.math.expression.ExpressionExpressionTermMeta

attribute_order = ('id', 'name', 'expression', 'units', 'identifiers', 'evidence', 'conclusions', 'comments', 'references')[source]
attributes = {'comments': <wc_lang.core.CommentAttribute object>, 'conclusions': <obj_tables.core.ManyToManyAttribute object>, 'evidence': <wc_lang.core.EvidenceManyToManyAttribute object>, 'expression': <obj_tables.math.expression.OneToOneExpressionAttribute object>, 'id': <obj_tables.core.SlugAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'references': <obj_tables.core.ManyToManyAttribute object>, 'units': <obj_tables.sci.units.UnitAttribute object>}[source]
child_attrs = {'sbml': (), 'wc_sim': ('id', 'model', 'expression', 'units')}[source]
children = {'core_model': ('expression', 'identifiers', 'evidence', 'conclusions', 'references'), 'submodel': ('expression', 'identifiers', 'evidence', 'conclusions', 'references')}[source]
expression_term_model[source]

alias of StopConditionExpression

expression_term_units = 'units'[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.StopCondition'>,)[source]
local_attributes = {'comments': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'evidence': <obj_tables.core.LocalAttribute object>, 'expression': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>, 'units': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.SlugAttribute object>[source]
related_attributes = {}[source]
unique_together = ()[source]
verbose_name = 'Stop condition'[source]
verbose_name_plural = 'Stop conditions'[source]
comments = <wc_lang.core.CommentAttribute object>[source]
conclusions = <obj_tables.core.ManyToManyAttribute object>[source]
evidence = <wc_lang.core.EvidenceManyToManyAttribute object>[source]
expression = <obj_tables.math.expression.OneToOneExpressionAttribute object>[source]
id = <obj_tables.core.SlugAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
references = <obj_tables.core.ManyToManyAttribute object>[source]
units = <obj_tables.sci.units.UnitAttribute object>[source]
validate()[source]

Check that the stop condition is valid

  • Check that expression has units units

Returns

None if the object is valid,

otherwise return a list of errors as an instance of InvalidObject

Return type

InvalidObject or None

class wc_lang.core.StopConditionExpression(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, obj_tables.math.expression.Expression

A mathematical expression of Functions, Observables, Parameters and Python functions

The expression used by a StopCondition.

expression[source]

mathematical expression for a StopCondition

Type

str

_parsed_expression[source]

an analyzed expression; not an obj_tables.Model

Type

ParsedExpression

species[source]

Species used by this stop condition expression

Type

list of Species

observables[source]

Observables used by this stop condition expression

Type

list of Observable

parameters[source]

Parameters used by this stop condition expression

Type

list of Parameter

functions[source]

Functions used by this stop condition expression

Type

list of Function

compartments[source]

Compartments used by this stop condition expression

Type

list of Compartment

Related attributes:

class Meta[source]

Bases: obj_tables.core.Meta, obj_tables.math.expression.Meta

attribute_order = ()[source]
attributes = {'compartments': <obj_tables.core.ManyToManyAttribute object>, 'expression': <obj_tables.core.LongStringAttribute object>, 'functions': <obj_tables.core.ManyToManyAttribute object>, 'observables': <obj_tables.core.ManyToManyAttribute object>, 'parameters': <obj_tables.core.ManyToManyAttribute object>, 'species': <obj_tables.core.ManyToManyAttribute object>}[source]
child_attrs = {'sbml': (), 'wc_sim': ('expression', 'parameters', 'species', 'observables', 'functions', 'compartments')}[source]
children = {'core_model': ('parameters', 'species', 'observables', 'functions', 'compartments'), 'submodel': ('parameters', 'species', 'observables', 'functions', 'compartments')}[source]
expression_term_models = ('Parameter', 'Species', 'Observable', 'Function', 'Compartment')[source]
expression_type[source]

alias of builtins.bool

expression_unit_registry = <pint.registry.UnitRegistry object>[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.StopConditionExpression'>,)[source]
local_attributes = {'compartments': <obj_tables.core.LocalAttribute object>, 'expression': <obj_tables.core.LocalAttribute object>, 'functions': <obj_tables.core.LocalAttribute object>, 'observables': <obj_tables.core.LocalAttribute object>, 'parameters': <obj_tables.core.LocalAttribute object>, 'species': <obj_tables.core.LocalAttribute object>, 'stop_condition': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('expression',)[source]
primary_attribute = <obj_tables.core.LongStringAttribute object>[source]
related_attributes = {'stop_condition': <obj_tables.math.expression.OneToOneExpressionAttribute object>}[source]
table_format = 3[source]
unique_together = ()[source]
verbose_name = 'Stop condition expression'[source]
verbose_name_plural = 'Stop condition expressions'[source]
compartments = <obj_tables.core.ManyToManyAttribute object>[source]
classmethod deserialize(value, objects)[source]

Deserialize value

Parameters
  • value (str) – String representation

  • objects (dict) – dictionary of objects, grouped by model

Returns

tuple of

cleaned value and cleaning error

Return type

tuple of StopConditionExpression, InvalidAttribute or None

expression = <obj_tables.core.LongStringAttribute object>[source]
functions = <obj_tables.core.ManyToManyAttribute object>[source]
merge_attrs(other, other_objs_in_self, self_objs_in_other)[source]

Merge attributes of two objects

Parameters
  • other (obj_tables.Model) – other model

  • other_objs_in_self (dict) – dictionary that maps instances of objects in another model to objects in a model

  • self_objs_in_other (dict) – dictionary that maps instances of objects in a model to objects in another model

objects = <obj_tables.core.Manager object>[source]
observables = <obj_tables.core.ManyToManyAttribute object>[source]
parameters = <obj_tables.core.ManyToManyAttribute object>[source]
serialize()[source]

Generate string representation

Returns

string representation

Return type

str

species = <obj_tables.core.ManyToManyAttribute object>[source]
validate()[source]

Check that the stop condition is valid

  • Check that the expression is a Boolean function

Returns

None if the object is valid,

otherwise return a list of errors as an instance of InvalidObject

Return type

InvalidObject or None

class wc_lang.core.Submodel(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

id[source]

unique identifier

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

framework[source]

modeling integration framework (e.g. SSA, ODE or dFBA)

Type

pronto.term.Term

identifiers[source]

identifiers

Type

list of Identifier

evidence[source]

observation that supports/disputes a conclusion

Type

list of Evidence

conclusions[source]

conclusions

Type

list of Conclusion

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

Related attributes:

  • reactions (list of Reaction): reactions

  • dfba_obj (DfbaObjective): objective function for a dFBA submodel; if not initialized, then dfba_obj_reactions is used as the objective function

  • dfba_obj_reactions (list of DfbaObjReaction): the growth reaction for a dFBA submodel

  • changes (list of Change): changes

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('id', 'name', 'framework', 'identifiers', 'evidence', 'conclusions', 'comments', 'references')[source]
attributes = {'comments': <wc_lang.core.CommentAttribute object>, 'conclusions': <obj_tables.core.ManyToManyAttribute object>, 'evidence': <wc_lang.core.EvidenceManyToManyAttribute object>, 'framework': <obj_tables.sci.onto.OntoTermAttribute object>, 'id': <obj_tables.core.SlugAttribute object>, 'identifiers': <wc_lang.core.IdentifierManyToManyAttribute object>, 'model': <obj_tables.core.ManyToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'references': <obj_tables.core.ManyToManyAttribute object>}[source]
child_attrs = {'sbml': ('id', 'name', 'model', 'framework', 'identifiers', 'comments'), 'wc_sim': ('id', 'model', 'framework')}[source]
children = {'submodel': ('model', 'reactions', 'dfba_obj', 'dfba_obj_reactions', 'identifiers', 'evidence', 'conclusions', 'references', 'changes')}[source]
indexed_attrs_tuples = (('id',),)[source]
inheritance = (<class 'wc_lang.core.Submodel'>,)[source]
local_attributes = {'changes': <obj_tables.core.LocalAttribute object>, 'comments': <obj_tables.core.LocalAttribute object>, 'conclusions': <obj_tables.core.LocalAttribute object>, 'dfba_obj': <obj_tables.core.LocalAttribute object>, 'dfba_obj_reactions': <obj_tables.core.LocalAttribute object>, 'evidence': <obj_tables.core.LocalAttribute object>, 'framework': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'reactions': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>}[source]
merge = 2[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.SlugAttribute object>[source]
related_attributes = {'changes': <obj_tables.core.ManyToOneAttribute object>, 'dfba_obj': <obj_tables.core.OneToOneAttribute object>, 'dfba_obj_reactions': <obj_tables.core.ManyToOneAttribute object>, 'reactions': <obj_tables.core.ManyToOneAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Submodel'[source]
verbose_name_plural = 'Submodels'[source]
comments = <wc_lang.core.CommentAttribute object>[source]
conclusions = <obj_tables.core.ManyToManyAttribute object>[source]
evidence = <wc_lang.core.EvidenceManyToManyAttribute object>[source]
export_relations_to_sbml(sbml_model, sbml)[source]

Add relationships to/from object to SBML model.

Parameters
  • sbml_model (libsbml.Model) – SBML model

  • sbml (libsbml.Model) – SBML model

export_to_sbml(sbml_model)[source]

Add metadata about the submodel to a SBML model.

Parameters

sbml_model (libsbml.Model) – SBML model

Returns

SBML model

Return type

libsbml.Model

framework = <obj_tables.sci.onto.OntoTermAttribute object>[source]
get_children(kind=None, _Submodel__type=None, recursive=True, _Submodel__include_stop_conditions=True, **kwargs)[source]

Get a kind of children.

If kind is None, children are defined to be the values of the related attributes defined in each class.

Parameters
  • kind (str, optional) – kind of children to get

  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • recursive (bool, optional) – if True, get children recursively

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs

Returns

children

Return type

list of Model

get_immediate_children(kind=None, _Submodel__type=None, _Submodel__include_stop_conditions=True, **kwargs)[source]

Get a kind of children.

If kind is None, children are defined to be the values of the related attributes defined in each class.

Parameters
  • kind (str, optional) – kind of children to get

  • __type (types.TypeType or tuple of types.TypeType) – subclass(es) of Model

  • kwargs (dict of str –> object) – dictionary of attribute name/value pairs

Returns

children

Return type

list of Model

id = <obj_tables.core.SlugAttribute object>[source]
identifiers = <wc_lang.core.IdentifierManyToManyAttribute object>[source]
import_from_sbml(sbml)[source]

Load from SBML model

Parameters

sbml (libsbml.Model) – SBML model

import_relations_from_sbml(sbml, objs)[source]

Load relationships from SBML model

Parameters
  • sbml (libsbml.Model) – SBML model

  • objs (dict) – dictionary that maps WC-Lang types to dictionaries that map the ids of WC-Lang objects to WC-Lang objects

model = <obj_tables.core.ManyToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
references = <obj_tables.core.ManyToManyAttribute object>[source]
validate()[source]

Determine if the submodel is valid

  • dFBA submodel has an objective

Returns

None if the object is valid,

otherwise return a list of errors as an instance of InvalidObject

Return type

InvalidObject or None

class wc_lang.core.SubmodelsToModelRelatedManager(object, attribute)[source]

Bases: obj_tables.core.ManyToOneRelatedManager

Submodels to model related manager

gen_models()[source]

Generate separate models for each submodel, as well as a “core” model which contains the model integration framework (compartments, species types, species, observables, functions, stop conditions, etc.) and all model objects that are not associated with at least 1 submodel.

Returns

model with objects that (a) form the model integration framework or (b) are

not associated with any submodel

list of Model: one model for each submodel

Return type

Model

class wc_lang.core.Taxon(_comments=None, **kwargs)[source]

Bases: obj_tables.core.Model, wc_lang.sbml.util.SbmlModelMixin

Biological taxon (e.g. family, genus, species, strain, etc.)

id[source]

unique identifier equal to ‘taxon’

Type

str

name[source]

name

Type

str

model[source]

model

Type

Model

rank[source]

rank

Type

TaxonRank

identifiers[source]

identifiers

Type

list of Identifier

comments[source]

comments

Type

str

references[source]

references

Type

list of Reference

class Meta[source]

Bases: obj_tables.core.Meta

attribute_order = ('id', 'name', 'rank', 'identifiers', 'comments', 'references')[source]
attributes = {'comments': <wc_lang.core.CommentAttribute object>, 'id': <obj_tables.core.RegexAttribute object>, 'identifiers': <wc_lang.core.IdentifierOneToManyAttribute object>, 'model': <obj_tables.core.OneToOneAttribute object>, 'name': <obj_tables.core.StringAttribute object>, 'rank': <obj_tables.core.EnumAttribute object>, 'references': <obj_tables.core.OneToManyAttribute object>}[source]
child_attrs = {'sbml': ('id', 'name', 'model', 'rank', 'identifiers', 'comments'), 'wc_sim': ()}[source]
children = {'core_model': ('identifiers', 'references'), 'submodel': ('identifiers', 'references')}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_lang.core.Taxon'>,)[source]
local_attributes = {'comments': <obj_tables.core.LocalAttribute object>, 'id': <obj_tables.core.LocalAttribute object>, 'identifiers': <obj_tables.core.LocalAttribute object>, 'model': <obj_tables.core.LocalAttribute object>, 'name': <obj_tables.core.LocalAttribute object>, 'rank': <obj_tables.core.LocalAttribute object>, 'references': <obj_tables.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_tables.core.RegexAttribute object>[source]
related_attributes = {}[source]
table_format = 2[source]
unique_together = ()[source]
verbose_name = 'Taxon'[source]
verbose_name_plural = 'Taxons'[source]
comments = <wc_lang.core.CommentAttribute object>[source]
id = <obj_tables.core.RegexAttribute object>[source]
identifiers = <wc_lang.core.IdentifierOneToManyAttribute object>[source]
model = <obj_tables.core.OneToOneAttribute object>[source]
name = <obj_tables.core.StringAttribute object>[source]
objects = <obj_tables.core.Manager object>[source]
rank = <obj_tables.core.EnumAttribute object>[source]
references = <obj_tables.core.OneToManyAttribute object>[source]
class wc_lang.core.TaxonRank[source]

Bases: int, enum.Enum

Taxonomic ranks

classis = 4[source]
domain = 1[source]
family = 6[source]
genus = 8[source]
kingdom = 2[source]
order = 5[source]
phylum = 3[source]
species = 9[source]
tribe = 7[source]
variety = 10[source]
class wc_lang.core.TaxonRankMeta[source]

Bases: wc_utils.util.enumerate.CaseInsensitiveEnumMeta

__getattr__(name)[source]

Get value by name

Parameters

name (str) – attribute name

Returns

taxonomic rank

Return type

TaxonRank

__getitem__(name)[source]

Get value by name

Parameters

name (str) – attribute name

Returns

taxonomic rank

Return type

TaxonRank

class wc_lang.core.Validator[source]

Bases: obj_tables.core.Validator

run(model, get_related=True)[source]

Validate a model and return its errors

Parameters
  • model (Model) – model

  • get_related (bool, optional) – if true, get all related objects

Returns

list of invalid objects/models and their errors

Return type

InvalidObjectSet or None

exception wc_lang.core.WcLangWarning[source]

Bases: UserWarning

WC-Lang warning

4.1.6. wc_lang.io module

Reading and writing models to/from files.

Supported file types:

  • Comma separated values (.csv)

  • Excel (.xlsx)

  • Tab separated values (.tsv)

Author

Jonathan Karr <karr@mssm.edu>

Author

Arthur Goldberg <Arthur.Goldberg@mssm.edu>

Date

2016-12-05

Copyright

2016, Karr Lab

License

MIT

class wc_lang.io.Reader[source]

Bases: obj_tables.io.Reader

Read model from file(s)

MODELS = (<class 'wc_lang.core.Model'>, <class 'wc_lang.core.Taxon'>, <class 'wc_lang.core.Environment'>, <class 'wc_lang.core.Submodel'>, <class 'wc_lang.core.Compartment'>, <class 'wc_lang.core.SpeciesType'>, <class 'wc_lang.core.Species'>, <class 'wc_lang.core.DistributionInitConcentration'>, <class 'wc_lang.core.Observable'>, <class 'wc_lang.core.Function'>, <class 'wc_lang.core.Reaction'>, <class 'wc_lang.core.RateLaw'>, <class 'wc_lang.core.DfbaObjective'>, <class 'wc_lang.core.DfbaObjReaction'>, <class 'wc_lang.core.DfbaObjSpecies'>, <class 'wc_lang.core.Parameter'>, <class 'wc_lang.core.StopCondition'>, <class 'wc_lang.core.Observation'>, <class 'wc_lang.core.ObservationSet'>, <class 'wc_lang.core.Conclusion'>, <class 'wc_lang.core.Reference'>, <class 'wc_lang.core.Author'>, <class 'wc_lang.core.Change'>)[source]
run(path, models=None, ignore_missing_models=None, ignore_extra_models=None, ignore_sheet_order=None, include_all_attributes=False, ignore_missing_attributes=None, ignore_extra_attributes=None, ignore_attribute_order=None, validate=None)[source]

Read a list of model objects from file(s) and, optionally, validate them

Parameters
  • path (str) – path to file(s)

  • models (types.TypeType or list of types.TypeType, optional) – type of object to read or list of types of objects to read

  • ignore_missing_models (bool, optional) – if False, report an error if a worksheet/ file is missing for one or more models

  • ignore_extra_models (bool, optional) – if True and all models are found, ignore other worksheets or files

  • ignore_sheet_order (bool, optional) – if True, do not require the sheets to be provided in the canonical order

  • include_all_attributes (bool, optional) – if True, export all attributes including those not explictly included in Model.Meta.attribute_order

  • ignore_missing_attributes (bool, optional) – if False, report an error if a worksheet/file doesn’t contain all of attributes in a model in models

  • ignore_extra_attributes (bool, optional) – if True, do not report errors if attributes in the data are not in the model

  • ignore_attribute_order (bool) – if True, do not require the attributes to be provided in the canonical order

  • validate (bool, optional) – if True, validate the data

Returns

model objects grouped by obj_tables.Model class

Return type

dict

Raises

ValueError – if the file defines zero or multiple models or the model defined in the file(s) is invalid

class wc_lang.io.Writer[source]

Bases: obj_tables.io.Writer

Write model to file(s)

MODELS = (<class 'wc_lang.core.Model'>, <class 'wc_lang.core.Taxon'>, <class 'wc_lang.core.Environment'>, <class 'wc_lang.core.Submodel'>, <class 'wc_lang.core.Compartment'>, <class 'wc_lang.core.SpeciesType'>, <class 'wc_lang.core.Species'>, <class 'wc_lang.core.DistributionInitConcentration'>, <class 'wc_lang.core.Observable'>, <class 'wc_lang.core.Function'>, <class 'wc_lang.core.Reaction'>, <class 'wc_lang.core.RateLaw'>, <class 'wc_lang.core.DfbaObjective'>, <class 'wc_lang.core.DfbaObjReaction'>, <class 'wc_lang.core.DfbaObjSpecies'>, <class 'wc_lang.core.Parameter'>, <class 'wc_lang.core.StopCondition'>, <class 'wc_lang.core.Observation'>, <class 'wc_lang.core.ObservationSet'>, <class 'wc_lang.core.Conclusion'>, <class 'wc_lang.core.Reference'>, <class 'wc_lang.core.Author'>, <class 'wc_lang.core.Change'>)[source]
run(path, model, models=None, get_related=True, include_all_attributes=False, validate=None, title=None, description=None, keywords=None, version=None, language=None, creator=None, write_schema=False, write_toc=True, extra_entries=0, data_repo_metadata=False, schema_package=None, protected=True)[source]
Write a list of model classes to an Excel file, with one worksheet for each model, or to

a set of .csv or .tsv files, with one file for each model.

Parameters
  • path (str) – path to write file(s)

  • model (type) – a wc_lang Model that’s a subclass of obj_tables.Model

  • models (list of Model, optional) – models in the order that they should appear as worksheets; all models which are not in models will follow in alphabetical order

  • get_related (bool, optional) – if True, write object and all related objects

  • include_all_attributes (bool, optional) – if True, export all attributes including those not explictly included in Model.Meta.attribute_order

  • validate (bool, optional) – if True, validate the data

  • title (str, optional) – title

  • description (str, optional) – description

  • keywords (str, optional) – keywords

  • version (str, optional) – version

  • language (str, optional) – language

  • creator (str, optional) – creator

  • write_schema (bool, optional) – if True, include additional worksheet with schema

  • write_toc (bool, optional) – if True, include additional worksheet with table of contents

  • extra_entries (int, optional) – additional entries to display

  • data_repo_metadata (bool, optional) – if True, try to write metadata information about the file’s Git repo; the repo must be current with origin, except for the file

  • schema_package (str, optional) – the package which defines the obj_tables schema used by the file; if not None, try to write metadata information about the the schema’s Git repository: the repo must be current with origin

  • protected (bool, optional) – if True, protect the worksheet

classmethod validate_implicit_relationships(root_model)[source]
Check that relationships to root_model do not need to be explicitly exported because

they can be inferred by Reader.run. This is necessary to enable the relationships to root_model to not be exported in workbooks, and instead added by Reader.run.

Raises

Exception – if there are relationships from core.Model or one-to-many or many-to-many relationships to root_model

validate_implicit_relationships_are_set(model, root_model)[source]

Check that there is only one instance of root_model and that each relationship to root_model is set. This is necessary to enable the relationships to root_model to not be exported in workbooks, and instead added by Reader.run.

Parameters
  • model (obj_tables.Model) – the root model instance

  • root_model (type) – the type of model, a subclass of obj_tables.Model

Raises

ValueError – if there are multiple instances of root_model in the object graph

wc_lang.io.convert(source, destination, protected=True)[source]

Convert among Excel (.xlsx), comma separated (.csv), and tab separated (.tsv) file formats

Read a model from the source files(s) and write it to the destination files(s). A path to a delimiter separated set of models must be represented by a Unix glob pattern (with a *) that matches all delimiter separated files.

Parameters
  • source (str) – path to source file(s)

  • destination (str) – path to save converted file

  • protected (bool, optional) – if True, protect the worksheet

wc_lang.io.create_template(path, write_schema=False, write_toc=True, extra_entries=10, data_repo_metadata=True, protected=True)[source]

Create file with model template, including row and column headings

Parameters
  • path (str) – path to file(s)

  • write_schema (bool, optional) – if True, include additional worksheet with schema

  • write_toc (bool, optional) – if True, include additional worksheet with table of contents

  • extra_entries (int, optional) – additional entries to display

  • data_repo_metadata (bool, optional) – if True, try to write metadata information about the file’s Git repo

  • protected (bool, optional) – if True, protect the worksheet

wc_lang.io.get_root_model(models)[source]

Get a root model class from an iterator over obj_tables.Model classes

The root model is obtained by name, rather than from core.Model, because models may have been obtained from obj_tables migration, which loads other versions of wc_lang.core in private imports.

Parameters

models (iterator) – subclasses of obj_tables.Model being read or written

Returns

a subclass of obj_tables.Model whose name is root_model_name

Return type

type

4.1.7. wc_lang.util module

Utilities

Author

Jonathan Karr <karr@mssm.edu>

Date

2016-11-10

Copyright

2016, Karr Lab

License

MIT

wc_lang.util.gen_ids(model)[source]

Generate ids for model objects

Parameters

model (core.Model) – model

wc_lang.util.get_model_size(model)[source]

Get numbers of model components

Parameters

model (core.Model) – model

Returns

dictionary with numbers of each type of model component

Return type

dict

wc_lang.util.get_model_summary(model)[source]

Get textual summary of a model

Parameters

model (core.Model) – model

Returns

textual summary of the model

Return type

str

wc_lang.util.get_models(inline=True)[source]

Get list of models :param inline: if true, return inline models :type inline: bool, optional

Returns

list of models

Return type

list of class

4.1.8. Module contents