2.1. wc_kb package

2.1.2. Submodules

2.1.3. wc_kb.__main__ module

Command line programs for managing knowledge bases for whole-cell models

Author:Jonathan Karr <karr@mssm.edu>
Date:2018-04-20
Copyright:2018, Karr Lab
License:MIT
class wc_kb.__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_kb.__main__.BaseController'>, <class 'wc_kb.__main__.ValidateController'>, <class 'wc_kb.__main__.DifferenceController'>, <class 'wc_kb.__main__.NormalizeController'>, <class 'wc_kb.__main__.ConvertController'>, <class 'wc_kb.__main__.CreateTemplateController'>, <class 'wc_kb.__main__.UpdateVersionMetadataController'>][source]
label = 'wc-kb'[source]
class wc_kb.__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 programs for managing knowledge bases for whole-cell models'[source]
help = 'Command line programs for managing knowledge bases for whole-cell models'[source]
label = 'base'[source]
class wc_kb.__main__.ConvertController(*args, **kw)[source]

Bases: cement.ext.ext_argparse.ArgparseController

Convert knowledge base 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_core'], {'type': <class 'str'>, 'help': 'Path to core of the knowledge base'}), (['source_seq'], {'type': <class 'str'>, 'help': 'Path to FASTA-formatted genome sqeuence of the knowledge base'}), (['dest_core'], {'type': <class 'str'>, 'help': 'Path to save the converted core of the knowledge base'}), (['dest_seq'], {'type': <class 'str'>, 'help': 'Path to save the converted FASTA-formatted genome sequence of the knowledge base'})][source]
description = 'Convert knowledge base among .csv, .json, .tsv, .xlsx, .yaml, and .yml formats'[source]
help = 'Convert knowledge base among .csv, .json, .tsv, .xlsx, .yaml, and .yml formats'[source]
label = 'convert'[source]
stacked_on = 'base'[source]
stacked_type = 'nested'[source]
class wc_kb.__main__.CreateTemplateController(*args, **kw)[source]

Bases: cement.ext.ext_argparse.ArgparseController

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

class Meta[source]

Bases: object

arguments = [(['path_core'], {'metavar': 'path-core', 'type': <class 'str'>, 'help': 'Path to save a template of the core of a knowledge base'}), (['path_seq'], {'metavar': 'path-seq', 'type': <class 'str'>, 'help': 'Path to save a template of the genome sequence of a knowledge base'}), (['--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 Git repo containing `path-core`'})][source]
description = 'Create file with knowledge base template: blank file(s) with row and column labels'[source]
help = 'Create file with knowledge base template: blank file(s) with row and column labels'[source]
label = 'create-template'[source]
stacked_on = 'base'[source]
stacked_type = 'nested'[source]
class wc_kb.__main__.DifferenceController(*args, **kw)[source]

Bases: cement.ext.ext_argparse.ArgparseController

Display difference between two knowledge bases

class Meta[source]

Bases: object

arguments = [(['core_path_1'], {'type': <class 'str'>, 'help': 'Path to core for first knowledge base'}), (['seq_path_1'], {'type': <class 'str'>, 'help': 'Path to FASTA-formatted genome sequence for first knowledge base'}), (['core_path_2'], {'type': <class 'str'>, 'help': 'Path to core for second knowledge base'}), (['seq_path_2'], {'type': <class 'str'>, 'help': 'Path to FASTA-formatted genome sequence for second knowledge base'}), (['--compare-files'], {'dest': 'compare_files', 'default': False, 'action': 'store_true', 'help': 'If true, compare knowledge bases; otherwise compare files directly'})][source]
description = 'Get difference between two knowledge bases'[source]
help = 'Get difference between two knowledge bases'[source]
label = 'difference'[source]
stacked_on = 'base'[source]
stacked_type = 'nested'[source]
class wc_kb.__main__.NormalizeController(*args, **kw)[source]

Bases: cement.ext.ext_argparse.ArgparseController

Normalize knowledge base

class Meta[source]

Bases: object

arguments = [(['source_core'], {'type': <class 'str'>, 'help': 'Path to core of the knowledge base'}), (['source_seq'], {'type': <class 'str'>, 'help': 'Path to FASTA-formatted genome sequence for the knowledge base'}), (['--dest-core'], {'default': '', 'type': <class 'str'>, 'help': 'Path to save normalized core of the knowledge base'}), (['--dest-seq'], {'default': '', 'type': <class 'str'>, 'help': 'Path to save normalized FASTA-formatted genome sequence for the knowledge base'})][source]
description = 'Normalize knowledge base'[source]
help = 'Normalize knowledge base'[source]
label = 'normalize'[source]
stacked_on = 'base'[source]
stacked_type = 'nested'[source]
class wc_kb.__main__.UpdateVersionMetadataController(*args, **kw)[source]

Bases: cement.ext.ext_argparse.ArgparseController

Update version metadata of a knowledge base (URL, branch, revision, wc_kb version)

class Meta[source]

Bases: object

arguments = [(['path_core'], {'type': <class 'str'>, 'help': 'Path to the core of the knowledge base'}), (['path_seq'], {'type': <class 'str'>, 'help': 'Path to the FASTA-formatted genome sequence of a knowledge base'}), (['--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 Git repo containing `path-core`'})][source]
description = 'Update version metadata of a knowledge base (URL, branch, revision, wc_kb version)'[source]
help = 'Update version metadata of a knowledge base (URL, branch, revision, wc_kb version)'[source]
label = 'update-version-metadata'[source]
stacked_on = 'base'[source]
stacked_type = 'nested'[source]
class wc_kb.__main__.ValidateController(*args, **kw)[source]

Bases: cement.ext.ext_argparse.ArgparseController

Validate knowledge base and display errors

class Meta[source]

Bases: object

arguments = [(['core_path'], {'type': <class 'str'>, 'help': 'Path to knowledge base core'}), (['seq_path'], {'type': <class 'str'>, 'help': 'Path to FASTA-formatted genome sequence'})][source]
description = 'Validate knowledge base and display errors'[source]
help = 'Validate knowledge base and display errors'[source]
label = 'validate'[source]
stacked_on = 'base'[source]
stacked_type = 'nested'[source]
wc_kb.__main__.main()[source]

2.1.4. wc_kb.core module

Core schema to represent a knowledge base to build models

Author:Balazs Szigeti <balazs.szigeti@mssm.edu>
Author:Jonathan Karr <karr@mssm.edu>
Author:Bilal Shaikh <bilal.shaikh@columbia.edu>
Author:Arthur Goldberg <Arthur.Goldberg@mssm.edu>
Author:Yin Hoon Chew <yinhoon.chew@mssm.edu>
Date:2018-02-07
Copyright:2018, Karr Lab
License:MIT
class wc_kb.core.Cell(**kwargs)[source]

Bases: wc_kb.core.KnowledgeBaseObject

Knowledge of a cell

knowledge_base[source]

knowledge base

Type:KnowledgeBase
taxon[source]

NCBI taxon identifier

