biocrnpyler.components.basic

Classes

ChemicalComplex(species[, name, ...])

A complex forms when two or more species bind together Complexes inherit the attributes of their species.

DNA(name[, length, attributes])

The DNA class is used to represent a DNA sequence that has a given length.

Enzyme(enzyme, substrates, products[, ...])

A class to represent Enzymes with multiple substrates and products.

Metabolite(name[, attributes, precursors, ...])

Initialize a Metabolite object to store Metabolite related information.

Protein(name[, length, attributes])

A class to represent Components made of Protein.

RNA(name[, length, attributes])

A class to represent Components made of RNA.

class biocrnpyler.components.basic.ChemicalComplex(species: List[Species], name: str = None, material_type='complex', attributes=None, **keywords)[source]

A complex forms when two or more species bind together Complexes inherit the attributes of their species.

Initialize a ChemicalComplex object to store ChemicalComplex related information.

Parameters:
  • species – list of species inside a complex

  • name – name of the complex

  • material_type – option to rename the material_type, default: complex

  • attributes – Species attribute

  • keywords – pass into the parent’s (Component) initializer

add_mechanism(mechanism: Mechanism, mech_type=None, overwrite=False, optional_mechanism=False)[source]

adds a mechanism of type mech_type to the Component Mechanism dictionary.

Parameters:
  • mechanism

  • mech_type

  • overwrite – toggles whether the mechanism is added overwriting any mechanism with the same key.

  • optional_mechanism – toggles whether an error is thrown if a Mechanism is added that conflicts with an exising Mechanism

Returns:

add_mechanisms(mechanisms: Mechanism | GlobalMechanism, overwrite=False, optional_mechanism=False)[source]

This function adds a list or dictionary of mechanisms to the mixture.

Parameters:
  • mechanisms – Can take both GlobalMechanisms and Mechanisms

  • overwrite – toggles whether the mechanism is added overwriting any mechanism with the same key.

  • optional_mechanism – toggles whether an error is thrown if a Mechanism is added that conflicts with an exising Mechanism

Returns:

property compartment

The compartment of the Component.

Returns:

Compartment

enumerate_components(**keywords) List[source]

this is for component enumeration. Usually you will return a list of components that are copies of existing ones (first list) and new components (second list). For example, A DNA_construct makes a list of copies of its parts as the first output, and a list of RNA_constructs as the second output. An RNA_construct will make a list of copies of its parts as the first output, and a list of Protein components as its second output (if it makes any proteins)

get_mechanism(mechanism_type, optional_mechanism=False)[source]

Searches the Component for a Mechanism of the correct type.

If the Component does not have the mechanism, searches the Components’ Mixture for the Mechanism.

Parameters:
  • mechanism_type

  • optional_mechanism – toggles whether an error is thrown if no mechanism is found

Returns:

get_parameter(param_name: str, part_id=None, mechanism=None, return_numerical=False, return_none=False, check_mixture=True) Parameter | Real[source]

Get a parameter from different objects that hold parameters.

Hierarchy:
  1. tries to find the Parameter in Component.parameter_database

  2. tries to find the parameter in Component.mixture.parameter_database

Parameters:
  • param_name

  • part_id

  • mechanism

  • return_numerical – numerical value or the parameter object is returned

  • return_none – returns None instead of throwing an error if a parameter isn’t found

  • check_mixture – toggle whether or not to check the Component’s Mixture as well

Returns:

Parameter object or a Real number

get_species() List[Species][source]

The subclasses should implement this method!

Returns:

None

set_mixture(mixture) None[source]

Set the mixture the Component is in.

Parameters:

mixture

Returns:

None

classmethod set_species(species: Species | str, material_type=None, compartment=None, attributes=None) Species[source]

Helper function that allows species to be set from strings, species, or Components

Parameters:
  • species – Species, str, Component

  • material_type

  • compartment

  • attributes

Returns:

Species

update_parameters(parameter_file=None, parameters=None, parameter_database=None, overwrite_parameters=True)[source]

Updates the ParameterDatabase inside a Component

Possible inputs:

parameter_file (string) parameters (dict) parameter_database (ParameterDatabase)

update_reactions() List[Reaction][source]

The subclasses should implement this method!

Returns:

empty list

update_species() List[Species][source]

The subclasses should implement this method!

Returns:

empty list

class biocrnpyler.components.basic.DNA(name, length=0, attributes=None, **keywords)[source]

The DNA class is used to represent a DNA sequence that has a given length.

Produces no reactions.

Initialize a DNA object to store DNA related information.

