Measurement#

pydantic model pyenzyme.enzymeml.core.measurement.Measurement[source]#

Bases: EnzymeMLBase

Show JSON schema
{
   "title": "Measurement",
   "type": "object",
   "properties": {
      "name": {
         "title": "Name",
         "description": "Name of the measurement",
         "type": "string"
      },
      "temperature": {
         "title": "Temperature",
         "description": "Numeric value of the temperature of the reaction.",
         "template_alias": "Temperature value",
         "type": "number"
      },
      "temperature_unit": {
         "title": "Temperature Unit",
         "description": "Unit of the temperature of the reaction.",
         "pattern": "kelvin|Kelvin|k|K|celsius|Celsius|C|c",
         "type": "string"
      },
      "ph": {
         "title": "Ph",
         "description": "PH value of the reaction.",
         "inclusiveMinimum": 0,
         "inclusiveMaximum": 14,
         "type": "number"
      },
      "species_dict": {
         "title": "Species Dict",
         "description": "Species of the measurement.",
         "default": {
            "proteins": {},
            "reactants": {}
         },
         "type": "object",
         "additionalProperties": {
            "type": "object",
            "additionalProperties": {
               "$ref": "#/definitions/MeasurementData"
            }
         }
      },
      "global_time": {
         "title": "Global Time",
         "description": "Global time of the measurement all replicates agree on.",
         "type": "array",
         "items": {
            "type": "number"
         }
      },
      "global_time_unit": {
         "title": "Global Time Unit",
         "description": "Unit of the global time.",
         "type": "string"
      },
      "id": {
         "title": "Id",
         "description": "Unique identifier of the measurement.",
         "pattern": "m[\\d]+",
         "type": "string"
      },
      "uri": {
         "title": "Uri",
         "description": "URI of the reaction.",
         "type": "string"
      },
      "creator_id": {
         "title": "Creator Id",
         "description": "Unique identifier of the author.",
         "type": "string"
      }
   },
   "required": [
      "name"
   ],
   "definitions": {
      "DataTypes": {
         "title": "DataTypes",
         "description": "String enumeration used to assign replicate type ontologies",
         "enum": [
            "conc",
            "abs",
            "feed",
            "biomass",
            "conversion",
            "peak-area"
         ],
         "type": "string"
      },
      "Replicate": {
         "title": "Replicate",
         "type": "object",
         "properties": {
            "id": {
               "title": "Id",
               "description": "Unique identifier of the replicate",
               "type": "string"
            },
            "species_id": {
               "title": "Species Id",
               "description": "Unique identifier of the species that has been measured.",
               "pattern": "[s|r|p][\\d]+",
               "type": "string"
            },
            "measurement_id": {
               "title": "Measurement Id",
               "description": "Unique identifier of the measurement that the replicate is part of.",
               "pattern": "m[\\d]+",
               "type": "string"
            },
            "data_type": {
               "description": "Type of data that was measured (e.g. concentration)",
               "default": "conc",
               "allOf": [
                  {
                     "$ref": "#/definitions/DataTypes"
                  }
               ]
            },
            "data_unit": {
               "title": "Data Unit",
               "description": "SI unit of the data that was measured.",
               "type": "string"
            },
            "time_unit": {
               "title": "Time Unit",
               "description": "Time unit of the replicate.",
               "type": "string"
            },
            "time": {
               "title": "Time",
               "description": "Time steps of the replicate.",
               "type": "array",
               "items": {
                  "type": "number"
               }
            },
            "data": {
               "title": "Data",
               "description": "Data that was measured.",
               "type": "array",
               "items": {
                  "type": "number"
               }
            },
            "is_calculated": {
               "title": "Is Calculated",
               "description": "Whether or not the data has been generated by simulation.",
               "default": false,
               "type": "boolean"
            },
            "uri": {
               "title": "Uri",
               "description": "URI of the protein.",
               "type": "string"
            },
            "creator_id": {
               "title": "Creator Id",
               "description": "Unique identifier of the author.",
               "type": "string"
            }
         },
         "required": [
            "id",
            "species_id",
            "data_unit",
            "time_unit"
         ]
      },
      "MeasurementData": {
         "title": "MeasurementData",
         "description": "Helper class to organize elements",
         "type": "object",
         "properties": {
            "init_conc": {
               "title": "Init Conc",
               "description": "Initial concentration of the measurement data.",
               "type": "number"
            },
            "unit": {
               "title": "Unit",
               "description": "The unit of the measurement data.",
               "type": "string"
            },
            "measurement_id": {
               "title": "Measurement Id",
               "description": "Unique measurement identifier this dataset belongs to.",
               "type": "string"
            },
            "reactant_id": {
               "title": "Reactant Id",
               "description": "The identifier for the described reactant.",
               "type": "string"
            },
            "protein_id": {
               "title": "Protein Id",
               "description": "The identifier for the described protein.",
               "type": "string"
            },
            "replicates": {
               "title": "Replicates",
               "description": "A list of replicate objects holding raw data of the measurement.",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/Replicate"
               }
            }
         },
         "required": [
            "init_conc",
            "unit"
         ]
      }
   }
}