Type:int
Related attributes:
references (list of Reference): references compartments (list of Compartment): compartments species_types (list of SpeciesType): species types concentrations (list of Concentration): concentrations observables (list or Observable) : observables loci (list of PolymerLocus): locus reactions (list of Reaction): reactions
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'taxon', 'comments')[source]
attributes = {'comments': <obj_model.core.LongStringAttribute object>, 'id': <obj_model.core.StringAttribute object>, 'knowledge_base': <obj_model.core.OneToOneAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>, 'taxon': <obj_model.core.IntegerAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.Cell'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'comments': <obj_model.core.LocalAttribute object>, 'compartments': <obj_model.core.LocalAttribute object>, 'concentrations': <obj_model.core.LocalAttribute object>, 'evidence': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'knowledge_base': <obj_model.core.LocalAttribute object>, 'loci': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'observables': <obj_model.core.LocalAttribute object>, 'parameters': <obj_model.core.LocalAttribute object>, 'reactions': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'species_types': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'taxon': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.StringAttribute object>[source]
related_attributes = {'compartments': <obj_model.core.ManyToOneAttribute object>, 'concentrations': <obj_model.core.ManyToOneAttribute object>, 'evidence': <obj_model.core.ManyToOneAttribute object>, 'loci': <obj_model.core.ManyToOneAttribute object>, 'observables': <obj_model.core.ManyToOneAttribute object>, 'parameters': <obj_model.core.ManyToOneAttribute object>, 'reactions': <obj_model.core.ManyToOneAttribute object>, 'references': <obj_model.core.ManyToOneAttribute object>, 'species_types': <obj_model.core.ManyToOneAttribute object>}[source]
tabular_orientation = 2[source]
unique_together = ()[source]
verbose_name = 'Cell'[source]
verbose_name_plural = 'Cells'[source]
knowledge_base = <obj_model.core.OneToOneAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
taxon = <obj_model.core.IntegerAttribute object>[source]
class wc_kb.core.ChromosomeFeature(**kwargs)[source]

Bases: wc_kb.core.PolymerLocus

Knowledge of chromosome features

cell[source]

cell

Type:Cell
value[source]

value

Type:float
error[source]

measurement error

Type:float
units[source]

units of value

Type:unit_registry.Unit
references[source]

references

Type:list of Reference
identifiers[source]

identifiers

Type:list of Identifier
Related attributes:
seq_path (str): path to sequence fasta file ploidy (int): ploidy
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'type', 'polymer', 'start', 'end', 'intensity', 'unit', 'evidence', 'identifiers', 'references', 'comments')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'coordinate': <obj_model.core.IntegerAttribute object>, 'end': <obj_model.core.IntegerAttribute object>, 'evidence': <obj_model.core.OneToManyAttribute object>, 'id': <obj_model.core.StringAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'intensity': <obj_model.core.FloatAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'polymer': <obj_model.core.ManyToOneAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'start': <obj_model.core.IntegerAttribute object>, 'strand': <obj_model.core.EnumAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>, 'type': <obj_model.ontology.OntologyAttribute object>, 'unit': <obj_model.units.UnitAttribute object>}[source]
expression_term_token_pattern = (1,)[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.ChromosomeFeature'>, <class 'wc_kb.core.PolymerLocus'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'coordinate': <obj_model.core.LocalAttribute object>, 'end': <obj_model.core.LocalAttribute object>, 'evidence': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'intensity': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'polymer': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'start': <obj_model.core.LocalAttribute object>, 'strand': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'type': <obj_model.core.LocalAttribute object>, 'unit': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.StringAttribute object>[source]
related_attributes = {}[source]
unique_together = ()[source]
verbose_name = 'Chromosome feature'[source]
verbose_name_plural = 'Chromosome features'[source]
coordinate = <obj_model.core.IntegerAttribute object>[source]
end = <obj_model.core.IntegerAttribute object>[source]
evidence = <obj_model.core.OneToManyAttribute object>[source]
get_direction()[source]

Returns the direction of chromosome feature

Returns:direction (in [‘forward’, ‘reverse’])
Return type:PolymerDirection
identifiers = <wc_kb.core.IdentifierAttribute object>[source]
intensity = <obj_model.core.FloatAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
polymer = <obj_model.core.ManyToOneAttribute object>[source]
references = <obj_model.core.ManyToManyAttribute object>[source]
start = <obj_model.core.IntegerAttribute object>[source]
type = <obj_model.ontology.OntologyAttribute object>[source]
unit = <obj_model.units.UnitAttribute object>[source]
class wc_kb.core.Compartment(**kwargs)[source]

Bases: wc_kb.core.KnowledgeBaseObject

Knowledge of a subcellular compartment

cell[source]

cell

Type:Cell
volumetric_fraction[source]

average volumetric fraction relative to the cell volume

Type:float
references[source]

references

Type:list of Reference
identifiers[source]

identifiers

Type:list of Identifier
Related attributes:
reaction_participants (list of ReactionParticipant): reaction participants
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'volumetric_fraction', 'identifiers', 'references', 'comments')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'id': <obj_model.core.SlugAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>, 'volumetric_fraction': <obj_model.core.FloatAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.Compartment'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'species': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'volumetric_fraction': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.SlugAttribute object>[source]
related_attributes = {'species': <obj_model.core.ManyToOneAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Compartment'[source]
verbose_name_plural = 'Compartments'[source]
cell = <obj_model.core.ManyToOneAttribute object>[source]
id = <obj_model.core.SlugAttribute object>[source]
identifiers = <wc_kb.core.IdentifierAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
references = <obj_model.core.ManyToManyAttribute object>[source]
volumetric_fraction = <obj_model.core.FloatAttribute object>[source]
class wc_kb.core.ComplexSpeciesType(**kwargs)[source]

Bases: wc_kb.core.SpeciesType

Knowledge of a protein complex

formation_process[source]

type of formation process

Type:pronto
subunits[source]

subunits

Type:list of SpeciesTypeCoefficient
type[source]

type of complex formation

Type:pronto
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'synonyms', 'type', 'formation_process', 'subunits', 'identifiers', 'references', 'comments')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'formation_process': <obj_model.ontology.OntologyAttribute object>, 'id': <obj_model.core.SlugAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'subunits': <wc_kb.core.SubunitAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>, 'type': <obj_model.ontology.OntologyAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.ComplexSpeciesType'>, <class 'wc_kb.core.SpeciesType'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'formation_process': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'properties': <obj_model.core.LocalAttribute object>, 'reactions': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'species': <obj_model.core.LocalAttribute object>, 'species_type_coefficients': <obj_model.core.LocalAttribute object>, 'subunits': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'type': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.SlugAttribute object>[source]
related_attributes = {'properties': <obj_model.core.ManyToOneAttribute object>, 'reactions': <obj_model.core.ManyToManyAttribute object>, 'species': <obj_model.core.ManyToOneAttribute object>, 'species_type_coefficients': <obj_model.core.ManyToOneAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Complex'[source]
verbose_name_plural = 'Complexes'[source]
formation_process = <obj_model.ontology.OntologyAttribute object>[source]
get_charge()[source]

Get the charge at physiological pH

Returns:charge
Return type:int
get_empirical_formula()[source]

Get the empirical formula

Returns:empirical formula
Return type:chem.EmpiricalFormula
get_mol_wt()[source]

Get the molecular weight

Returns:molecular weight
Return type:float
objects = <obj_model.core.Manager object>[source]
subunits = <wc_kb.core.SubunitAttribute object>[source]
type = <obj_model.ontology.OntologyAttribute object>[source]
class wc_kb.core.Concentration(**kwargs)[source]

Bases: wc_kb.core.KnowledgeBaseObject

Species concentration

cell[source]

cell

Type:Cell
species[source]

species

Type:Species
medium[source]

medium

Type:str
value[source]

value

Type:float
units[source]

units; default units is ‘M’

Type:unit_registry.Unit
evidence[source]

evidence

Type:list of Evidence
comments[source]

comments

Type:str
references[source]

references

Type:list of Reference
identifiers[source]

identifiers

Type:list of Identifier
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'species', 'value', 'units', 'evidence', 'identifiers', 'references', 'comments')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'evidence': <obj_model.core.OneToManyAttribute object>, 'id': <obj_model.core.StringAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'medium': <obj_model.core.StringAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'species': <wc_kb.core.OneToOneSpeciesAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>, 'units': <obj_model.units.UnitAttribute object>, 'value': <obj_model.core.FloatAttribute object>}[source]
frozen_columns = 1[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.Concentration'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'evidence': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'medium': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'species': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'units': <obj_model.core.LocalAttribute object>, 'value': <obj_model.core.LocalAttribute object>}[source]
ordering = ('species',)[source]
primary_attribute = <obj_model.core.StringAttribute object>[source]
related_attributes = {}[source]
unique_together = (('species',),)[source]
verbose_name = 'Concentration'[source]
verbose_name_plural = 'Concentrations'[source]
cell = <obj_model.core.ManyToOneAttribute object>[source]
evidence = <obj_model.core.OneToManyAttribute object>[source]
identifiers = <wc_kb.core.IdentifierAttribute object>[source]
medium = <obj_model.core.StringAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
references = <obj_model.core.ManyToManyAttribute object>[source]
serialize()[source]

Generate string representation :returns: value of primary attribute :rtype: str

species = <wc_kb.core.OneToOneSpeciesAttribute object>[source]
units = <obj_model.units.UnitAttribute object>[source]
value = <obj_model.core.FloatAttribute object>[source]
class wc_kb.core.DnaSpeciesType(**kwargs)[source]

Bases: wc_kb.core.PolymerSpeciesType

Knowledge of a DNA species

seq_path[source]

path to sequence fasta file

Type:str
ploidy[source]

ploidy

Type:int
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'sequence_path', 'circular', 'double_stranded', 'ploidy', 'identifiers', 'references', 'comments')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'circular': <obj_model.core.BooleanAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'double_stranded': <obj_model.core.BooleanAttribute object>, 'id': <obj_model.core.SlugAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'ploidy': <obj_model.core.IntegerAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'sequence_path': <obj_model.core.StringAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.DnaSpeciesType'>, <class 'wc_kb.core.PolymerSpeciesType'>, <class 'wc_kb.core.SpeciesType'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'chromosome_features': <obj_model.core.LocalAttribute object>, 'circular': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'double_stranded': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'loci': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'ploidy': <obj_model.core.LocalAttribute object>, 'properties': <obj_model.core.LocalAttribute object>, 'reactions': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'sequence_path': <obj_model.core.LocalAttribute object>, 'species': <obj_model.core.LocalAttribute object>, 'species_type_coefficients': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.SlugAttribute object>[source]
related_attributes = {'chromosome_features': <obj_model.core.ManyToOneAttribute object>, 'loci': <obj_model.core.ManyToOneAttribute object>, 'properties': <obj_model.core.ManyToOneAttribute object>, 'reactions': <obj_model.core.ManyToManyAttribute object>, 'species': <obj_model.core.ManyToOneAttribute object>, 'species_type_coefficients': <obj_model.core.ManyToOneAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Chromosome'[source]
verbose_name_plural = 'Chromosomes'[source]
get_charge()[source]

Get the charge for a DNA molecule with

  • 5’ monophosphate (for linear molecules)

  • Deprotonated phosphate oxygens

  • Linear DNA

    \(-L - 1\)

  • Circular DNA

    \(-L\)

Returns:charge
Return type:int
get_empirical_formula()[source]

Get the empirical formula for a DNA molecule with

  • 5’ monophosphate (for linear molecules)

  • Deprotonated phosphate oxygens

  • Linear DNA

    \(N_A * dAMP + N_C * dCMP + N_G * dGMP + N_T * dTMP - (L - 1) * OH\)

  • Circular DNA

    \(N_A * dAMP + N_C * dCMP + N_G * dGMP + N_T * dTMP - L * OH\)

N’s in the sequence will be distributed into the four bases by preserving the original ratio

Returns:empirical formula
Return type:chem.EmpiricalFormula
get_mol_wt()[source]

Get the molecular weight for a DNA molecule with

  • 5’ monophosphate (for linear molecules)

  • Deprotonated phosphate oxygens

  • Linear DNA

    \(N_A * MW_{dAMP} + N_C * MW_{dCMP} + N_G * MW_{dGMP} + N_T * MW_{dTMP} - (L - 1) * MW_{OH}\)

  • Circular DNA

    \(N_A * MW_{dAMP} + N_C * MW_{dCMP} + N_G * MW_{dGMP} + N_T * MW_{dTMP} - L * MW_{OH}\)

Returns:molecular weight
Return type:float
get_seq(start=None, end=None)[source]

Get the sequence

Parameters:
  • start (int, optional) – start coordinate of the queried subsequence, default is the start of the full sequence
  • end (int, optional) – end coordinate of the queried subsequence, default is the end of the full sequence
Returns:

structure

Return type:

Bio.Seq.Seq

objects = <obj_model.core.Manager object>[source]
ploidy = <obj_model.core.IntegerAttribute object>[source]
sequence_path = <obj_model.core.StringAttribute object>[source]
class wc_kb.core.Evidence(**kwargs)[source]

Bases: wc_kb.core.KnowledgeBaseObject

Represents the measurement / observation of a property

id[source]

identifier

Type:str
cell[source]

cell

Type:Cell
object[source]

object

Type:str
property[source]

property

Type:str
value[source]

value

Type:float
units[source]

units

Type:Units
identifiers[source]

identifiers

Type:list of Identifier
references[source]

references

Type:list of Reference
experiment[source]

experiment

Type:Experiment
comments[source]

comments

Type:str

Related attributes:

class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'cell', 'object', 'property', 'value', 'units', 'experiment', 'identifiers', 'references', 'comments')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'experiment': <obj_model.core.ManyToOneAttribute object>, 'id': <obj_model.core.StringAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'object': <obj_model.core.StringAttribute object>, 'property': <obj_model.core.StringAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>, 'units': <obj_model.units.UnitAttribute object>, 'value': <obj_model.core.FloatAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.Evidence'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'chromosome_features': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'concentrations': <obj_model.core.LocalAttribute object>, 'experiment': <obj_model.core.LocalAttribute object>, 'genes': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'object': <obj_model.core.LocalAttribute object>, 'parameters': <obj_model.core.LocalAttribute object>, 'properties': <obj_model.core.LocalAttribute object>, 'property': <obj_model.core.LocalAttribute object>, 'reactions': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'units': <obj_model.core.LocalAttribute object>, 'value': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.StringAttribute object>[source]
related_attributes = {'chromosome_features': <obj_model.core.OneToManyAttribute object>, 'concentrations': <obj_model.core.OneToManyAttribute object>, 'genes': <obj_model.core.OneToManyAttribute object>, 'parameters': <obj_model.core.OneToManyAttribute object>, 'properties': <obj_model.core.OneToManyAttribute object>, 'reactions': <obj_model.core.OneToManyAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Evidence'[source]
verbose_name_plural = 'Evidences'[source]
cell = <obj_model.core.ManyToOneAttribute object>[source]
comments = <obj_model.core.LongStringAttribute object>[source]
experiment = <obj_model.core.ManyToOneAttribute object>[source]
identifiers = <wc_kb.core.IdentifierAttribute object>[source]
object = <obj_model.core.StringAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
property = <obj_model.core.StringAttribute object>[source]
references = <obj_model.core.ManyToManyAttribute object>[source]
units = <obj_model.units.UnitAttribute object>[source]
value = <obj_model.core.FloatAttribute object>[source]
class wc_kb.core.Experiment(**kwargs)[source]

Bases: wc_kb.core.KnowledgeBaseObject

Represents an experiment in which a property was measured

id[source]

identifier

Type:str
species[source]

species

Type:str
genetic_variant[source]

genetic_variant

Type:str
external_media[source]

external_media

Type:str
temperature[source]

temperature

Type:float
temperature_units[source]

temperature_units

Type:Units
ph[source]

pH

Type:float
experiment_design[source]

experimental design

Type:str
measurement_technology[source]

measurement technology

Type:str
analysis_type[source]

analysis type

Type:str
identifiers[source]

identifiers

Type:list of Identifier
references[source]

references

Type:list of Reference
comments[source]

comments

Type:str

Related attributes:

class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'experiment_design', 'measurement_technology', 'analysis_type', 'species', 'genetic_variant', 'external_media', 'temperature', 'temperature_units', 'ph', 'identifiers', 'references', 'comments')[source]
attributes = {'analysis_type': <obj_model.core.StringAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'experiment_design': <obj_model.core.StringAttribute object>, 'external_media': <obj_model.core.StringAttribute object>, 'genetic_variant': <obj_model.core.StringAttribute object>, 'id': <obj_model.core.StringAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'measurement_technology': <obj_model.core.StringAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'ph': <obj_model.core.FloatAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'species': <obj_model.core.StringAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>, 'temperature': <obj_model.core.FloatAttribute object>, 'temperature_units': <obj_model.units.UnitAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.Experiment'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'analysis_type': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'evidence': <obj_model.core.LocalAttribute object>, 'experiment_design': <obj_model.core.LocalAttribute object>, 'external_media': <obj_model.core.LocalAttribute object>, 'genetic_variant': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'measurement_technology': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'ph': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'species': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'temperature': <obj_model.core.LocalAttribute object>, 'temperature_units': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.StringAttribute object>[source]
related_attributes = {'evidence': <obj_model.core.ManyToOneAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Experiment'[source]
verbose_name_plural = 'Experiments'[source]
analysis_type = <obj_model.core.StringAttribute object>[source]
comments = <obj_model.core.LongStringAttribute object>[source]
experiment_design = <obj_model.core.StringAttribute object>[source]
external_media = <obj_model.core.StringAttribute object>[source]
genetic_variant = <obj_model.core.StringAttribute object>[source]
identifiers = <wc_kb.core.IdentifierAttribute object>[source]
measurement_technology = <obj_model.core.StringAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
ph = <obj_model.core.FloatAttribute object>[source]
references = <obj_model.core.ManyToManyAttribute object>[source]
species = <obj_model.core.StringAttribute object>[source]
temperature = <obj_model.core.FloatAttribute object>[source]
temperature_units = <obj_model.units.UnitAttribute object>[source]
class wc_kb.core.Identifier(**kwargs)[source]

Bases: obj_model.core.Model

Reference to an entity in an external namespace

namespace[source]

namespace

Type:str
id[source]

identifier within the namespace

Type:str
Related attributes:
compartments (list of Compartment): compartments species_types (list of SpeciesType): species_types concentrations (list of Concentration): concentrations loci (list of PolymerLocus): loci properties (list of SpeciesTypeProperty): species type properties reactions (list of Reaction): reactions rate_laws (list of RateLaw): rate_laws observables (list of Observable): observables
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('namespace', 'id')[source]
attributes = {'id': <obj_model.core.RegexAttribute object>, 'namespace': <obj_model.core.RegexAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.Identifier'>,)[source]
local_attributes = {'chromosome_features': <obj_model.core.LocalAttribute object>, 'compartments': <obj_model.core.LocalAttribute object>, 'concentrations': <obj_model.core.LocalAttribute object>, 'evidence': <obj_model.core.LocalAttribute object>, 'experiments': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'loci': <obj_model.core.LocalAttribute object>, 'namespace': <obj_model.core.LocalAttribute object>, 'observables': <obj_model.core.LocalAttribute object>, 'parameters': <obj_model.core.LocalAttribute object>, 'properties': <obj_model.core.LocalAttribute object>, 'rate_laws': <obj_model.core.LocalAttribute object>, 'reactions': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'regulatory_modules': <obj_model.core.LocalAttribute object>, 'species_types': <obj_model.core.LocalAttribute object>}[source]
ordering = ('namespace', 'id')[source]
primary_attribute = None[source]
related_attributes = {'chromosome_features': <wc_kb.core.IdentifierAttribute object>, 'compartments': <wc_kb.core.IdentifierAttribute object>, 'concentrations': <wc_kb.core.IdentifierAttribute object>, 'evidence': <wc_kb.core.IdentifierAttribute object>, 'experiments': <wc_kb.core.IdentifierAttribute object>, 'loci': <wc_kb.core.IdentifierAttribute object>, 'observables': <wc_kb.core.IdentifierAttribute object>, 'parameters': <wc_kb.core.IdentifierAttribute object>, 'properties': <wc_kb.core.IdentifierAttribute object>, 'rate_laws': <wc_kb.core.IdentifierAttribute object>, 'reactions': <wc_kb.core.IdentifierAttribute object>, 'references': <wc_kb.core.IdentifierAttribute object>, 'regulatory_modules': <wc_kb.core.IdentifierAttribute object>, 'species_types': <wc_kb.core.IdentifierAttribute object>}[source]
tabular_orientation = 3[source]
unique_together = ()[source]
verbose_name = 'Identifier'[source]
verbose_name_plural = 'Identifiers'[source]
id = <obj_model.core.RegexAttribute object>[source]
namespace = <obj_model.core.RegexAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
serialize()[source]

Generate string representation

Returns:value of primary attribute
Return type:str
class wc_kb.core.IdentifierAttribute(related_name='', verbose_name='', verbose_related_name='', help='')[source]

Bases: obj_model.core.ManyToManyAttribute

Identifier attribute

deserialize(value, objects, decoded=None)[source]

Deserialize value :param value: String representation :type value: str :param objects: dictionary of objects, grouped by model :type objects: dict :param decoded: dictionary of objects that have already been decoded :type decoded: dict, optional

Returns:
tuple of cleaned value
and cleaning error
Return type:tuple of list of Identifier, InvalidAttribute or None
serialize(identifiers, encoded=None)[source]

Serialize related object :param identifiers: a list of instances of Identifier Python representation :type identifiers: list of Model :param encoded: dictionary of objects that have already been encoded :type encoded: dict, optional

Returns:simple Python representation
Return type:str
class wc_kb.core.KnowledgeBase(**kwargs)[source]

Bases: wc_kb.core.KnowledgeBaseObject

A knowledge base

version[source]

version

Type:str
translation_table[source]

translation table

Type:int
version[source]

version of the KB

Type:str
url[source]

url of the KB Git repository

Type:str
branch[source]

branch of the KB Git repository

Type:str
revision[source]

revision of the KB Git repository

Type:str
wc_kb_version[source]

version of wc_kb

Type:str
Related attributes:
cell (Cell): cell
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'translation_table', 'version', 'url', 'branch', 'revision', 'wc_kb_version', 'comments')[source]
attributes = {'branch': <obj_model.core.StringAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'id': <obj_model.core.StringAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'revision': <obj_model.core.StringAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>, 'translation_table': <obj_model.core.IntegerAttribute object>, 'url': <obj_model.core.StringAttribute object>, 'version': <obj_model.core.RegexAttribute object>, 'wc_kb_version': <obj_model.core.RegexAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.KnowledgeBase'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'branch': <obj_model.core.LocalAttribute object>, 'cell': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'revision': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'translation_table': <obj_model.core.LocalAttribute object>, 'url': <obj_model.core.LocalAttribute object>, 'version': <obj_model.core.LocalAttribute object>, 'wc_kb_version': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.StringAttribute object>[source]
related_attributes = {'cell': <obj_model.core.OneToOneAttribute object>}[source]
tabular_orientation = 2[source]
unique_together = ()[source]
verbose_name = 'KB'[source]
verbose_name_plural = 'KBS'[source]
branch = <obj_model.core.StringAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
revision = <obj_model.core.StringAttribute object>[source]
translation_table = <obj_model.core.IntegerAttribute object>[source]
url = <obj_model.core.StringAttribute object>[source]
version = <obj_model.core.RegexAttribute object>[source]
wc_kb_version = <obj_model.core.RegexAttribute object>[source]
class wc_kb.core.KnowledgeBaseObject(**kwargs)[source]

Bases: obj_model.core.Model

Knowledge of a biological entity

id[source]

identifier

Type:str
name[source]

name

Type:str
synonyms[source]

synonyms

Type:str
comments[source]

comments

Type:str
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ()[source]
attributes = {'comments': <obj_model.core.LongStringAttribute object>, 'id': <obj_model.core.StringAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>}[source]
children = {}[source]
frozen_columns = 1[source]
help = ''[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.KnowledgeBaseObject'>,)[source]
local_attributes = {'comments': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>}[source]
merge = 1[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.StringAttribute object>[source]
related_attributes = {}[source]
tabular_orientation = 1[source]
unique_together = ()[source]
verbose_name = 'Knowledge base object'[source]
verbose_name_plural = 'Knowledge base objects'[source]
comments = <obj_model.core.LongStringAttribute object>[source]
get_nested_metadata()[source]
Returns a list of wc_kb.core.Reference / wc_kb.core.DatabaseReference / wc_kb.core.Comments objects that
appear in the object’s wc_kb.core.Evidence and the associated wc_kb.core.Experiment
Returns:references
Return type:id (list of Reference)
id = <obj_model.core.StringAttribute object>[source]
name = <obj_model.core.StringAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
synonyms = <obj_model.core.StringAttribute object>[source]
class wc_kb.core.MetaboliteSpeciesType(**kwargs)[source]

Bases: wc_kb.core.SpeciesType

Knowledge of a metabolite

synonyms[source]

synonyms

Type:str
type[source]

type

Type:pronto
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'synonyms', 'type', 'identifiers', 'references', 'comments')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'id': <obj_model.core.SlugAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'synonyms': <obj_model.core.LongStringAttribute object>, 'type': <obj_model.ontology.OntologyAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.MetaboliteSpeciesType'>, <class 'wc_kb.core.SpeciesType'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'properties': <obj_model.core.LocalAttribute object>, 'reactions': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'species': <obj_model.core.LocalAttribute object>, 'species_type_coefficients': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'type': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.SlugAttribute object>[source]
related_attributes = {'properties': <obj_model.core.ManyToOneAttribute object>, 'reactions': <obj_model.core.ManyToManyAttribute object>, 'species': <obj_model.core.ManyToOneAttribute object>, 'species_type_coefficients': <obj_model.core.ManyToOneAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Metabolite'[source]
verbose_name_plural = 'Metabolites'[source]
get_charge(ph=7.95)[source]

Get the charge

Returns:charge
Return type:int
get_empirical_formula(ph=7.95)[source]

Get the empirical formula

Returns:empirical formula
Return type:chem.EmpiricalFormula
get_mol_wt()[source]

Get the molecular weight

Returns:molecular weight
Return type:float
Raises:ValueError – if there is not enough information to calculate molecular weight
get_structure(ph=7.95)[source]

Get the structure

Returns:structure
Return type:str
Raises:ValueError – if structure has not been provided
objects = <obj_model.core.Manager object>[source]
synonyms = <obj_model.core.LongStringAttribute object>[source]
to_openbabel_mol()[source]

Convert species type to an Open Babel molecule

Returns:Open Babel molecule
Return type:openbabel.OBMol
Raises:ValueError – if structure has not been provided
type = <obj_model.ontology.OntologyAttribute object>[source]
class wc_kb.core.Observable(**kwargs)[source]

Bases: wc_kb.core.KnowledgeBaseObject

Observable: a linear function of other Observables and Species

cell[source]

cell

Type:Cell
expression[source]

mathematical expression for an Observable

Type:ObservableExpression
units[source]

units of expression

Type:unit_registry.Unit
references[source]

references

Type:list of Reference
identifiers[source]

identifiers

Type:list of Identifier
Related attributes:
observable_expressions (list of ObservableExpression): observable expressions rate_law_expressions (list of RateLawExpression): rate law expressions
class Meta[source]

Bases: obj_model.core.Meta, obj_model.expression.ExpressionExpressionTermMeta

attribute_order = ('id', 'name', 'expression', 'units', 'identifiers', 'references', 'comments')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'expression': <obj_model.expression.ExpressionManyToOneAttribute object>, 'id': <obj_model.core.StringAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>, 'units': <obj_model.units.UnitAttribute object>}[source]
expression_term_model[source]

alias of ObservableExpression

expression_term_units = 'units'[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.Observable'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'expression': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'observable_expressions': <obj_model.core.LocalAttribute object>, 'rate_law_expressions': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'units': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.StringAttribute object>[source]
related_attributes = {'observable_expressions': <obj_model.core.ManyToManyAttribute object>, 'rate_law_expressions': <obj_model.core.ManyToManyAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Observable'[source]
verbose_name_plural = 'Observables'[source]
cell = <obj_model.core.ManyToOneAttribute object>[source]
deserialize(value, objects, decoded=None)[source]

Deserialize value

Parameters:
  • value (str) – String representation
  • objects (dict) – dictionary of objects, grouped by model
  • decoded (dict, optional) – dictionary of objects that have already been decoded
Returns:

tuple of cleaned value and cleaning error

Return type:

tuple of ObservableExpression, InvalidAttribute or None

expression = <obj_model.expression.ExpressionManyToOneAttribute object>[source]
identifiers = <wc_kb.core.IdentifierAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
references = <obj_model.core.ManyToManyAttribute object>[source]
units = <obj_model.units.UnitAttribute object>[source]
class wc_kb.core.ObservableExpression(**kwargs)[source]

Bases: obj_model.core.Model, obj_model.expression.Expression

A mathematical expression of Observables and Species

The expression used by a Observable.

expression[source]

mathematical expression for an Observable

Type:str
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:
observable (Observable): observable
class Meta[source]

Bases: obj_model.core.Meta, obj_model.expression.Meta

attribute_order = ()[source]
attributes = {'expression': <obj_model.core.LongStringAttribute object>, 'observables': <obj_model.core.ManyToManyAttribute object>, 'species': <obj_model.core.ManyToManyAttribute object>}[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_kb.core.ObservableExpression'>,)[source]
local_attributes = {'expression': <obj_model.core.LocalAttribute object>, 'observable': <obj_model.core.LocalAttribute object>, 'observables': <obj_model.core.LocalAttribute object>, 'species': <obj_model.core.LocalAttribute object>}[source]
ordering = ('expression',)[source]
primary_attribute = <obj_model.core.LongStringAttribute object>[source]
related_attributes = {'observable': <obj_model.expression.ExpressionManyToOneAttribute object>}[source]
tabular_orientation = 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_model.core.LongStringAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
observables = <obj_model.core.ManyToManyAttribute object>[source]
serialize()[source]

Generate string representation

Returns:string representation
Return type:str
species = <obj_model.core.ManyToManyAttribute object>[source]
class wc_kb.core.OneToOneSpeciesAttribute(related_name='', verbose_name='', verbose_related_name='', help='')[source]

Bases: obj_model.core.OneToOneAttribute

Species attribute

deserialize(value, objects, decoded=None)[source]

Deserialize value

Parameters:
  • value (str) – String representation
  • objects (dict) – dictionary of objects, grouped by model
  • decoded (dict, optional) – dictionary of objects that have already been decoded
Returns:

tuple of cleaned value

and cleaning error

Return type:

tuple of list of Species, InvalidAttribute or None

serialize(value, encoded=None)[source]

Serialize related object :param value: Python representation :type value: Model :param encoded: dictionary of objects that have already been encoded :type encoded: dict, optional

Returns:simple Python representation
Return type:str
class wc_kb.core.Parameter(**kwargs)[source]

Bases: wc_kb.core.KnowledgeBaseObject

Knowledge of parameters

cell[source]

cell

Type:Cell
value[source]

value

Type:float
error[source]

measurement error

Type:float
units[source]

units of value

Type:unit_registry.Unit
evidence[source]

evidence

Type:list of Evidence
references[source]

references

Type:list of Reference
identifierss[source]

reference in external namespaces

Type:list of DatabaseReference
Related attributes:
rate_law_expressions (list of RateLawExpression): rate law expressions that use a Parameter
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'synonyms', 'value', 'units', 'evidence', 'identifiers', 'references', 'comments')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'error': <obj_model.core.FloatAttribute object>, 'evidence': <obj_model.core.OneToManyAttribute object>, 'id': <obj_model.core.StringAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>, 'units': <obj_model.units.UnitAttribute object>, 'value': <obj_model.core.FloatAttribute object>}[source]
expression_term_token_pattern = (1,)[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.Parameter'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'error': <obj_model.core.LocalAttribute object>, 'evidence': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'rate_law_expressions': <obj_model.core.LocalAttribute object>, 'reactions': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'units': <obj_model.core.LocalAttribute object>, 'value': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.StringAttribute object>[source]
related_attributes = {'rate_law_expressions': <obj_model.core.ManyToManyAttribute object>, 'reactions': <obj_model.core.OneToManyAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Parameter'[source]
verbose_name_plural = 'Parameters'[source]
cell = <obj_model.core.ManyToOneAttribute object>[source]
error = <obj_model.core.FloatAttribute object>[source]
evidence = <obj_model.core.OneToManyAttribute object>[source]
identifiers = <wc_kb.core.IdentifierAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
references = <obj_model.core.ManyToManyAttribute object>[source]
units = <obj_model.units.UnitAttribute object>[source]
value = <obj_model.core.FloatAttribute object>[source]
class wc_kb.core.PolymerDirection[source]

Bases: enum.Enum

An enumeration.

forward = 1[source]
reverse = -1[source]
class wc_kb.core.PolymerLocus(**kwargs)[source]

Bases: wc_kb.core.KnowledgeBaseObject

Knowledge about a locus of a polymer

polymer[source]

polymer

Type:PolymerSpeciesType
start[source]

start position

Type:int
end[source]

end position

Type:int
strand[source]

strand

Type:PolymerStrand
references[source]

references

Type:list of Reference
identifiers[source]

identifiers

Type:list of Identifier
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'polymer', 'strand', 'start', 'end', 'identifiers', 'references', 'comments')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'end': <obj_model.core.IntegerAttribute object>, 'id': <obj_model.core.StringAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'polymer': <obj_model.core.ManyToOneAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'start': <obj_model.core.IntegerAttribute object>, 'strand': <obj_model.core.EnumAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.PolymerLocus'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'end': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'polymer': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'start': <obj_model.core.LocalAttribute object>, 'strand': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.StringAttribute object>[source]
related_attributes = {}[source]
unique_together = ()[source]
verbose_name = 'Polymer locus'[source]
verbose_name_plural = 'Polymer loci'[source]
cell = <obj_model.core.ManyToOneAttribute object>[source]
end = <obj_model.core.IntegerAttribute object>[source]
get_direction()[source]

Returns the direction of the polymer feature defind by its strand and start/end coordinate

Returns:

direction (in [‘forward’, ‘reverse’])

Return type:

PolymerDirection

Raises:
  • obj:ValueError: start and end coordinate of chromosome feature can not be the same
  • obj:Exception: strand is not member of PolymerStrand
get_len()[source]

Get the length

Returns:length
Return type:int
get_seq()[source]

Get the sequence

Returns:sequence
Return type:Bio.Seq.Seq
identifiers = <wc_kb.core.IdentifierAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
polymer = <obj_model.core.ManyToOneAttribute object>[source]
references = <obj_model.core.ManyToManyAttribute object>[source]
start = <obj_model.core.IntegerAttribute object>[source]
strand = <obj_model.core.EnumAttribute object>[source]
class wc_kb.core.PolymerSpeciesType(**kwargs)[source]

Bases: wc_kb.core.SpeciesType

Knowledge of a polymer

circular[source]

is the polymer circular

Type:bool
double_stranded[source]

is the polymer double stranded

Type:bool
Related attributes:
loci (list of PolymerLocus): loci
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'circular', 'double_stranded', 'comments', 'references', 'identifiers')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'circular': <obj_model.core.BooleanAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'double_stranded': <obj_model.core.BooleanAttribute object>, 'id': <obj_model.core.SlugAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.PolymerSpeciesType'>, <class 'wc_kb.core.SpeciesType'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'circular': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'double_stranded': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'loci': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'properties': <obj_model.core.LocalAttribute object>, 'reactions': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'species': <obj_model.core.LocalAttribute object>, 'species_type_coefficients': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.SlugAttribute object>[source]
related_attributes = {'loci': <obj_model.core.ManyToOneAttribute object>, 'properties': <obj_model.core.ManyToOneAttribute object>, 'reactions': <obj_model.core.ManyToManyAttribute object>, 'species': <obj_model.core.ManyToOneAttribute object>, 'species_type_coefficients': <obj_model.core.ManyToOneAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Polymer species type'[source]
verbose_name_plural = 'Polymer species types'[source]
circular = <obj_model.core.BooleanAttribute object>[source]
double_stranded = <obj_model.core.BooleanAttribute object>[source]
get_len()[source]

Get the polymer length

Returns:length
Return type:int
get_seq()[source]

Get the polymer sequence

Returns:sequence
Return type:Bio.Seq.Seq
get_subseq(start, end, strand=<PolymerStrand.positive: 1>)[source]

Get a subsequence

Parameters:
  • start (int) – start coordinate (1-indexed)
  • end (int) – end coordinate (1-indexed)
  • strand (PolymerStrand, optional) – strand
Returns:

sequence

Return type:

Bio.Seq.Seq

Raises:

ValueError – if the polymer is linear and the start or end coordinates are less than 1 or greater than the length of the sequence

objects = <obj_model.core.Manager object>[source]
class wc_kb.core.PolymerStrand[source]

Bases: enum.Enum

An enumeration.

negative = -1[source]
positive = 1[source]
class wc_kb.core.RateLaw(**kwargs)[source]

Bases: wc_kb.core.KnowledgeBaseObject

Rate law

reaction[source]

reaction

Type:Reaction
direction[source]

direction

Type:RateLawDirection
expression[source]

expression

Type:RateLawExpression
units[source]

units

Type:unit_registry.Unit
references[source]

references

Type:list of Reference
identifiers[source]

identifiers

Type:list of Identifier
class Meta[source]

Bases: obj_model.core.Meta, obj_model.expression.ExpressionExpressionTermMeta

attribute_order = ('id', 'reaction', 'direction', 'expression', 'units', 'identifiers', 'references', 'comments')[source]
attributes = {'comments': <obj_model.core.LongStringAttribute object>, 'direction': <obj_model.core.EnumAttribute object>, 'expression': <obj_model.expression.ExpressionManyToOneAttribute object>, 'id': <obj_model.core.StringAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'reaction': <obj_model.core.ManyToOneAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>, 'units': <obj_model.units.UnitAttribute object>}[source]
expression_term_model[source]

alias of RateLawExpression

expression_term_units = 'units'[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.RateLaw'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'comments': <obj_model.core.LocalAttribute object>, 'direction': <obj_model.core.LocalAttribute object>, 'expression': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'reaction': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'units': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.StringAttribute object>[source]
related_attributes = {}[source]
unique_together = ()[source]
verbose_name = 'Rate law'[source]
verbose_name_plural = 'Rate laws'[source]
deserialize(value, objects, decoded=None)[source]

Deserialize value

Parameters:
  • value (str) – String representation
  • objects (dict) – dictionary of objects, grouped by model
  • decoded (dict, optional) – dictionary of objects that have already been decoded
Returns:

tuple of cleaned value and cleaning error

Return type:

tuple of ObservableExpression, InvalidAttribute or None

direction = <obj_model.core.EnumAttribute object>[source]
expression = <obj_model.expression.ExpressionManyToOneAttribute object>[source]
gen_id()[source]

Generate identifier :returns: identifier :rtype: str

identifiers = <wc_kb.core.IdentifierAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
reaction = <obj_model.core.ManyToOneAttribute object>[source]
references = <obj_model.core.ManyToManyAttribute object>[source]
units = <obj_model.units.UnitAttribute object>[source]
class wc_kb.core.RateLawDirection[source]

Bases: int, wc_utils.util.enumerate.CaseInsensitiveEnum

Rate law directions

backward = -1[source]
forward = 1[source]
class wc_kb.core.RateLawExpression(**kwargs)[source]

Bases: obj_model.core.Model, obj_model.expression.Expression

Rate law expression

expression[source]

mathematical expression of the rate law

Type:str
parameters[source]

parameters whose values are used in the rate law

Type:list of Parameter
species[source]

species whose dynamic concentrations are used in the rate law

Type:list of Species
observables[source]

observables whose values are used in the rate law

Type:list of Observable
Related attributes:
rate_law (RateLaw): the RateLaw which uses this RateLawExpression
class Meta[source]

Bases: obj_model.core.Meta, obj_model.expression.Meta

attribute_order = ('expression', 'parameters', 'species', 'observables')[source]
attributes = {'expression': <obj_model.core.LongStringAttribute object>, 'observables': <obj_model.core.ManyToManyAttribute object>, 'parameters': <obj_model.core.ManyToManyAttribute object>, 'species': <obj_model.core.ManyToManyAttribute object>}[source]
expression_term_models = ('Parameter', 'Species', 'Observable')[source]
expression_unit_registry = <pint.registry.UnitRegistry object>[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.RateLawExpression'>,)[source]
local_attributes = {'expression': <obj_model.core.LocalAttribute object>, 'observables': <obj_model.core.LocalAttribute object>, 'parameters': <obj_model.core.LocalAttribute object>, 'rate_laws': <obj_model.core.LocalAttribute object>, 'species': <obj_model.core.LocalAttribute object>}[source]
ordering = ('expression',)[source]
primary_attribute = <obj_model.core.LongStringAttribute object>[source]
related_attributes = {'rate_laws': <obj_model.expression.ExpressionManyToOneAttribute object>}[source]
tabular_orientation = 3[source]
unique_together = ()[source]
verbose_name = 'Rate law expression'[source]
verbose_name_plural = 'Rate law expressions'[source]
classmethod deserialize(value, objects)[source]

Deserialize value :param value: String representation :type value: str :param objects: dictionary of objects, grouped by model :type objects: dict

Returns:
tuple of cleaned value
and cleaning error
Return type:tuple of RateLawExpression, InvalidAttribute or None
expression = <obj_model.core.LongStringAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
observables = <obj_model.core.ManyToManyAttribute object>[source]
parameters = <obj_model.core.ManyToManyAttribute object>[source]
serialize()[source]

Generate string representation :returns: value of primary attribute :rtype: str

species = <obj_model.core.ManyToManyAttribute object>[source]
class wc_kb.core.Reaction(**kwargs)[source]

Bases: wc_kb.core.KnowledgeBaseObject

Knowledge of reactions

cell[source]

cell

Type:Cell
participants[source]

participants

Type:list of SpeciesCoefficient
reversible[source]

denotes whether reaction is reversible

Type:boolean
references[source]

references

Type:list of Reference
identifiers[source]

identifiers

Type:list of Identifier
evidence[source]

evidence

Type:list of Evidence
enzymes[source]

enzymes

Type:list of SpeciesType
coenzymes[source]

coenzymes

Type:list of SpeciesType
spontaneous[source]

spontaneity

Type:bool
parameters[source]

parameters

Type:Parameter
type[source]

type

Type:pronto
Related attributes:
rate_laws (list of RateLaw): rate laws; if present, rate_laws[0] is the forward
rate law, and rate_laws[1] is the backward rate law
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'synonyms', 'type', 'participants', 'enzymes', 'coenzymes', 'reversible', 'spontaneous', 'parameters', 'evidence', 'identifiers', 'references', 'comments')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'coenzymes': <obj_model.core.ManyToManyAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'enzymes': <obj_model.core.ManyToManyAttribute object>, 'evidence': <obj_model.core.OneToManyAttribute object>, 'id': <obj_model.core.StringAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'parameters': <obj_model.core.OneToManyAttribute object>, 'participants': <wc_kb.core.ReactionParticipantAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'reversible': <obj_model.core.BooleanAttribute object>, 'spontaneous': <obj_model.core.BooleanAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>, 'type': <obj_model.ontology.OntologyAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.Reaction'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'coenzymes': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'enzymes': <obj_model.core.LocalAttribute object>, 'evidence': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'parameters': <obj_model.core.LocalAttribute object>, 'participants': <obj_model.core.LocalAttribute object>, 'rate_laws': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'reversible': <obj_model.core.LocalAttribute object>, 'spontaneous': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'type': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.StringAttribute object>[source]
related_attributes = {'rate_laws': <obj_model.core.ManyToOneAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Reaction'[source]
verbose_name_plural = 'Reactions'[source]
cell = <obj_model.core.ManyToOneAttribute object>[source]
coenzymes = <obj_model.core.ManyToManyAttribute object>[source]
enzymes = <obj_model.core.ManyToManyAttribute object>[source]
evidence = <obj_model.core.OneToManyAttribute object>[source]
identifiers = <wc_kb.core.IdentifierAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
parameters = <obj_model.core.OneToManyAttribute object>[source]
participants = <wc_kb.core.ReactionParticipantAttribute object>[source]
references = <obj_model.core.ManyToManyAttribute object>[source]
reversible = <obj_model.core.BooleanAttribute object>[source]
spontaneous = <obj_model.core.BooleanAttribute object>[source]
type = <obj_model.ontology.OntologyAttribute object>[source]
class wc_kb.core.ReactionParticipantAttribute(related_name='', verbose_name='', verbose_related_name='', help='')[source]

Bases: obj_model.core.ManyToManyAttribute

Reaction participants

deserialize(value, objects, decoded=None)[source]

Deserialize value

Parameters:
  • value (str) – String representation
  • objects (dict) – dictionary of objects, grouped by model
  • decoded (dict, optional) – dictionary of objects that have already been decoded
Returns:

tuple of cleaned value

and cleaning error

Return type:

tuple of list of SpeciesCoefficient, InvalidAttribute or None

deserialize_side(direction, value, objects, global_comp)[source]

Deserialize the LHS or RHS of a reaction equation :param direction: -1. indicates LHS, +1. indicates RHS :type direction: float :param value: String representation :type value: str :param objects: dictionary of objects, grouped by model :type objects: dict :param global_comp: global compartment of the reaction :type global_comp: Compartment

Returns:
  • list of SpeciesCoefficient: list of species coefficients
  • list of Exception: list of errors
Return type:tuple
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

class wc_kb.core.Reference(**kwargs)[source]

Bases: obj_model.core.Model

Reference to the literature

id[source]

identifier

Type:str
name[source]

name

Type:str
authors[source]

authors

Type:str
title[source]

title

Type:str
volume[source]

volume

Type:str
issue[source]

issue

Type:str
journal[source]

journal

Type:str
pages (

obj:``str): pages

year[source]

year

Type:int
cell[source]

cell

Type:Cell
identifiers[source]

identifiers

Type:list of Identifier
comments[source]

comments

Type:str
type[source]

type of reference

Type:pronto
Related attributes:
compartments (list of Compartment): compartments species_types (list of SpeciesType): species_types concentrations (list of Concentration): concentrations loci (list of PolymerLocus): loci properties (list of SpeciesTypeProperty): species type properties reactions (list of Reaction): reactions rate_laws (list of RateLaw): rate_laws observables (list of Observable): observables
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'type', 'title', 'authors', 'journal', 'volume', 'issue', 'pages', 'year', 'identifiers', 'comments')[source]
attributes = {'authors': <obj_model.core.LongStringAttribute object>, 'cell': <obj_model.core.ManyToOneAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'id': <obj_model.core.SlugAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'issue': <obj_model.core.StringAttribute object>, 'journal': <obj_model.core.StringAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'pages': <obj_model.core.StringAttribute object>, 'title': <obj_model.core.LongStringAttribute object>, 'type': <obj_model.ontology.OntologyAttribute object>, 'volume': <obj_model.core.StringAttribute object>, 'year': <obj_model.core.IntegerAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.Reference'>,)[source]
local_attributes = {'authors': <obj_model.core.LocalAttribute object>, 'cell': <obj_model.core.LocalAttribute object>, 'chromosome_features': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'compartments': <obj_model.core.LocalAttribute object>, 'concentrations': <obj_model.core.LocalAttribute object>, 'evidence': <obj_model.core.LocalAttribute object>, 'experiment': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'issue': <obj_model.core.LocalAttribute object>, 'journal': <obj_model.core.LocalAttribute object>, 'loci': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'observables': <obj_model.core.LocalAttribute object>, 'pages': <obj_model.core.LocalAttribute object>, 'parameters': <obj_model.core.LocalAttribute object>, 'properties': <obj_model.core.LocalAttribute object>, 'rate_laws': <obj_model.core.LocalAttribute object>, 'reactions': <obj_model.core.LocalAttribute object>, 'regulatory_modules': <obj_model.core.LocalAttribute object>, 'species_types': <obj_model.core.LocalAttribute object>, 'title': <obj_model.core.LocalAttribute object>, 'type': <obj_model.core.LocalAttribute object>, 'volume': <obj_model.core.LocalAttribute object>, 'year': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.SlugAttribute object>[source]
related_attributes = {'chromosome_features': <obj_model.core.ManyToManyAttribute object>, 'compartments': <obj_model.core.ManyToManyAttribute object>, 'concentrations': <obj_model.core.ManyToManyAttribute object>, 'evidence': <obj_model.core.ManyToManyAttribute object>, 'experiment': <obj_model.core.ManyToManyAttribute object>, 'loci': <obj_model.core.ManyToManyAttribute object>, 'observables': <obj_model.core.ManyToManyAttribute object>, 'parameters': <obj_model.core.ManyToManyAttribute object>, 'properties': <obj_model.core.ManyToManyAttribute object>, 'rate_laws': <obj_model.core.ManyToManyAttribute object>, 'reactions': <obj_model.core.ManyToManyAttribute object>, 'regulatory_modules': <obj_model.core.ManyToManyAttribute object>, 'species_types': <obj_model.core.ManyToManyAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Reference'[source]
verbose_name_plural = 'References'[source]
authors = <obj_model.core.LongStringAttribute object>[source]
cell = <obj_model.core.ManyToOneAttribute object>[source]
comments = <obj_model.core.LongStringAttribute object>[source]
id = <obj_model.core.SlugAttribute object>[source]
identifiers = <wc_kb.core.IdentifierAttribute object>[source]
issue = <obj_model.core.StringAttribute object>[source]
journal = <obj_model.core.StringAttribute object>[source]
name = <obj_model.core.StringAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
pages = <obj_model.core.StringAttribute object>[source]
title = <obj_model.core.LongStringAttribute object>[source]
type = <obj_model.ontology.OntologyAttribute object>[source]
volume = <obj_model.core.StringAttribute object>[source]
year = <obj_model.core.IntegerAttribute object>[source]
class wc_kb.core.Species(tuple of species type, compartment)[source]

Bases: obj_model.core.Model

species_type[source]

species type

Type:SpeciesType
compartment[source]

compartment

Type:Compartment
Related attributes:
concentration (Concentration): concentration species_coefficients (list of SpeciesCoefficient): participations in reactions rate_law_expressions (list of RateLawExpression): participations in the evaluation of rates observable_expressions (list of ObservableExpression): participations in observables
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'species_type', 'compartment')[source]
attributes = {'compartment': <obj_model.core.ManyToOneAttribute object>, 'species_type': <obj_model.core.ManyToOneAttribute object>}[source]
expression_term_token_pattern = (1, 9, 1, 10)[source]
frozen_columns = 1[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.Species'>,)[source]
local_attributes = {'compartment': <obj_model.core.LocalAttribute object>, 'concentrations': <obj_model.core.LocalAttribute object>, 'observable_expressions': <obj_model.core.LocalAttribute object>, 'rate_law_expressions': <obj_model.core.LocalAttribute object>, 'species_coefficients': <obj_model.core.LocalAttribute object>, 'species_type': <obj_model.core.LocalAttribute object>}[source]
ordering = ('species_type', 'compartment')[source]
primary_attribute = None[source]
related_attributes = {'concentrations': <wc_kb.core.OneToOneSpeciesAttribute object>, 'observable_expressions': <obj_model.core.ManyToManyAttribute object>, 'rate_law_expressions': <obj_model.core.ManyToManyAttribute object>, 'species_coefficients': <obj_model.core.ManyToOneAttribute object>}[source]
tabular_orientation = 3[source]
unique_together = (('compartment', 'species_type'),)[source]
verbose_name = 'Species'[source]
verbose_name_plural = 'Species'[source]
compartment = <obj_model.core.ManyToOneAttribute object>[source]
classmethod deserialize(attribute, value, objects)[source]

Deserialize value

Parameters:
  • attribute (Attribute) – attribute
  • value (str) – String representation
  • objects (dict) – dictionary of objects, grouped by model
Returns:

tuple of cleaned value and cleaning error

Return type:

tuple of object, InvalidAttribute or None

static gen_id(species_type, compartment)[source]

Generate a Species’ primary identifier

Parameters:
  • species_type (object) – a SpeciesType, or its id
  • compartment (object) – a Compartment, or its id
Returns:

canonical identifier for a specie in a compartment, ‘species_type_id[compartment_id]’

Return type:

str

id()[source]

Provide a Species’ primary identifier

Returns:canonical identifier for a specie in a compartment, ‘specie_id[compartment_id]’
Return type:str
objects = <obj_model.core.Manager object>[source]
serialize()[source]

Provide a Species’ primary identifier

Returns:canonical identifier for a specie in a compartment, ‘specie_id[compartment_id]’
Return type:str
species_type = <obj_model.core.ManyToOneAttribute object>[source]
class wc_kb.core.SpeciesCoefficient(**kwargs)[source]

Bases: obj_model.core.Model

A tuple of a species and a coefficient

species[source]

species

Type:Species
coefficient[source]

coefficient

Type:float
Related attributes:
reaction (Reaction): reaction
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('species', 'coefficient')[source]
attributes = {'coefficient': <obj_model.core.FloatAttribute object>, 'species': <obj_model.core.ManyToOneAttribute object>}[source]
frozen_columns = 1[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.SpeciesCoefficient'>,)[source]
local_attributes = {'coefficient': <obj_model.core.LocalAttribute object>, 'reactions': <obj_model.core.LocalAttribute object>, 'species': <obj_model.core.LocalAttribute object>}[source]
ordering = ('species',)[source]
primary_attribute = None[source]
related_attributes = {'reactions': <wc_kb.core.ReactionParticipantAttribute object>}[source]
tabular_orientation = 3[source]
unique_together = ()[source]
verbose_name = 'Species coefficient'[source]
verbose_name_plural = 'Species coefficients'[source]
coefficient = <obj_model.core.FloatAttribute object>[source]
classmethod deserialize(attribute, value, objects, compartment=None)[source]

Deserialize value

Parameters:
  • attribute (Attribute) – attribute
  • value (str) – String representation
  • objects (dict) – dictionary of objects, grouped by model
  • compartment (Compartment, optional) – compartment
Returns:

tuple of cleaned value

and cleaning error

Return type:

tuple of list of SpeciesCoefficient, InvalidAttribute or None

objects = <obj_model.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:

string representation of a species and a coefficient

Return type:

str

species = <obj_model.core.ManyToOneAttribute object>[source]
class wc_kb.core.SpeciesType(**kwargs)[source]

Bases: wc_kb.core.KnowledgeBaseObject

Knowledge of a molecular species

cell[source]

cell

Type:Cell
references[source]

references

Type:list of Reference
identifiers[source]

identifiers

Type:list of Identifier
Related attributes:
reaction_participants (list of ReactionParticipant): reaction participants
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'comments', 'references', 'identifiers')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'id': <obj_model.core.SlugAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.SpeciesType'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'properties': <obj_model.core.LocalAttribute object>, 'reactions': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'species': <obj_model.core.LocalAttribute object>, 'species_type_coefficients': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.SlugAttribute object>[source]
related_attributes = {'properties': <obj_model.core.ManyToOneAttribute object>, 'reactions': <obj_model.core.ManyToManyAttribute object>, 'species': <obj_model.core.ManyToOneAttribute object>, 'species_type_coefficients': <obj_model.core.ManyToOneAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Species type'[source]
verbose_name_plural = 'Species types'[source]
cell = <obj_model.core.ManyToOneAttribute object>[source]
get_charge()[source]

Get the charge

Returns:charge
Return type:int
get_empirical_formula()[source]

Get the empirical formula

Returns:empirical formula
Return type:chem.EmpiricalFormula
get_mol_wt()[source]

Get the molecular weight

Returns:molecular weight
Return type:float
id = <obj_model.core.SlugAttribute object>[source]
identifiers = <wc_kb.core.IdentifierAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
references = <obj_model.core.ManyToManyAttribute object>[source]
class wc_kb.core.SpeciesTypeCoefficient(**kwargs)[source]

Bases: obj_model.core.Model

A tuple of a species type and a coefficient

species_type[source]

species_type

Type:SpeciesType
coefficient[source]

coefficient

Type:float
Related attributes:
complex (ComplexSpeciesType): complex
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('species_type', 'coefficient')[source]
attributes = {'coefficient': <obj_model.core.FloatAttribute object>, 'species_type': <obj_model.core.ManyToOneAttribute object>}[source]
frozen_columns = 1[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.SpeciesTypeCoefficient'>,)[source]
local_attributes = {'coefficient': <obj_model.core.LocalAttribute object>, 'complexes': <obj_model.core.LocalAttribute object>, 'species_type': <obj_model.core.LocalAttribute object>}[source]
ordering = ('species_type',)[source]
primary_attribute = None[source]
related_attributes = {'complexes': <wc_kb.core.SubunitAttribute object>}[source]
tabular_orientation = 3[source]
unique_together = ()[source]
verbose_name = 'Species type coefficient'[source]
verbose_name_plural = 'Species type coefficients'[source]
coefficient = <obj_model.core.FloatAttribute object>[source]
classmethod deserialize(attribute, value, objects)[source]

Deserialize value

Parameters:
  • attribute (Attribute) – attribute
  • value (str) – String representation
  • objects (dict) – dictionary of objects, grouped by model
Returns:

tuple of cleaned value

and cleaning error

Return type:

tuple of list of SpeciesTypeCoefficient, InvalidAttribute or None

objects = <obj_model.core.Manager object>[source]
serialize()[source]

Serialize related object

Returns:string representation of a species type and a coefficient
Return type:str
species_type = <obj_model.core.ManyToOneAttribute object>[source]
class wc_kb.core.SpeciesTypeProperty(**kwargs)[source]

Bases: wc_kb.core.KnowledgeBaseObject

Knowledge of the properties of species types

species_type[source]

species type

Type:SpeciesType
property[source]

name of property

Type:str
units[source]

units

Type:unit_registry
value[source]

value

Type:str
identifiers[source]

identifiers

Type:list of Identifier
references[source]

references

Type:list of Reference
evidence[source]

evidence

Type:list of Evidence
value_type[source]

value type

Type:pronto
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'species_type', 'property', 'value', 'value_type', 'units', 'evidence', 'identifiers', 'references', 'comments')[source]
attributes = {'comments': <obj_model.core.LongStringAttribute object>, 'evidence': <obj_model.core.OneToManyAttribute object>, 'id': <obj_model.core.StringAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'property': <obj_model.core.StringAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'species_type': <obj_model.core.ManyToOneAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>, 'units': <obj_model.units.UnitAttribute object>, 'value': <obj_model.core.LongStringAttribute object>, 'value_type': <obj_model.ontology.OntologyAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.core.SpeciesTypeProperty'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'comments': <obj_model.core.LocalAttribute object>, 'evidence': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'property': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'species_type': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'units': <obj_model.core.LocalAttribute object>, 'value': <obj_model.core.LocalAttribute object>, 'value_type': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.StringAttribute object>[source]
related_attributes = {}[source]
unique_together = (('property', 'species_type'),)[source]
verbose_name = 'Species type property'[source]
verbose_name_plural = 'Species type properties'[source]
evidence = <obj_model.core.OneToManyAttribute object>[source]
gen_id()[source]

Generate id :returns: identifier :rtype: str

get_value()[source]

SpeciesType property values are stored as strings, this function returns the value as the correct type.

identifiers = <wc_kb.core.IdentifierAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
property = <obj_model.core.StringAttribute object>[source]
references = <obj_model.core.ManyToManyAttribute object>[source]
species_type = <obj_model.core.ManyToOneAttribute object>[source]
units = <obj_model.units.UnitAttribute object>[source]
value = <obj_model.core.LongStringAttribute object>[source]
value_type = <obj_model.ontology.OntologyAttribute object>[source]
class wc_kb.core.SubunitAttribute(related_name='', verbose_name='', verbose_related_name='', help='')[source]

Bases: obj_model.core.ManyToManyAttribute

Subunits

deserialize(value, objects, decoded=None)[source]

Deserialize value

Parameters:
  • value (str) – String representation
  • objects (dict) – dictionary of objects, grouped by model
  • decoded (dict, optional) – dictionary of objects that have already been decoded
Returns:

tuple of cleaned value and cleaning error

Return type:

tuple of object, InvalidAttribute or None

serialize(subunits, encoded=None)[source]

Serialize related object

Parameters:
  • subunits (list of SpeciesTypeCoefficient) – Python representation of subunits
  • encoded (dict, optional) – dictionary of objects that have already been encoded
Returns:

simple Python representation

Return type:

str

class wc_kb.core.Validator[source]

Bases: obj_model.core.Validator

run(knowledge_base, get_related=True)[source]

Validate a knowledge_base and return its errors

Parameters:
  • knowledge_base (KnowledgeBase) – knowledge base
  • get_related (bool, optional) – if true, get all related objects
Returns:

list of invalid objects/models and their errors

Return type:

InvalidObjectSet or None

2.1.5. wc_kb.eukaryote_schema module

Schema to represent a knowledge base to build models of eukaryotes

Author:Yin Hoon Chew <yinhoon.chew@mssm.edu>
Date:2018-09-10
Copyright:2018, Karr Lab
License:MIT
class wc_kb.eukaryote_schema.ActivityLevel[source]

Bases: enum.Enum

Activity level of regulatory element

active = 1[source]
inactive = 4[source]
na = 5[source]
poised = 2[source]
repressed = 3[source]
class wc_kb.eukaryote_schema.GeneLocus(**kwargs)[source]

Bases: wc_kb.core.PolymerLocus

Knowledge of a gene

symbol[source]

symbol

Type:str
type[source]

type of gene

Type:GeneType
Related attributes:
transcripts (list of TranscriptSpeciesType): transcripts regulatory_modules (list of RegulatoryModule): regulatory_modules
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'synonyms', 'symbol', 'homologs', 'polymer', 'strand', 'start', 'end', 'identifiers', 'references', 'comments')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'end': <obj_model.core.IntegerAttribute object>, 'homologs': <obj_model.core.LongStringAttribute object>, 'id': <obj_model.core.StringAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'polymer': <obj_model.core.ManyToOneAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'start': <obj_model.core.IntegerAttribute object>, 'strand': <obj_model.core.EnumAttribute object>, 'symbol': <obj_model.core.StringAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.eukaryote_schema.GeneLocus'>, <class 'wc_kb.core.PolymerLocus'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'end': <obj_model.core.LocalAttribute object>, 'homologs': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'polymer': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'regulatory_modules': <obj_model.core.LocalAttribute object>, 'start': <obj_model.core.LocalAttribute object>, 'strand': <obj_model.core.LocalAttribute object>, 'symbol': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'transcripts': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.StringAttribute object>[source]
related_attributes = {'regulatory_modules': <obj_model.core.ManyToOneAttribute object>, 'transcripts': <obj_model.core.ManyToOneAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Gene'[source]
verbose_name_plural = 'Genes'[source]
homologs = <obj_model.core.LongStringAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
symbol = <obj_model.core.StringAttribute object>[source]
class wc_kb.eukaryote_schema.GenericLocus(**kwargs)[source]

Bases: obj_model.core.Model

Start and end coordinates of exons and CDSs

start[source]

start coordinate

Type:int
end[source]

end coordinate

Type:int
Related attributes:
transcripts (list of TranscriptSpeciesType): transcripts proteins (list of ProteinSpeciesType): proteins
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('start', 'end')[source]
attributes = {'end': <obj_model.core.PositiveIntegerAttribute object>, 'start': <obj_model.core.PositiveIntegerAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.eukaryote_schema.GenericLocus'>,)[source]
local_attributes = {'end': <obj_model.core.LocalAttribute object>, 'proteins': <obj_model.core.LocalAttribute object>, 'start': <obj_model.core.LocalAttribute object>, 'transcripts': <obj_model.core.LocalAttribute object>}[source]
ordering = ('start', 'end')[source]
primary_attribute = None[source]
related_attributes = {'proteins': <wc_kb.eukaryote_schema.LocusAttribute object>, 'transcripts': <wc_kb.eukaryote_schema.LocusAttribute object>}[source]
tabular_orientation = 3[source]
unique_together = ()[source]
verbose_name = 'Generic locus'[source]
verbose_name_plural = 'Generic loci'[source]
end = <obj_model.core.PositiveIntegerAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
serialize()[source]

Generate string representation

Returns:value of primary attribute
Return type:str
start = <obj_model.core.PositiveIntegerAttribute object>[source]
class wc_kb.eukaryote_schema.LocusAttribute(related_name='', verbose_name='', verbose_related_name='', help='')[source]

Bases: obj_model.core.ManyToManyAttribute

Start and end coordinates attribute

deserialize(value, objects, decoded=None)[source]

Deserialize value :param value: String representation :type value: str :param objects: dictionary of objects, grouped by model :type objects: dict :param decoded: dictionary of objects that have already been decoded :type decoded: dict, optional

Returns:
tuple of cleaned value
and cleaning error
Return type:tuple of list of GenericLocus, InvalidAttribute or None
serialize(coordinates, encoded=None)[source]

Serialize related object :param coordinates: a list of instances of GenericLocus Python representation :type coordinates: list of Model :param encoded: dictionary of objects that have already been encoded :type encoded: dict, optional

Returns:simple Python representation
Return type:str
class wc_kb.eukaryote_schema.ProteinSpeciesType(**kwargs)[source]

Bases: wc_kb.core.PolymerSpeciesType

Knowledge of a protein monomer

uniprot[source]

uniprot id

Type:str
transcript[source]

transcript

Type:TranscriptSpeciesType
coding_regions[source]

CDS coordinates

Type:list of LocusAttribute
Related attributes:
transcription_factor_regulation (list of TranscriptionFactorRegulation): transcription factor regulation ptm_sites (:obj:list` of PtmSite): protein modification sites
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'uniprot', 'transcript', 'coding_regions', 'identifiers', 'references', 'comments')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'circular': <obj_model.core.BooleanAttribute object>, 'coding_regions': <wc_kb.eukaryote_schema.LocusAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'double_stranded': <obj_model.core.BooleanAttribute object>, 'id': <obj_model.core.SlugAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>, 'transcript': <obj_model.core.OneToOneAttribute object>, 'uniprot': <obj_model.core.StringAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.eukaryote_schema.ProteinSpeciesType'>, <class 'wc_kb.core.PolymerSpeciesType'>, <class 'wc_kb.core.SpeciesType'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'circular': <obj_model.core.LocalAttribute object>, 'coding_regions': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'double_stranded': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'loci': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'properties': <obj_model.core.LocalAttribute object>, 'ptm_sites': <obj_model.core.LocalAttribute object>, 'reactions': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'species': <obj_model.core.LocalAttribute object>, 'species_type_coefficients': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'transcript': <obj_model.core.LocalAttribute object>, 'transcription_factor_regulation': <obj_model.core.LocalAttribute object>, 'uniprot': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.SlugAttribute object>[source]
related_attributes = {'loci': <obj_model.core.ManyToOneAttribute object>, 'properties': <obj_model.core.ManyToOneAttribute object>, 'ptm_sites': <obj_model.core.ManyToOneAttribute object>, 'reactions': <obj_model.core.ManyToManyAttribute object>, 'species': <obj_model.core.ManyToOneAttribute object>, 'species_type_coefficients': <obj_model.core.ManyToOneAttribute object>, 'transcription_factor_regulation': <obj_model.core.ManyToOneAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Protein'[source]
verbose_name_plural = 'Proteins'[source]
coding_regions = <wc_kb.eukaryote_schema.LocusAttribute object>[source]
get_charge(table=1, cds=True)[source]

Get the charge at physiological pH

Parameters:
  • table (int, optional) – NCBI identifier for translation table (default = standard table)
  • cds (bool, optional) – True indicates the sequence is a complete CDS
Returns:

charge

Return type:

int

get_empirical_formula(table=1, cds=True)[source]

Get the empirical formula

Parameters:
  • table (int, optional) – NCBI identifier for translation table (default = standard table)
  • cds (bool, optional) – True indicates the sequence is a complete CDS
Returns:

empirical formula

Return type:

chem.EmpiricalFormula

get_mol_wt(table=1, cds=True)[source]

Get the molecular weight

Parameters:
  • table (int, optional) – NCBI identifier for translation table (default = standard table)
  • cds (bool, optional) – True indicates the sequence is a complete CDS
Returns:

molecular weight

Return type:

float

get_seq(table=1, cds=True)[source]

Get the 5’ to 3’ sequence

Parameters:
  • table (int, optional) – NCBI identifier for translation table (default = standard table)
  • cds (bool, optional) – True indicates the sequence is a complete CDS
Returns:

sequence

Return type:

Bio.Seq.Seq

objects = <obj_model.core.Manager object>[source]
transcript = <obj_model.core.OneToOneAttribute object>[source]
uniprot = <obj_model.core.StringAttribute object>[source]
class wc_kb.eukaryote_schema.PtmSite(**kwargs)[source]

Bases: wc_kb.core.PolymerLocus

Knowledge of protein modification sites

modified_protein[source]

modified protein

Type:ProteinSpeciesType
type[source]

type of modification (phosphorylation, methylation, etc…)

Type:str
modified_residue[source]

residue name and position in protein sequence

Type:str
fractional_abundance[source]

ratio of modified protein abundance

Type:int
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'modified_protein', 'type', 'modified_residue', 'fractional_abundance', 'identifiers', 'references', 'comments')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'end': <obj_model.core.IntegerAttribute object>, 'fractional_abundance': <obj_model.core.FloatAttribute object>, 'id': <obj_model.core.StringAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'modified_protein': <obj_model.core.ManyToOneAttribute object>, 'modified_residue': <obj_model.core.StringAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'polymer': <obj_model.core.ManyToOneAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'start': <obj_model.core.IntegerAttribute object>, 'strand': <obj_model.core.EnumAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>, 'type': <obj_model.core.StringAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.eukaryote_schema.PtmSite'>, <class 'wc_kb.core.PolymerLocus'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'end': <obj_model.core.LocalAttribute object>, 'fractional_abundance': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'modified_protein': <obj_model.core.LocalAttribute object>, 'modified_residue': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'polymer': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'start': <obj_model.core.LocalAttribute object>, 'strand': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'type': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.StringAttribute object>[source]
related_attributes = {}[source]
unique_together = ()[source]
verbose_name = 'Ptm site'[source]
verbose_name_plural = 'Ptm sites'[source]
fractional_abundance = <obj_model.core.FloatAttribute object>[source]
modified_protein = <obj_model.core.ManyToOneAttribute object>[source]
modified_residue = <obj_model.core.StringAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
type = <obj_model.core.StringAttribute object>[source]
class wc_kb.eukaryote_schema.RegDirectionAttribute(related_name='', verbose_name='', verbose_related_name='', help='')[source]

Bases: obj_model.core.ManyToManyAttribute

Regulatory direction attribute

deserialize(value, objects, decoded=None)[source]

Deserialize value :param value: String representation :type value: str :param objects: dictionary of objects, grouped by model :type objects: dict :param decoded: dictionary of objects that have already been decoded :type decoded: dict, optional

Returns:
tuple of cleaned value
and cleaning error
Return type:tuple of list of RegDirection, InvalidAttribute or None
serialize(directions, encoded=None)[source]

Serialize related object :param directions: a list of instances of TFdirection Python representation :type directions: list of Model :param encoded: dictionary of objects that have already been encoded :type encoded: dict, optional

Returns:simple Python representation
Return type:str
class wc_kb.eukaryote_schema.RegulationType[source]

Bases: enum.Enum

Type of regulation between a regulatory element and a gene

distal = 2[source]
proximal = 1[source]
class wc_kb.eukaryote_schema.RegulatoryDirection[source]

Bases: int, enum.Enum

The direction of regulation

activation = 1[source]
repression = -1[source]
unknown = 0[source]
class wc_kb.eukaryote_schema.RegulatoryModule(**kwargs)[source]

Bases: obj_model.core.Model

Knowledge about regulatory modules

id[source]

identifier

Type:str
name[source]

name

Type:str
gene[source]

gene

Type:GeneLocus
promoter[source]

promoter ensembl ID

Type:str
activity[source]

cell-type specific activity level

Type:ActivityLevel
type[source]

type of regulation (proximal or distal)

Type:RegulationType
transcription_factor_regulation[source]

transcription factor and direction of regulation

Type:TranscriptionFactorRegulation
comments[source]

comments

Type:str
references[source]

references

Type:list of Reference
identifiers[source]

identifiers

Type:list of Identifier
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'gene', 'promoter', 'activity', 'type', 'transcription_factor_regulation', 'identifiers', 'references', 'comments')[source]
attributes = {'activity': <obj_model.core.EnumAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'gene': <obj_model.core.ManyToOneAttribute object>, 'id': <obj_model.core.SlugAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'promoter': <obj_model.core.StringAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'transcription_factor_regulation': <wc_kb.eukaryote_schema.RegDirectionAttribute object>, 'type': <obj_model.core.EnumAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.eukaryote_schema.RegulatoryModule'>,)[source]
local_attributes = {'activity': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'gene': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'promoter': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'transcription_factor_regulation': <obj_model.core.LocalAttribute object>, 'type': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.SlugAttribute object>[source]
related_attributes = {}[source]
unique_together = ()[source]
verbose_name = 'Regulatory module'[source]
verbose_name_plural = 'Regulatory modules'[source]
activity = <obj_model.core.EnumAttribute object>[source]
comments = <obj_model.core.LongStringAttribute object>[source]
gene = <obj_model.core.ManyToOneAttribute object>[source]
id = <obj_model.core.SlugAttribute object>[source]
identifiers = <wc_kb.core.IdentifierAttribute object>[source]
name = <obj_model.core.StringAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
promoter = <obj_model.core.StringAttribute object>[source]
references = <obj_model.core.ManyToManyAttribute object>[source]
transcription_factor_regulation = <wc_kb.eukaryote_schema.RegDirectionAttribute object>[source]
type = <obj_model.core.EnumAttribute object>[source]
class wc_kb.eukaryote_schema.TranscriptSpeciesType(**kwargs)[source]

Bases: wc_kb.core.PolymerSpeciesType

Knowledge of a transcript (spliced RNA) species

gene[source]

gene

Type:GeneLocus
exons[source]

exon coordinates

Type:list of LocusAttribute
type[source]

type

Type:TranscriptType
Related attributes:
protein (ProteinSpeciesType): protein
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'gene', 'exons', 'type', 'identifiers', 'references', 'comments')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'circular': <obj_model.core.BooleanAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'double_stranded': <obj_model.core.BooleanAttribute object>, 'exons': <wc_kb.eukaryote_schema.LocusAttribute object>, 'gene': <obj_model.core.ManyToOneAttribute object>, 'id': <obj_model.core.SlugAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>, 'type': <obj_model.core.EnumAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.eukaryote_schema.TranscriptSpeciesType'>, <class 'wc_kb.core.PolymerSpeciesType'>, <class 'wc_kb.core.SpeciesType'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'circular': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'double_stranded': <obj_model.core.LocalAttribute object>, 'exons': <obj_model.core.LocalAttribute object>, 'gene': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'loci': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'properties': <obj_model.core.LocalAttribute object>, 'protein': <obj_model.core.LocalAttribute object>, 'reactions': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'species': <obj_model.core.LocalAttribute object>, 'species_type_coefficients': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'type': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.SlugAttribute object>[source]
related_attributes = {'loci': <obj_model.core.ManyToOneAttribute object>, 'properties': <obj_model.core.ManyToOneAttribute object>, 'protein': <obj_model.core.OneToOneAttribute object>, 'reactions': <obj_model.core.ManyToManyAttribute object>, 'species': <obj_model.core.ManyToOneAttribute object>, 'species_type_coefficients': <obj_model.core.ManyToOneAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Transcript'[source]
verbose_name_plural = 'Transcripts'[source]
exons = <wc_kb.eukaryote_schema.LocusAttribute object>[source]
gene = <obj_model.core.ManyToOneAttribute object>[source]
get_charge()[source]

Get the charge for a transcript (spliced RNA) species with

  • 5’ monophosphate
  • Deprotonated phosphate oxygens

\(-L - 1\)

Returns:charge
Return type:int
get_empirical_formula()[source]

Get the empirical formula for a transcript (spliced RNA) species with

  • 5’ monophosphate
  • Deprotonated phosphate oxygens

\(N_A * AMP + N_C * CMP + N_G * GMP + N_U * UMP - (L-1) * OH\)

Returns:empirical formula
Return type:chem.EmpiricalFormula
get_mol_wt()[source]

Get the molecular weight for a transcript (spliced RNA) species with

  • 5’ monophosphate
  • Deprotonated phosphate oxygens
Returns:molecular weight (Da)
Return type:float
get_seq()[source]

Get the 5’ to 3’ sequence

Returns:sequence
Return type:Bio.Seq.Seq
objects = <obj_model.core.Manager object>[source]
type = <obj_model.core.EnumAttribute object>[source]
class wc_kb.eukaryote_schema.TranscriptType[source]

Bases: enum.Enum

Type of transcript

itRna = 4[source]
mRna = 1[source]
rRna = 2[source]
tRna = 3[source]
class wc_kb.eukaryote_schema.TranscriptionFactorRegulation(**kwargs)[source]

Bases: obj_model.core.Model

Transcription factor and the direction of transcriptional regulation

transcription_factor[source]

transcription factor

Type:ProteinSpeciesType
direction[source]

regulatory direction

Type:RegulatoryDirection
Related attributes:
regulatory_modules (list of RegulatoryModule): regulatory modules
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('transcription_factor', 'direction')[source]
attributes = {'direction': <obj_model.core.EnumAttribute object>, 'transcription_factor': <obj_model.core.ManyToOneAttribute object>}[source]
frozen_columns = 1[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.eukaryote_schema.TranscriptionFactorRegulation'>,)[source]
local_attributes = {'direction': <obj_model.core.LocalAttribute object>, 'regulatory_modules': <obj_model.core.LocalAttribute object>, 'transcription_factor': <obj_model.core.LocalAttribute object>}[source]
ordering = ('transcription_factor', 'direction')[source]
primary_attribute = None[source]
related_attributes = {'regulatory_modules': <wc_kb.eukaryote_schema.RegDirectionAttribute object>}[source]
tabular_orientation = 3[source]
unique_together = ()[source]
verbose_name = 'Transcription factor regulation'[source]
verbose_name_plural = 'Transcription factor regulations'[source]
classmethod deserialize(value, objects)[source]

Deserialize value :param value: String representation :type value: str :param objects: dictionary of objects, grouped by model :type objects: dict

Returns:
tuple of cleaned value
and cleaning error
Return type:tuple of list of TranscriptionFactorRegulation, InvalidAttribute or None
direction = <obj_model.core.EnumAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
serialize()[source]

Generate string representation

Returns:value of primary attribute
Return type:str
transcription_factor = <obj_model.core.ManyToOneAttribute object>[source]

2.1.6. wc_kb.io module

Reading and writing knowledge bases to/from files.

Supported file types:

  • Comma separated values (.csv)
  • Excel (.xlsx)
  • Tab separated values (.tsv)
Author:Jonathan Karr <karr@mssm.edu>
Date:2018-02-12
Copyright:2018, Karr Lab
License:MIT
class wc_kb.io.Reader[source]

Bases: obj_model.io.Reader

Read knowledge base from file(s)

run(core_path, seq_path='', rewrite_seq_path=True, taxon='prokaryote', models=None, ignore_missing_sheets=None, ignore_extra_sheets=None, ignore_sheet_order=None, include_all_attributes=False, ignore_missing_attributes=None, ignore_extra_attributes=None, ignore_attribute_order=None, group_objects_by_model=True, validate=True, read_metadata=False)[source]

Read knowledge base from file(s)

Parameters:
  • core_path (str) – path to core knowledge base
  • seq_path (str) – path to genome sequence
  • rewrite_seq_path (bool, optional) – if True, the path to genome sequence in the knowledge base will be updated to the provided seq_path
  • taxon (str, optional) – type of model order to use
  • models (types.TypeType or list of types.TypeType, optional) – type of object to read or list of types of objects to read
  • ignore_missing_sheets (bool, optional) – if False, report an error if a worksheet/ file is missing for one or more models
  • ignore_extra_sheets (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
  • group_objects_by_model (bool, optional) – if True, group decoded objects by their types
  • validate (bool, optional) – if True, validate the data
  • read_metadata (bool, optional) – if True, read metadata models
Returns:

model objects grouped by obj_model.Model class

Return type:

dict

Raises:

ValueError – if core_path

  • Defines multiple knowledge bases or cells
  • Represents objects that cannot be linked to a knowledge base and/or cell
class wc_kb.io.Writer[source]

Bases: obj_model.io.Writer

Write knowledge base to file(s)

run(core_path, knowledge_base, seq_path=None, rewrite_seq_path=True, taxon='prokaryote', models=None, get_related=True, include_all_attributes=False, validate=True, title=None, description=None, keywords=None, version=None, language=None, creator=None, extra_entries=0, data_repo_metadata=False, schema_package=None)[source]

Write knowledge base to file(s)

Parameters:
  • knowledge_base (core.KnowledgeBase) – knowledge base
  • core_path (str) – path to save core knowledge base
  • seq_path (str, optional) – path to save genome sequence
  • rewrite_seq_path (bool, optional) – if True, the path to genome sequence in the saved knowledge base will be updated to the newly saved seq_path
  • taxon (str, optional) – type of model order to use
  • 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
  • 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_model 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
Raises:

ValueError – if any of the relationships with knowledge bases and cells are not set

classmethod validate_implicit_relationships()[source]

Check that relationships to core.KnowledgeBase and core.Cell do not need to be explicitly written to workbooks because they can be inferred by Reader.run

Raises:Exception – if the Excel serialization involves an unsupported implicit relationship
validate_implicit_relationships_are_set(knowledge_base)[source]

Check that there is only 1 KnowledgeBase and <= 1 Cell and that each relationship to KnowledgeBase and Cell is set. This is necessary to enable the KnowledgeBase and Cell relationships to be implicit in the Excel output and added by Reader.run

Parameters:knowledge_base (core.KnowledgeBase) – knowledge base
Raises:ValueError – if there are multiple instances of core.KnowledgeBase in the object graph
wc_kb.io.convert(source_core, source_seq, dest_core, dest_seq, rewrite_seq_path=True)[source]

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

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

Parameters:
  • source_core (str) – path to the core of the source knowledge base
  • source_seq (str) – path to the genome sequence of the source knowledge base
  • dest_core (str) – path to save the converted core of the knowledge base
  • dest_seq (str) – path to save the converted genome sequence of the knowledge base
  • rewrite_seq_path (bool, optional) – if True, the path to genome sequence in the converted core of the knowledge base will be updated to the path of the converted genome sequence
wc_kb.io.create_template(core_path, seq_path, extra_entries=10, data_repo_metadata=True)[source]

Create file with knowledge base template, including row and column headings

Parameters:
  • core_path (str) – path to save template of core knowledge base
  • seq_path (str) – path to save genome sequence
  • 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

2.1.7. wc_kb.parse_and_insert module

2.1.8. wc_kb.prokaryote_schema module

Schema to represent a knowledge base to build models of prokaryotes

Author:Balazs Szigeti <balazs.szigeti@mssm.edu>
Author:Jonathan Karr <jonrkarr@gmail.com>
Author:Bilal Shaikh <bilal.shaikh@columbia.edu>
Author:Arthur Goldberg <Arthur.Goldberg@mssm.edu>
Author:Yin Hoon Chew <yinhoon.chew@mssm.edu>
Date:2018-09-10
Copyright:2018, Karr Lab
License:MIT
class wc_kb.prokaryote_schema.GeneLocus(**kwargs)[source]

Bases: wc_kb.core.PolymerLocus

Knowledge of a gene

symbol[source]

symbol

Type:str
Related attributes:
proteins (list of ProteinSpeciesType): protein
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'synonyms', 'symbol', 'polymer', 'start', 'end', 'cog', 'homologs', 'is_essential', 'proteins', 'evidence', 'identifiers', 'references', 'comments')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'cog': <obj_model.ontology.OntologyAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'end': <obj_model.core.IntegerAttribute object>, 'evidence': <obj_model.core.OneToManyAttribute object>, 'homologs': <obj_model.core.LongStringAttribute object>, 'id': <obj_model.core.StringAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'is_essential': <obj_model.core.BooleanAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'polymer': <obj_model.core.ManyToOneAttribute object>, 'proteins': <obj_model.core.OneToOneAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'start': <obj_model.core.IntegerAttribute object>, 'strand': <obj_model.core.EnumAttribute object>, 'symbol': <obj_model.core.StringAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.prokaryote_schema.GeneLocus'>, <class 'wc_kb.core.PolymerLocus'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'cog': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'end': <obj_model.core.LocalAttribute object>, 'evidence': <obj_model.core.LocalAttribute object>, 'homologs': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'is_essential': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'polymer': <obj_model.core.LocalAttribute object>, 'proteins': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'start': <obj_model.core.LocalAttribute object>, 'strand': <obj_model.core.LocalAttribute object>, 'symbol': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'transcription_units': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.StringAttribute object>[source]
related_attributes = {'transcription_units': <obj_model.core.OneToManyAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Gene'[source]
verbose_name_plural = 'Genes'[source]
cog = <obj_model.ontology.OntologyAttribute object>[source]
end = <obj_model.core.IntegerAttribute object>[source]
evidence = <obj_model.core.OneToManyAttribute object>[source]
homologs = <obj_model.core.LongStringAttribute object>[source]
is_essential = <obj_model.core.BooleanAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
proteins = <obj_model.core.OneToOneAttribute object>[source]
start = <obj_model.core.IntegerAttribute object>[source]
symbol = <obj_model.core.StringAttribute object>[source]
class wc_kb.prokaryote_schema.ProteinSpeciesType(**kwargs)[source]

Bases: wc_kb.core.PolymerSpeciesType

Knowledge of a protein monomer

gene[source]

gene

Type:GeneLocus
rna[source]

rna

Type:RnaSpeciesType
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'synonyms', 'type', 'identifiers', 'references', 'comments')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'circular': <obj_model.core.BooleanAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'double_stranded': <obj_model.core.BooleanAttribute object>, 'id': <obj_model.core.SlugAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>, 'type': <obj_model.ontology.OntologyAttribute object>, 'unit': <obj_model.core.StringAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.prokaryote_schema.ProteinSpeciesType'>, <class 'wc_kb.core.PolymerSpeciesType'>, <class 'wc_kb.core.SpeciesType'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'circular': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'double_stranded': <obj_model.core.LocalAttribute object>, 'gene': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'loci': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'properties': <obj_model.core.LocalAttribute object>, 'reactions': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'rnas': <obj_model.core.LocalAttribute object>, 'species': <obj_model.core.LocalAttribute object>, 'species_type_coefficients': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'type': <obj_model.core.LocalAttribute object>, 'unit': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.SlugAttribute object>[source]
related_attributes = {'gene': <obj_model.core.OneToOneAttribute object>, 'loci': <obj_model.core.ManyToOneAttribute object>, 'properties': <obj_model.core.ManyToOneAttribute object>, 'reactions': <obj_model.core.ManyToManyAttribute object>, 'rnas': <obj_model.core.OneToManyAttribute object>, 'species': <obj_model.core.ManyToOneAttribute object>, 'species_type_coefficients': <obj_model.core.ManyToOneAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Protein'[source]
verbose_name_plural = 'Proteins'[source]
get_charge(cds=True)[source]

Get the charge at physiological pH

Returns:charge
Return type:int
get_empirical_formula(cds=True)[source]

Get the empirical formula

Returns:empirical formula
Return type:chem.EmpiricalFormula
get_mol_wt(cds=True)[source]

Get the molecular weight

Returns:molecular weight
Return type:float
get_seq(cds=True)[source]

Get the sequence

Returns:sequence
Return type:Bio.Seq.Seq
objects = <obj_model.core.Manager object>[source]
type = <obj_model.ontology.OntologyAttribute object>[source]
unit = <obj_model.core.StringAttribute object>[source]
class wc_kb.prokaryote_schema.RnaSpeciesType(**kwargs)[source]

Bases: wc_kb.core.PolymerSpeciesType

Knowledge of an RNA species

transcription_units[source]

transcription units

Type:list of TranscriptionUnitLocus
type[source]

type

Type:RnaType
Related attributes:
proteins (list of ProteinSpeciesType): protein(s)
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'synonyms', 'type', 'start', 'end', 'proteins', 'identifiers', 'references', 'comments')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'circular': <obj_model.core.BooleanAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'coordinate': <obj_model.core.IntegerAttribute object>, 'double_stranded': <obj_model.core.BooleanAttribute object>, 'end': <obj_model.core.IntegerAttribute object>, 'id': <obj_model.core.SlugAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'length': <obj_model.core.IntegerAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'proteins': <obj_model.core.OneToManyAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'start': <obj_model.core.IntegerAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>, 'type': <obj_model.ontology.OntologyAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.prokaryote_schema.RnaSpeciesType'>, <class 'wc_kb.core.PolymerSpeciesType'>, <class 'wc_kb.core.SpeciesType'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'circular': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'coordinate': <obj_model.core.LocalAttribute object>, 'double_stranded': <obj_model.core.LocalAttribute object>, 'end': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'length': <obj_model.core.LocalAttribute object>, 'loci': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'properties': <obj_model.core.LocalAttribute object>, 'proteins': <obj_model.core.LocalAttribute object>, 'reactions': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'species': <obj_model.core.LocalAttribute object>, 'species_type_coefficients': <obj_model.core.LocalAttribute object>, 'start': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>, 'transcription_units': <obj_model.core.LocalAttribute object>, 'type': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.SlugAttribute object>[source]
related_attributes = {'loci': <obj_model.core.ManyToOneAttribute object>, 'properties': <obj_model.core.ManyToOneAttribute object>, 'reactions': <obj_model.core.ManyToManyAttribute object>, 'species': <obj_model.core.ManyToOneAttribute object>, 'species_type_coefficients': <obj_model.core.ManyToOneAttribute object>, 'transcription_units': <obj_model.core.ManyToManyAttribute object>}[source]
unique_together = ()[source]
verbose_name = 'Rna species type'[source]
verbose_name_plural = 'RNAs'[source]
coordinate = <obj_model.core.IntegerAttribute object>[source]
end = <obj_model.core.IntegerAttribute object>[source]
get_charge()[source]

Get the charge for a transcript with

  • 5’ monophosphate
  • Deprotonated phosphate oxygens

\(-L - 1\)

Returns:charge
Return type:int
get_direction()[source]

Returns the direction of the polymer feature defind by its strand and start/end coordinate :returns: direction (in [‘forward’, ‘reverse’]) :rtype: str

Raises:
  • obj:ValueError: start and end coordinate of chromosome feature can not be the same
  • obj:Exception: strand is not member of PolymerStrand
get_empirical_formula()[source]

Get the empirical formula for an RNA transcript with

  • 5’ monophosphate
  • Deprotonated phosphate oxygens

\(N_A * AMP + N_C * CMP + N_G * GMP + N_U * UMP - (L-1) * OH\)

Returns:empirical formula
Return type:chem.EmpiricalFormula
get_mol_wt()[source]

Get the molecular weight for a transcript with

  • 5’ monophosphate
  • Deprotonated phosphate oxygens
Returns:molecular weight (Da)
Return type:float
get_seq()[source]

Get the sequence

Returns:sequence
Return type:Bio.Seq.Seq
length = <obj_model.core.IntegerAttribute object>[source]
objects = <obj_model.core.Manager object>[source]
proteins = <obj_model.core.OneToManyAttribute object>[source]
start = <obj_model.core.IntegerAttribute object>[source]
type = <obj_model.ontology.OntologyAttribute object>[source]
class wc_kb.prokaryote_schema.TranscriptionUnitLocus(**kwargs)[source]

Bases: wc_kb.core.PolymerLocus

Knowledge about an open reading frame

genes[source]

genes

Type:list of GeneLocus
class Meta[source]

Bases: obj_model.core.Meta

attribute_order = ('id', 'name', 'polymer', 'strand', 'pribnow_start', 'pribnow_end', 'start', 'end', 'rnas', 'genes', 'identifiers', 'references', 'comments')[source]
attributes = {'cell': <obj_model.core.ManyToOneAttribute object>, 'comments': <obj_model.core.LongStringAttribute object>, 'end': <obj_model.core.IntegerAttribute object>, 'genes': <obj_model.core.OneToManyAttribute object>, 'id': <obj_model.core.StringAttribute object>, 'identifiers': <wc_kb.core.IdentifierAttribute object>, 'name': <obj_model.core.StringAttribute object>, 'polymer': <obj_model.core.ManyToOneAttribute object>, 'pribnow_end': <obj_model.core.IntegerAttribute object>, 'pribnow_start': <obj_model.core.IntegerAttribute object>, 'references': <obj_model.core.ManyToManyAttribute object>, 'rnas': <obj_model.core.ManyToManyAttribute object>, 'start': <obj_model.core.IntegerAttribute object>, 'strand': <obj_model.core.EnumAttribute object>, 'synonyms': <obj_model.core.StringAttribute object>}[source]
indexed_attrs_tuples = ()[source]
inheritance = (<class 'wc_kb.prokaryote_schema.TranscriptionUnitLocus'>, <class 'wc_kb.core.PolymerLocus'>, <class 'wc_kb.core.KnowledgeBaseObject'>)[source]
local_attributes = {'cell': <obj_model.core.LocalAttribute object>, 'comments': <obj_model.core.LocalAttribute object>, 'end': <obj_model.core.LocalAttribute object>, 'genes': <obj_model.core.LocalAttribute object>, 'id': <obj_model.core.LocalAttribute object>, 'identifiers': <obj_model.core.LocalAttribute object>, 'name': <obj_model.core.LocalAttribute object>, 'polymer': <obj_model.core.LocalAttribute object>, 'pribnow_end': <obj_model.core.LocalAttribute object>, 'pribnow_start': <obj_model.core.LocalAttribute object>, 'references': <obj_model.core.LocalAttribute object>, 'rnas': <obj_model.core.LocalAttribute object>, 'start': <obj_model.core.LocalAttribute object>, 'strand': <obj_model.core.LocalAttribute object>, 'synonyms': <obj_model.core.LocalAttribute object>}[source]
ordering = ('id',)[source]
primary_attribute = <obj_model.core.StringAttribute object>[source]
related_attributes = {}[source]
unique_together = ()[source]
verbose_name = 'Transcription units'[source]
verbose_name_plural = 'Transcription unitss'[source]
genes = <obj_model.core.OneToManyAttribute object>[source]
get_3_prime()[source]

Get the 3’ coordinate

Returns:3’ coordinate
Return type:int
get_5_prime()[source]

Get the 5’ coordinate

Returns:5’ coordinate
Return type:int
objects = <obj_model.core.Manager object>[source]
pribnow_end = <obj_model.core.IntegerAttribute object>[source]
pribnow_start = <obj_model.core.IntegerAttribute object>[source]
rnas = <obj_model.core.ManyToManyAttribute object>[source]

2.1.9. wc_kb.translate module

2.1.10. wc_kb.util module

Utilities

Author:Jonathan Karr <karr@mssm.edu>
Date:2018-02-12
Copyright:2018, Karr Lab
License:MIT
wc_kb.util.get_models(inline=True)[source]

Get list of models

Parameters:inline (bool, optional) – if true, return inline models
Returns:list of models
Return type:list of class

2.1.11. Module contents