Parameters:
  • name – Name of the sequence (str)

  • length – length of the basepairs (int)

  • attributes – Species attribute

  • keywords – pass into the parent’s (Component) initializer

add_mechanism(mechanism: Mechanism, mech_type=None, overwrite=False, optional_mechanism=False)[source]

adds a mechanism of type mech_type to the Component Mechanism dictionary.

Parameters:
  • mechanism

  • mech_type

  • overwrite – toggles whether the mechanism is added overwriting any mechanism with the same key.

  • optional_mechanism – toggles whether an error is thrown if a Mechanism is added that conflicts with an exising Mechanism

Returns:

add_mechanisms(mechanisms: Mechanism | GlobalMechanism, overwrite=False, optional_mechanism=False)[source]

This function adds a list or dictionary of mechanisms to the mixture.

Parameters:
  • mechanisms – Can take both GlobalMechanisms and Mechanisms

  • overwrite – toggles whether the mechanism is added overwriting any mechanism with the same key.

  • optional_mechanism – toggles whether an error is thrown if a Mechanism is added that conflicts with an exising Mechanism

Returns:

property compartment

The compartment of the Component.

Returns:

Compartment

enumerate_components(**keywords) List[source]

this is for component enumeration. Usually you will return a list of components that are copies of existing ones (first list) and new components (second list). For example, A DNA_construct makes a list of copies of its parts as the first output, and a list of RNA_constructs as the second output. An RNA_construct will make a list of copies of its parts as the first output, and a list of Protein components as its second output (if it makes any proteins)

get_mechanism(mechanism_type, optional_mechanism=False)[source]

Searches the Component for a Mechanism of the correct type.

If the Component does not have the mechanism, searches the Components’ Mixture for the Mechanism.

Parameters:
  • mechanism_type

  • optional_mechanism – toggles whether an error is thrown if no mechanism is found

Returns:

get_parameter(param_name: str, part_id=None, mechanism=None, return_numerical=False, return_none=False, check_mixture=True) Parameter | Real[source]

Get a parameter from different objects that hold parameters.

Hierarchy:
  1. tries to find the Parameter in Component.parameter_database

  2. tries to find the parameter in Component.mixture.parameter_database

Parameters:
  • param_name

  • part_id

  • mechanism

  • return_numerical – numerical value or the parameter object is returned

  • return_none – returns None instead of throwing an error if a parameter isn’t found

  • check_mixture – toggle whether or not to check the Component’s Mixture as well

Returns:

Parameter object or a Real number

get_species() Species[source]

The subclasses should implement this method!

Returns:

None

set_mixture(mixture) None[source]

Set the mixture the Component is in.

Parameters:

mixture

Returns:

None

classmethod set_species(species: Species | str, material_type=None, compartment=None, attributes=None) Species[source]

Helper function that allows species to be set from strings, species, or Components

Parameters:
  • species – Species, str, Component

  • material_type

  • compartment

  • attributes

Returns:

Species

update_parameters(parameter_file=None, parameters=None, parameter_database=None, overwrite_parameters=True)[source]

Updates the ParameterDatabase inside a Component

Possible inputs:

parameter_file (string) parameters (dict) parameter_database (ParameterDatabase)

update_reactions() List[source]

The subclasses should implement this method!

Returns:

empty list

update_species() List[Species][source]

The subclasses should implement this method!

Returns:

empty list

class biocrnpyler.components.basic.Enzyme(enzyme: Species | str | Component, substrates: List[Species | str | Component], products: List[Species | str | Component], attributes=None, **keywords)[source]

A class to represent Enzymes with multiple substrates and products.

Assumes the enzyme converts all substrates to a all products at once. For example: S1 + S2 + … + S_N + E –> P1 + P2 + … + P_M + E. For enzymes with multiple enzymatic reactions, create multiple Enzyme Components with the same internal species. Uses a mechanism called “catalysis”

Initialize an MultiEnzyme object to store MultiEnzyme related information.

Parameters:
  • enzyme – name of the enzyme or reference to an Species or Component

  • substrates – list of (name of the substrate or reference to an Species or Component)

  • products – list of (name of the product or reference to an Species or Component)

  • attributes – Species attribute

  • keywords – pass into the parent’s (Component) initializer

add_mechanism(mechanism: Mechanism, mech_type=None, overwrite=False, optional_mechanism=False)[source]

adds a mechanism of type mech_type to the Component Mechanism dictionary.

Parameters:
  • mechanism

  • mech_type

  • overwrite – toggles whether the mechanism is added overwriting any mechanism with the same key.

  • optional_mechanism – toggles whether an error is thrown if a Mechanism is added that conflicts with an exising Mechanism

