physicool.pcxml

Module Contents

Functions

parse_domain(tree, path)

Reads and returns the <domain> data.

parse_overall(tree, path)

Reads and returns the <overall> data.

parse_substance(tree, path, name)

Reads and returns the <variable> data for a microenvironment substance.

parse_microenvironment(tree, path)

Reads and returns the <microenvironment> data.

parse_cycle(tree, path)

Reads and returns the <cycle> data.

parse_death_model(tree, path, name)

Reads and returns the <death> data for a death model.

parse_death(tree, path)

Reads and returns the <death> data.

parse_volume(tree, path)

Reads and returns the <volume> data.

parse_mechanics(tree, path)

Reads and returns the <mechanics> data.

parse_motility(tree, path)

Reads and returns the <motility> data.

parse_secretion_substance(tree, path, name)

Reads and returns the data for a secretion <substrate>.

parse_secretion(tree, path)

Reads and returns the <secretion> data.

parse_custom(tree, path)

Reads and returns the custom data.

write_domain(new_values, tree, path)

Writes new values for the <domain> data in the XML tree.

write_overall(new_values, tree, path)

Writes new values for the <overall> data in the XML tree.

write_substance(new_values, tree, path, name)

Writes new values for a microenvironment substance the XML tree.

write_cycle(new_values, tree, path)

Writes new values for the <cycle> data in the XML tree.

write_death_model(new_values, tree, path)

Writes new values for a <death> model in the XML tree.

write_volume(new_values, tree, path)

Writes new values for the <volume> data in the XML tree.

write_mechanics(new_values, tree, path)

Writes new values for the <mechanics> data in the XML tree.

write_motility(new_values, tree, path)

Writes new values for the <motility> data in the XML tree.

write_secretion_substance(new_values, tree, path, name)

Writes new values for a secretion substance the XML tree.

write_custom_data(new_values, tree, path)

Writes new values to the custom user variables in the XML tree.

physicool.pcxml.parse_domain(tree, path)[source]

Reads and returns the <domain> data.

Parameters:
  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be read.

  • path (str) – A string with the path to the domain node (e.g., “domain”).

Returns:

A dictionary with the domain data for a simulation (x_min, x_max, y_min, y_max, z_min, z_max, dx, dy, dz and use_2D).

Return type:

Dict[str, Union[bool, float]]

Raises:

ValueError – When the passed path does not point to the domain node.

physicool.pcxml.parse_overall(tree, path)[source]

Reads and returns the <overall> data.

Parameters:
  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be read.

  • path (str) – A string with the path to the overall node (e.g., “overall”).

Returns:

A dictionary with the overall data for a simulation (max_time, dt_diffusion, dt_mechanics, dt_phenotype).

Return type:

Dict[str, float]

Raises:

ValueError – When the passed path does not point to the overall node.

physicool.pcxml.parse_substance(tree, path, name)[source]

Reads and returns the <variable> data for a microenvironment substance.

Parameters:
  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be read.

  • path (str) – A string with the path to the microenvironment node (e.g., “microenvironment_setup”).

  • name (str) – A string with the name of the microenvironment variable to be read.

Returns:

A dictionary with the data for one of the substances in a simulation (name, diffusion_coefficient, decay_rate, initial_condition, Dirichlet_boundary_condition).

Return type:

Dict[str, Union[str, float]]

Raises:
  • ValueError – When the passed path does not point to the microenvironment node.

  • ValueError – When the passed name does not match any of the variables in the file.

physicool.pcxml.parse_microenvironment(tree, path)[source]

Reads and returns the <microenvironment> data.

Parameters:
  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be read.

  • path (str) – A string with the path to the microenvironment node (e.g., “microenvironment_setup”).

Returns:

A list of dictionaries with the data for all the substances in a simulation (name, diffusion_coefficient, decay_rate, initial_condition, Dirichlet_boundary_condition).

Return type:

List[Dict[str, Union[float, str]]]

