napistu.modify.uncompartmentalize

Functions

uncompartmentalize_sbml_dfs(sbml_dfs[, inplace])

Uncompartmentalize SBML_dfs

napistu.modify.uncompartmentalize._create_stubbed_index() PWIndex

Create a default pathway index for the uncompartmentalized model.

napistu.modify.uncompartmentalize._create_stubbed_source() Source

Create a default Source object for the uncompartmetnalized model.

napistu.modify.uncompartmentalize._filter_trivial_reactions(rxn_consensus_species: pd.DataFrame, rxnspec_consensus_instances: pd.DataFrame) tuple[pd.Dataframe, pd.DataFrame]

Filter Trivial Reactions

Filter reaction species which cancel out as substrates and products in the same reaction.

Parameters:
  • rxn_consensus_species (pd.DataFrame) – reactions

  • rxnspec_consensus_instances (pd.DataFrame) – reaction species

Returns:

reactions with trivial reactions dropped reaction_species (pd.DataFrame): reaction species with trivial reaction species dropped

Return type:

reactions (pd.DataFrame)

napistu.modify.uncompartmentalize._uncompartmentalize_cspecies(sbml_dfs: sbml_dfs_core.SBML_dfs, stubbed_compartment: identifiers.Identifiers) tuple[pd.Dataframe, pd.DataFrame]

Convert compartmetnalized species into uncompartmentalized ones.

napistu.modify.uncompartmentalize._uncompartmentalize_reactions(sbml_dfs: SBML_dfs, compspec_lookup_table: Series) tuple[DataFrame, DataFrame]

Update reactions and reaction species to include uncompartmentalized species

napistu.modify.uncompartmentalize.uncompartmentalize_sbml_dfs(sbml_dfs: SBML_dfs, inplace: bool = True) None

Uncompartmentalize SBML_dfs

Take a compartmentalized mechanistic model and merge all of the compartments.

To remove compartmentalization we can: 1. update the compartments table to the stubbed default level: GO CELLULAR_COMPONENT 2. ignore the species table (it will be the same in the compartmentalized and uncompartmenalzied model) 3. create a 1-1 correspondence between species and new compartmentalized species. w/ GO CELLULAR_COMPONENT 4. update reaction species to the new compartmentalized species 5. drop reactions if:

  • they are redundant (e.g., the same reaction occurred in multiple compartments)

  • substrates and products are identical (e.g., a transportation reaction)

Parameters:
  • sbml_dfs (sbml_dfs_core.SBML_dfs) – The SBML_dfs object to uncompartmentalize

  • inplace (bool) – Whether to modify the SBML_dfs object in-place or return a new object

Returns:

Modifies the SBML_dfs object in-place if inplace is True, otherwise returns a new SBML_dfs object

Return type:

None