Returns:

add_mechanisms(mechanisms: Mechanism | GlobalMechanism, overwrite=False, optional_mechanism=False)[source]

This function adds a list or dictionary of mechanisms to the mixture.

Parameters:
  • mechanisms – Can take both GlobalMechanisms and Mechanisms

  • overwrite – toggles whether the mechanism is added overwriting any mechanism with the same key.

  • optional_mechanism – toggles whether an error is thrown if a Mechanism is added that conflicts with an exising Mechanism

Returns:

property compartment

The compartment of the Component.

Returns:

Compartment

enumerate_components(**keywords) List[source]

this is for component enumeration. Usually you will return a list of components that are copies of existing ones (first list) and new components (second list). For example, A DNA_construct makes a list of copies of its parts as the first output, and a list of RNA_constructs as the second output. An RNA_construct will make a list of copies of its parts as the first output, and a list of Protein components as its second output (if it makes any proteins)

get_mechanism(mechanism_type, optional_mechanism=False)[source]

Searches the Component for a Mechanism of the correct type.

If the Component does not have the mechanism, searches the Components’ Mixture for the Mechanism.

Parameters:
  • mechanism_type

  • optional_mechanism – toggles whether an error is thrown if no mechanism is found

Returns:

get_parameter(param_name: str, part_id=None, mechanism=None, return_numerical=False, return_none=False, check_mixture=True) Parameter | Real[source]

Get a parameter from different objects that hold parameters.

Hierarchy:
  1. tries to find the Parameter in Component.parameter_database

  2. tries to find the parameter in Component.mixture.parameter_database

Parameters:
  • param_name

  • part_id

  • mechanism

  • return_numerical – numerical value or the parameter object is returned

  • return_none – returns None instead of throwing an error if a parameter isn’t found

  • check_mixture – toggle whether or not to check the Component’s Mixture as well

Returns:

Parameter object or a Real number

get_species() Species[source]

The subclasses should implement this method!

Returns:

None

set_mixture(mixture) None[source]

Set the mixture the Component is in.

Parameters:

mixture

Returns:

None

classmethod set_species(species: Species | str, material_type=None, compartment=None, attributes=None) Species[source]

Helper function that allows species to be set from strings, species, or Components

Parameters:
  • species – Species, str, Component

  • material_type

  • compartment

  • attributes

Returns:

Species

update_parameters(parameter_file=None, parameters=None, parameter_database=None, overwrite_parameters=True)[source]

Updates the ParameterDatabase inside a Component

Possible inputs:

parameter_file (string) parameters (dict) parameter_database (ParameterDatabase)

update_reactions() List[Reaction][source]

The subclasses should implement this method!

Returns:

empty list

update_species() List[Species][source]

The subclasses should implement this method!

Returns:

empty list

class biocrnpyler.components.basic.Metabolite(name: str, attributes=None, precursors=None, products=None, **keywords)[source]

Initialize a Metabolite object to store Metabolite related information. Metabolites look for “production” and “degredation” mechanisms, but will not throw an error if none are found.

Parameters:
  • name – name of the protein

  • attributes – Species attribute

  • precursors – list of chemical species which are directly transformed into this metabolite via the production mechanism

  • products – list of chemical species directly produced from this metabolite via the degredation mechanism

  • keywords – pass into the parent’s (Component) initializer

add_mechanism(mechanism: Mechanism, mech_type=None, overwrite=False, optional_mechanism=False)[source]

adds a mechanism of type mech_type to the Component Mechanism dictionary.

Parameters:
  • mechanism

  • mech_type

  • overwrite – toggles whether the mechanism is added overwriting any mechanism with the same key.

  • optional_mechanism – toggles whether an error is thrown if a Mechanism is added that conflicts with an exising Mechanism

Returns:

add_mechanisms(mechanisms: Mechanism | GlobalMechanism, overwrite=False, optional_mechanism=False)[source]

This function adds a list or dictionary of mechanisms to the mixture.

Parameters:
  • mechanisms – Can take both GlobalMechanisms and Mechanisms

  • overwrite – toggles whether the mechanism is added overwriting any mechanism with the same key.

  • optional_mechanism – toggles whether an error is thrown if a Mechanism is added that conflicts with an exising Mechanism

Returns:

property compartment

The compartment of the Component.

Returns:

Compartment

enumerate_components(**keywords) List[source]