Raises:

ValueError – When the passed path does not point to the microenvironment node.

physicool.pcxml.parse_cycle(tree, path)[source]

Reads and returns the <cycle> data.

Parameters:
  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be read.

  • path (str) – A string with the path to the cycle node (e.g., “cell_definitions/cell_definition[@name=’default’]/phenotype/cycle”).

Returns:

A dictionary with the cycle data for a cell definition in a simulation (code, phase_durations or phase_transition_rates).

Return type:

Dict[str, Union[float, List[float]]]

Raises:

ValueError – When the passed path does not point to a valid cycle node.

physicool.pcxml.parse_death_model(tree, path, name)[source]

Reads and returns the <death> data for a death model.

Parameters:
  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be read.

  • path (str) – A string with the path to the death node (e.g., “cell_definitions/cell_definition[@name=’default’]/phenotype/death”).

  • name (str) – A string with the name of the death model to be read.

Returns:

A dictionary with the data for one of the death models for a cell definition

in a simulation (code, death_rate, phase_duration_rates or phase_transition_rates, unlysed_fluid_change_rate, unlysed_fluid_change_rate, cytoplasmic_biomass_change_rate, nuclear_biomass_change_rate, calcification_rate, relative_rupture_volume).

Return type:

Dict[str, Union[float, List[float]]]

Raises:
  • ValueError – When the passed path does not point to the death node.

  • ValueError – When the passed name does not match any of the death models for the cell definition.

physicool.pcxml.parse_death(tree, path)[source]

Reads and returns the <death> data.

Parameters:
  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be read.

  • path (str) – A string with the path to the death node (e.g., “cell_definitions/cell_definition[@name=’default’]/phenotype/death”).

Returns:

A list of dictionaries with the data for all the death models for a cell definition

in a simulation (code, death_rate, phase_duration_rates or phase_transition_rates, unlysed_fluid_change_rate, unlysed_fluid_change_rate, cytoplasmic_biomass_change_rate, nuclear_biomass_change_rate, calcification_rate, relative_rupture_volume).

Return type:

List[Dict[str, Union[float, List[float]]]]

Raises:

ValueError – When the passed path does not point to the death node.

physicool.pcxml.parse_volume(tree, path)[source]

Reads and returns the <volume> data.

Parameters:
  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be read.

  • path (str) – A string with the path to the volume node (e.g., “cell_definitions/cell_definition[@name=’default’]/phenotype/volume”).

Returns:

A dictionary with the volume data for a cell definition in a simulation (total, fluid_fraction, nuclear, fluid_change_rate, cytoplasmic_biomass_change_rate, nuclear_biomass_change_rate, calcified_fraction, calcification_rat, relative_rupture_volume).

Return type:

Dict[str, float]

Raises:

ValueError – When the passed path does not point to a valid volume node.

physicool.pcxml.parse_mechanics(tree, path)[source]

Reads and returns the <mechanics> data.

Parameters:
  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be read.

  • path (str) – A string with the path to the mechanics node (e.g., “cell_definitions/cell_definition[@name=’default’]/phenotype/mechanics”).

Returns:

A dictionary with the mechanics data for a cell definition in a simulation (cell_cell_adhesion_strength, cell_cell_repulsion_strength, set_relative_maximum_adhesion_distance, set_relative_equilibrium_distance, set_absolute_equilibrium_distance).

Return type:

Dict[str, float]

Raises:

ValueError – When the passed path does not point to a valid mechanics node.

physicool.pcxml.parse_motility(tree, path)[source]

Reads and returns the <motility> data.

Parameters:
  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be read.

  • path (str) – A string with the path to the motility node (e.g., “cell_definitions/cell_definition[@name=’default’]/phenotype/motility”).

Returns:

A dictionary with the motility data for a cell definition in a simulation (code, phase_durations or phase_transition_rates).

Return type:

Dict[str, Union[float, str, bool]]

Raises:

ValueError – When the passed path does not point to a valid motility node.

physicool.pcxml.parse_secretion_substance(tree, path, name)[source]

Reads and returns the data for a secretion <substrate>.

Parameters:
  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be read.

  • path (str) – A string with the path to the secretion node (e.g., “cell_definitions/cell_definition[@name=’default’]/phenotype/secretion”).

  • name (str) – A string with the name of the secretion substance to be read.

Returns:

A dictionary with the data for one of the substances in a simulation (name, secretion_rate, secretion_target, uptake_rate, net_export_rate).

Return type:

Dict[str, Union[str, float]]

Raises:
  • ValueError – When the passed path does not point to the secretion node.

  • ValueError – When the passed name does not match any of the substances in the secretion data.

physicool.pcxml.parse_secretion(tree, path)[source]

Reads and returns the <secretion> data.

Parameters:
  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be read.

  • path (str) – A string with the path to the secretion node (e.g., “cell_definitions/cell_definition[@name=’default’]/phenotype/secretion”).

Returns:

A list of dictionaries with the data for all the secretion models for a cell definition

in a simulation (name, secretion_rate, secretion_target, uptake_rate, net_export_rate).

Return type:

List[Dict[str, Union[str, float]]]

Raises:

ValueError – When the passed path does not point to the secretion node.

physicool.pcxml.parse_custom(tree, path)[source]

Reads and returns the custom data.

Parameters:
  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be read.

  • path (str) – A string with the path to the motility node (e.g., “cell_definitions/cell_definition[@name=’default’]/custom_data”, “user_parameters”).

Returns:

A list of dictionaries with data for the custom variables (custom cell data and user parameters). Dictionaries have the format {“name”: …, “value”: …}.

Return type:

List[Dict[str, Union[float, str]]]

Raises:

ValueError – When the passed path does not point to a valid custom node.

physicool.pcxml.write_domain(new_values, tree, path)[source]

Writes new values for the <domain> data in the XML tree. Values will not be saved to the XML file, only to the ElementTree.

Parameters:
  • new_values (Dict[str, Union[float, bool]]) – A dictionary with the name of the domain variables and their values (must include all the variables).

  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be written.

  • path (str) – A string with the path to the domain node (e.g., “domain”).

Raises:

ValueError – When the passed path does not point to the valid domain node.

Return type:

None

physicool.pcxml.write_overall(new_values, tree, path)[source]

Writes new values for the <overall> data in the XML tree. Values will not be saved to the XML file, only to the ElementTree.

Parameters:
  • new_values (Dict[str, float]) – A dictionary with the name of the overall variables and their values (must include all the variables).

  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be written.

  • path (str) – A string with the path to the overall node (e.g., “overall”).

Raises:

ValueError – When the passed path does not point to the valid overall node.

Return type:

None

physicool.pcxml.write_substance(new_values, tree, path, name)[source]

Writes new values for a microenvironment substance the XML tree. Values will not be saved to the XML file, only to the ElementTree.

Parameters:
  • new_values – A dictionary with the name of the substance variables and their values (must include all the variables).

  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be written.

  • path (str) – A string with the path to the microenvironment node (e.g., “microenvironment_setup”).

  • name (str) – A string with the name of the substance to be written.

Raises:
  • ValueError – When the passed path does not point to the valid microenvironment node.

  • ValueError – When the passed name does not match any of the substances in the file.

Return type:

None

physicool.pcxml.write_cycle(new_values, tree, path)[source]

Writes new values for the <cycle> data in the XML tree. The phase durations or rates should have the same length as the XML file. Values will not be saved to the XML file, only to the ElementTree.

Parameters:
  • new_values (Dict[str, Union[float, List[float]]]) – A dictionary with the name of the cycle variables and their values (must include all the variables).

  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be written.

  • path (str) – A string with the path to the cycle node (e.g., “cell_definitions/cell_definition[@name=’default’]/phenotype/cycle”).