Config
  • validate_all: bool = True

  • validate_assignment: bool = True

Fields
Validators
field creator_id: Optional[str] = None#

Unique identifier of the author.

field global_time: List[float] [Optional]#

Global time of the measurement all replicates agree on.

field global_time_unit: Optional[str] = None#

Unit of the global time.

field id: Optional[str] = None#

Unique identifier of the measurement.

Constraints
  • pattern = m[d]+

field name: str [Required]#

Name of the measurement

field ph: Optional[float] = None#

PH value of the reaction.

field species_dict: Dict[str, Dict[str, MeasurementData]] = {'proteins': {}, 'reactants': {}}#

Species of the measurement.

field temperature: Optional[float] = None#

Numeric value of the temperature of the reaction.

field temperature_unit: Optional[str] = None#

Unit of the temperature of the reaction.

Constraints
  • pattern = kelvin|Kelvin|k|K|celsius|Celsius|C|c

Validated by
field uri: Optional[str] = None#

URI of the reaction.

addData(unit: str, init_conc: float = 0.0, reactant_id: Optional[str] = None, protein_id: Optional[str] = None, replicates: List[Replicate] = [], log: bool = True) None[source]#

Adds data to the measurement object.

Parameters
  • init_conc (PositiveFloat) – Corresponding initial concentration of species.

  • unit (str) – The SI unit of the measurement.

  • reactant_id (Optional[str], optional) – Identifier of the reactant that was measured. Defaults to None.

  • protein_id (Optional[str], optional) – Identifier of the protein that was measured. Defaults to None.

  • replicates (List[Replicate], optional) – List of replicates that were measured. Defaults to [].

addReplicates(replicates: Union[List[Replicate], Replicate], enzmldoc, log: bool = True) None[source]#

Adds a replicate to the corresponding measurementData object. This method is meant to be called if the measurement metadata of a reaction/species has already been done and replicate data has to be added afterwards. If not, use addData instead to introduce the species metadata.

Parameters

replicate (List<Replicate>) – Objects describing time course data

validator convert_temperature_unit  »  temperature_unit[source]#

Converts celsius to kelvin due to SBML limitations

exportData(species_ids: Union[str, List[str]] = 'all') Dict[str, Dict[str, Union[Dict[str, Tuple[float, str]], DataFrame]]][source]#

Returns data stored in the measurement object as DataFrames nested in dictionaries. These are sorted hierarchially by reactions where each holds a DataFrame each for proteins and reactants.

Returns

Follows the hierarchy Reactions > Proteins/Reactants > { initial_concentration, data } species_ids (Union[str, List[str]]): List of species IDs to extract data from. Defaults to ‘all’.

Return type

measurements (dict)

getGlobalTime()[source]#

Deprecated since version Use: the attribute global_time instead.

getGlobalTimeUnit()[source]#

Deprecated since version Use: the attribute global_time_unit instead.

getId()[source]#

Deprecated since version Use: the attribute id instead.

getName()[source]#

Deprecated since version Use: the attribute name instead.

getProtein(protein_id: str) MeasurementData[source]#

Returns a single MeasurementData object for the given protein_id.

Parameters

protein_id (String) – Unqiue identifier of the protein

Returns

Object representing the data and initial concentration

Return type

MeasurementData

getProteins() Dict[str, MeasurementData][source]#

Returns a dict of all participating proteins in the measurement.

Returns

Dict of MeasurementData objects representing data

Return type

dict

getReactant(reactant_id: str) MeasurementData[source]#

Returns a single MeasurementData object for the given reactant_id.

Parameters

reactant_id (String) – Unqiue identifier of the reactant

Returns

Object representing the data and initial concentration

Return type

MeasurementData

getReactants() Dict[str, MeasurementData][source]#

Returns a dict of all participating reactants in the measurement.

Returns

Dict of MeasurementData objects representing data

Return type

dict

getSpeciesDict()[source]#

Deprecated since version Use: the attribute species_dict instead.

printMeasurementScheme(species_type: str = 'all', stdout: bool = True) Optional[str][source]#

Prints the scheme of the measurement and as such an overview of what has been done.

Parameters

species_type (str, optional) – Specifies whether only “reactants”/”proteins” should be displayed or all of them. Defaults to “all”.

temperature_unitdef()[source]#

Returns the appropriate unitdef if an enzmldoc is given

unifyUnits(kind: str, scale: int, enzmldoc) None[source]#

Rescales all replicates and measurements to match the scale of a unit kind.

Parameters
  • kind (str) – The unit kind from which to rescale. Currently supported: ‘mole’, ‘gram’, ‘litre’.

  • scale (int) – Decade scale to which the values will be rescaled.

  • enzmldoc (EnzymeMLDocument) – The EnzymeMLDocument to which the new unit will be added.

updateReplicates(replicates: List[Replicate]) None[source]#