this is for component enumeration. Usually you will return a list of components that are copies of existing ones (first list) and new components (second list). For example, A DNA_construct makes a list of copies of its parts as the first output, and a list of RNA_constructs as the second output. An RNA_construct will make a list of copies of its parts as the first output, and a list of Protein components as its second output (if it makes any proteins)

get_mechanism(mechanism_type, optional_mechanism=False)[source]

Searches the Component for a Mechanism of the correct type.

If the Component does not have the mechanism, searches the Components’ Mixture for the Mechanism.

Parameters:
  • mechanism_type

  • optional_mechanism – toggles whether an error is thrown if no mechanism is found

Returns:

get_parameter(param_name: str, part_id=None, mechanism=None, return_numerical=False, return_none=False, check_mixture=True) Parameter | Real[source]

Get a parameter from different objects that hold parameters.

Hierarchy:
  1. tries to find the Parameter in Component.parameter_database

  2. tries to find the parameter in Component.mixture.parameter_database

Parameters:
  • param_name

  • part_id

  • mechanism

  • return_numerical – numerical value or the parameter object is returned

  • return_none – returns None instead of throwing an error if a parameter isn’t found

  • check_mixture – toggle whether or not to check the Component’s Mixture as well

Returns:

Parameter object or a Real number

get_species() Species[source]

The subclasses should implement this method!

Returns:

None

set_mixture(mixture) None[source]

Set the mixture the Component is in.

Parameters:

mixture

Returns:

None

classmethod set_species(species: Species | str, material_type=None, compartment=None, attributes=None) Species[source]

Helper function that allows species to be set from strings, species, or Components

Parameters:
  • species – Species, str, Component

  • material_type

  • compartment

  • attributes

Returns:

Species

update_parameters(parameter_file=None, parameters=None, parameter_database=None, overwrite_parameters=True)[source]

Updates the ParameterDatabase inside a Component

Possible inputs:

parameter_file (string) parameters (dict) parameter_database (ParameterDatabase)

update_reactions() List[source]

The subclasses should implement this method!

Returns:

empty list

update_species() List[Species][source]

The subclasses should implement this method!

Returns:

empty list

class biocrnpyler.components.basic.Protein(name: str, length=0, attributes=None, **keywords)[source]

A class to represent Components made of Protein. Produces no reactions.

Initialize a Protein object to store Protein related information.

Parameters:
  • name – name of the protein

  • length – length of the protein in number of amino acids

  • attributes – Species attribute

  • keywords – pass into the parent’s (Component) initializer

add_mechanism(mechanism: Mechanism, mech_type=None, overwrite=False, optional_mechanism=False)[source]

adds a mechanism of type mech_type to the Component Mechanism dictionary.

Parameters:
  • mechanism

  • mech_type

  • overwrite – toggles whether the mechanism is added overwriting any mechanism with the same key.

  • optional_mechanism – toggles whether an error is thrown if a Mechanism is added that conflicts with an exising Mechanism

Returns:

add_mechanisms(mechanisms: Mechanism | GlobalMechanism, overwrite=False, optional_mechanism=False)[source]

This function adds a list or dictionary of mechanisms to the mixture.

Parameters:
  • mechanisms – Can take both GlobalMechanisms and Mechanisms

  • overwrite – toggles whether the mechanism is added overwriting any mechanism with the same key.

  • optional_mechanism – toggles whether an error is thrown if a Mechanism is added that conflicts with an exising Mechanism

Returns:

property compartment

The compartment of the Component.

Returns:

Compartment

enumerate_components(**keywords) List[source]

this is for component enumeration. Usually you will return a list of components that are copies of existing ones (first list) and new components (second list). For example, A DNA_construct makes a list of copies of its parts as the first output, and a list of RNA_constructs as the second output. An RNA_construct will make a list of copies of its parts as the first output, and a list of Protein components as its second output (if it makes any proteins)

get_mechanism(mechanism_type, optional_mechanism=False)[source]

Searches the Component for a Mechanism of the correct type.

If the Component does not have the mechanism, searches the Components’ Mixture for the Mechanism.

Parameters:
  • mechanism_type

  • optional_mechanism – toggles whether an error is thrown if no mechanism is found

Returns:

get_parameter(param_name: str, part_id=None, mechanism=None, return_numerical=False, return_none=False, check_mixture=True) Parameter | Real[source]

Get a parameter from different objects that hold parameters.

Hierarchy:
  1. tries to find the Parameter in Component.parameter_database

  2. tries to find the parameter in Component.mixture.parameter_database

Parameters:
  • param_name

  • part_id

  • mechanism

  • return_numerical – numerical value or the parameter object is returned

  • return_none – returns None instead of throwing an error if a parameter isn’t found

  • check_mixture – toggle whether or not to check the Component’s Mixture as well