Raises:
  • ValueError – When the passed path does not point to the valid cycle node.

  • ValueError – When the number of transition rates/durations does not match the values in the XML file.

Return type:

None

physicool.pcxml.write_death_model(new_values, tree, path)[source]

Writes new values for a <death> model in the XML tree. The phase durations or rates should have the same length as the XML file. Values will not be saved to the XML file, only to the ElementTree.

Parameters:
  • new_values (Dict[str, Union[float, List[float]]]) – A dictionary with the name of the death variables and their values (must include all the variables).

  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be written.

  • path (str) – A string with the path to the death node (e.g., “cell_definitions/cell_definition[@name=’default’]/phenotype/death”).

Raises:
  • ValueError – When the passed path does not point to the valid death node.

  • ValueError – When the passed name does not match any of the death models in the XML file.

  • ValueError – When the number of transition rates/durations does not match the values in the XML file.

Return type:

None

physicool.pcxml.write_volume(new_values, tree, path)[source]

Writes new values for the <volume> data in the XML tree. Values will not be saved to the XML file, only to the ElementTree.

Parameters:
  • new_values (Dict[str, float]) – A dictionary with the name of the volume variables and their values (must include all the variables).

  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be written.

  • path (str) – A string with the path to the volume node (e.g., “cell_definitions/cell_definition[@name=’default’]/phenotype/volume”).

Raises:

ValueError – When the passed path does not point to the valid volume node.

Return type:

None

physicool.pcxml.write_mechanics(new_values, tree, path)[source]

Writes new values for the <mechanics> data in the XML tree. Values will not be saved to the XML file, only to the ElementTree.

Parameters:
  • new_values (Dict[str, float]) – A dictionary with the name of the mechanics variables and their values (must include all the variables).

  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be written.

  • path (str) – A string with the path to the mechanics node (e.g., “cell_definitions/cell_definition[@name=’default’]/phenotype/mechanics”).

Raises:

ValueError – When the passed path does not point to the valid mechanics node.

Return type:

None

physicool.pcxml.write_motility(new_values, tree, path)[source]

Writes new values for the <motility> data in the XML tree. Values will not be saved to the XML file, only to the ElementTree.

Parameters:
  • new_values (Dict[str, Union[float, bool, str]]) – A dictionary with the name of the motility variables and their values (must include all the variables).

  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be written.

  • path (str) – A string with the path to the motility node (e.g., “cell_definitions/cell_definition[@name=’default’]/phenotype/motility”).

Raises:

ValueError – When the passed path does not point to the valid motility node.

Return type:

None

physicool.pcxml.write_secretion_substance(new_values, tree, path, name)[source]

Writes new values for a secretion substance the XML tree. Values will not be saved to the XML file, only to the ElementTree.

Parameters:
  • new_values – A dictionary with the name of the substance variables and their values (must include all the variables).

  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be written.

  • path (str) – A string with the path to the microenvironment node (e.g., “cell_definitions/cell_definition[@name=’default’]/phenotype/secretion”).

  • name (str) – A string with the name of the substance to be written.

Raises:
  • ValueError – When the passed path does not point to the valid microenvironment node.

  • ValueError – When the passed name does not match any of the substances in the file.

Return type:

None

physicool.pcxml.write_custom_data(new_values, tree, path)[source]

Writes new values to the custom user variables in the XML tree. The list must match the custom variables in the XML file. Values will not be saved to the XML file, only to the ElementTree.

Parameters:
  • new_values (List[Dict[str, float]]) – A list of dictionaries with the custom variables to be written.

  • tree (xml.etree.ElementTree) – A ElementTree object of the XML config file to be written.

  • path (str) – A string with the path to the motility node (e.g., “cell_definitions/cell_definition[@name=’default’]/custom_data”, “user_parameters”).

Raises:
  • ValueError – When the passed path does not point to a valid custom node.

  • ValueError – When the passed list does not match the variables in the config file.

Return type:

None