Returns:

Parameter object or a Real number

get_species() Species[source]

The subclasses should implement this method!

Returns:

None

set_mixture(mixture) None[source]

Set the mixture the Component is in.

Parameters:

mixture

Returns:

None

classmethod set_species(species: Species | str, material_type=None, compartment=None, attributes=None) Species[source]

Helper function that allows species to be set from strings, species, or Components

Parameters:
  • species – Species, str, Component

  • material_type

  • compartment

  • attributes

Returns:

Species

update_parameters(parameter_file=None, parameters=None, parameter_database=None, overwrite_parameters=True)[source]

Updates the ParameterDatabase inside a Component

Possible inputs:

parameter_file (string) parameters (dict) parameter_database (ParameterDatabase)

update_reactions() List[source]

The subclasses should implement this method!

Returns:

empty list

update_species() List[Species][source]

The subclasses should implement this method!

Returns:

empty list

class biocrnpyler.components.basic.RNA(name: str, length=0, attributes=None, **keywords)[source]

A class to represent Components made of RNA. Produces no reactions.

Initialize a RNA object to store RNA related information

Parameters:
  • name – name of the rna

  • length – number of basepairs (int)

  • attributes – Species attribute

  • keywords – pass into the parent’s (Component) initializer

add_mechanism(mechanism: Mechanism, mech_type=None, overwrite=False, optional_mechanism=False)[source]

adds a mechanism of type mech_type to the Component Mechanism dictionary.

Parameters:
  • mechanism

  • mech_type

  • overwrite – toggles whether the mechanism is added overwriting any mechanism with the same key.

  • optional_mechanism – toggles whether an error is thrown if a Mechanism is added that conflicts with an exising Mechanism

Returns:

add_mechanisms(mechanisms: Mechanism | GlobalMechanism, overwrite=False, optional_mechanism=False)[source]

This function adds a list or dictionary of mechanisms to the mixture.

Parameters:
  • mechanisms – Can take both GlobalMechanisms and Mechanisms

  • overwrite – toggles whether the mechanism is added overwriting any mechanism with the same key.

  • optional_mechanism – toggles whether an error is thrown if a Mechanism is added that conflicts with an exising Mechanism

Returns:

property compartment

The compartment of the Component.

Returns:

Compartment

enumerate_components(**keywords) List[source]

this is for component enumeration. Usually you will return a list of components that are copies of existing ones (first list) and new components (second list). For example, A DNA_construct makes a list of copies of its parts as the first output, and a list of RNA_constructs as the second output. An RNA_construct will make a list of copies of its parts as the first output, and a list of Protein components as its second output (if it makes any proteins)

get_mechanism(mechanism_type, optional_mechanism=False)[source]

Searches the Component for a Mechanism of the correct type.

If the Component does not have the mechanism, searches the Components’ Mixture for the Mechanism.

Parameters:
  • mechanism_type

  • optional_mechanism – toggles whether an error is thrown if no mechanism is found

Returns:

get_parameter(param_name: str, part_id=None, mechanism=None, return_numerical=False, return_none=False, check_mixture=True) Parameter | Real[source]

Get a parameter from different objects that hold parameters.

Hierarchy:
  1. tries to find the Parameter in Component.parameter_database

  2. tries to find the parameter in Component.mixture.parameter_database

Parameters:
  • param_name

  • part_id

  • mechanism

  • return_numerical – numerical value or the parameter object is returned

  • return_none – returns None instead of throwing an error if a parameter isn’t found

  • check_mixture – toggle whether or not to check the Component’s Mixture as well

Returns:

Parameter object or a Real number

get_species() Species[source]

The subclasses should implement this method!

Returns:

None

set_mixture(mixture) None[source]

Set the mixture the Component is in.

Parameters:

mixture

Returns:

None

classmethod set_species(species: Species | str, material_type=None, compartment=None, attributes=None) Species[source]

Helper function that allows species to be set from strings, species, or Components

Parameters:
  • species – Species, str, Component

  • material_type

  • compartment

  • attributes

Returns:

Species

update_parameters(parameter_file=None, parameters=None, parameter_database=None, overwrite_parameters=True)[source]

Updates the ParameterDatabase inside a Component

Possible inputs:

parameter_file (string) parameters (dict) parameter_database (ParameterDatabase)

update_reactions() List[source]

The subclasses should implement this method!

Returns:

empty list

update_species() List[Species][source]

The subclasses should implement this method!

Returns:

empty list