napistu.modify.gaps
Functions
|
Add transportation reactions to connect all forms of a protein across compartments. |
|
Add transportation reactions between all locations of a set of molecular species by including bidirectional exchange reactions through an exchange compartment. |
- napistu.modify.gaps._add_new_exchange_cspecies(new_exchange_cspecies: set, sbml_dfs: SBML_dfs, exchange_compartment_id: str, exchange_compartment: str, gap_filling_source_obj: Source) DataFrame
Add new compartmentalized species to the exchange compartment.
- Parameters:
new_exchange_cspecies (set) – Set of s_ids needing new compartmentalized species in the exchange compartment.
sbml_dfs (sbml_dfs_core.SBML_dfs) – The SBML_dfs object
exchange_compartment_id (str) – The compartment ID for the exchange compartment
exchange_compartment (str) – The name of the exchange compartment
gap_filling_source_obj (source.Source) – Source object for gap-filling
- Returns:
DataFrame of new compartmentalized species to add.
- Return type:
pd.DataFrame
- napistu.modify.gaps._build_transport_rxn_edgelist(updated_sbml_dfs: SBML_dfs, species_needing_transport_rxns: ndarray, exchange_compartment_id: str) DataFrame
Build the edgelist for new transport reactions, ensuring only one reversible reaction per compartment pair.
- Parameters:
updated_sbml_dfs (sbml_dfs_core.SBML_dfs) – The updated SBML_dfs object
species_needing_transport_rxns (np.ndarray) – Vector of molecular species (s_ids) with no or insufficient transportation reactions
exchange_compartment_id (str) – The compartment ID for the exchange compartment
- Returns:
Edgelist for new transport reactions.
- Return type:
pd.DataFrame
- napistu.modify.gaps._create_new_reaction_species(transport_rxn_edgelist: DataFrame, sbml_dfs: SBML_dfs) DataFrame
Create new reaction species DataFrame for gap-filling transport reactions.
- Parameters:
transport_rxn_edgelist (pd.DataFrame) – Edgelist for new transport reactions.
sbml_dfs (sbml_dfs_core.SBML_dfs) – The SBML_dfs object
- Returns:
DataFrame of new reaction species to add.
- Return type:
pd.DataFrame
- napistu.modify.gaps._create_new_reactions(transport_rxn_edgelist: DataFrame, sbml_dfs: SBML_dfs, gap_filling_id_obj: Identifiers, gap_filling_source_obj: Source) DataFrame
Create new reactions DataFrame for gap-filling transport reactions.
- Parameters:
transport_rxn_edgelist (pd.DataFrame) – Edgelist for new transport reactions.
sbml_dfs (sbml_dfs_core.SBML_dfs) – The SBML_dfs object
gap_filling_id_obj (identifiers.Identifiers) – Identifiers object for gap-filling
gap_filling_source_obj (source.Source) – Source object for gap-filling
- Returns:
DataFrame of new reactions to add.
- Return type:
pd.DataFrame
- napistu.modify.gaps._eval_existing_inter_cspecies_paths(comp_specs: DataFrame, existing_cspecies_paths: DataFrame) dict
Evaluate whether paths between compartments found in _find_existing_inter_cspecies_paths cover all of the compartments where the protein exists.
- Parameters:
comp_specs (pd.DataFrame) – Compartmentalized species for a single s_id
existing_cspecies_paths (pd.DataFrame) – An edgelist of a from and to compartmentalized species and a label of the path connecting them.
- Returns:
type: the status category the species falls in msg: an optional message describing the type
- Return type:
dict
- napistu.modify.gaps._find_existing_inter_cspecies_paths(comp_specs: DataFrame, uniprot_id: str, directed_graph: Graph, partial_protein_cspecies: DataFrame) DataFrame | None
Find which compartments a protein exists in can be reached from one another by traversing a directed graph of reactions and molecular species including the protein.
- Parameters:
comp_specs (pd.DataFrame) – Compartmentalized species for a single s_id
uniprot_id (str) – The Uniprot ID for the protein of interest
directed_graph (ig.Graph) – An igraph version of the sbml_dfs model
partial_protein_cspecies (pd.DataFrame) – A table of proteins included in each species ID (this includes BQB_HAS_PART qualifiers in addition to the BQB_IS qualifiers which generally define distinct species
- Returns:
An edgelist of a from and to compartmentalized species and a label of the path connecting them.
- Return type:
pd.DataFrame or None
- napistu.modify.gaps._find_new_exchange_cspecies(species_needing_transport_rxns: ndarray, sbml_dfs: SBML_dfs, exchange_compartment_id: str) set
Find species which need exchange reactions but are not currently present in the exchange compartment.
- Parameters:
species_needing_transport_rxns (np.ndarray) – Vector of molecular species (s_ids) with no or insufficient transportation reactions
sbml_dfs (sbml_dfs_core.SBML_dfs) – The SBML_dfs object
exchange_compartment_id (str) – The compartment ID for the exchange compartment
- Returns:
Set of s_ids needing new compartmentalized species in the exchange compartment.
- Return type:
set
- napistu.modify.gaps._identify_species_needing_transport_reactions(sbml_dfs: SBML_dfs) ndarray
Identify molecular species needing transport reactions so all of the compartments where it exists are connected.
- Parameters:
sbml_dfs (sbml_dfs_core.SBML_dfs) – A mechanistic model containing a set of molecular species which exist in multiple compartments and are interconverted by reactions
- Returns:
Vector of molecular species (s_ids) with no or insufficient transportation reactions
- Return type:
np.ndarray
- napistu.modify.gaps._log_protein_transport_gapfilling(species_transport_status_df: DataFrame) None
Log summary statistics and example messages for protein transport gapfilling.
- Parameters:
species_transport_status_df (pd.DataFrame) – DataFrame summarizing transport status for each species
- napistu.modify.gaps.add_transportation_reactions(sbml_dfs: SBML_dfs, exchange_compartment: str = 'cytosol') SBML_dfs
Add transportation reactions to connect all forms of a protein across compartments.
Identifies proteins whose various compartmentalized forms cannot reach one another via existing transportation reactions and then adds transportation reactions which connect all forms of a protein.
- Parameters:
sbml_dfs (sbml_dfs_core.SBML_dfs) – A mechanistic model containing a set of molecular species which exist in multiple compartments and are interconverted by reactions.
exchange_compartment (str, optional) – The name of an exchange compartment matching a c_name from sbml_dfs.compartments.
- Returns:
The input sbml_dfs with additional transport reactions and compartmentalized species (in the exchange compartment) added.
- Return type:
- napistu.modify.gaps.update_sbml_df_with_exchange(species_needing_transport_rxns: ndarray, sbml_dfs: SBML_dfs, exchange_compartment: str = 'cytosol') SBML_dfs
Add transportation reactions between all locations of a set of molecular species by including bidirectional exchange reactions through an exchange compartment.
This function is modular and delegates to helper functions for each logical step: - Finding new exchange compartmentalized species - Adding new compartmentalized species - Building the transport reaction edgelist - Creating new reactions - Creating new reaction species - Updating and validating the sbml_dfs
- Parameters:
species_needing_transport_rxns (np.ndarray) – Vector of molecular species (s_ids) with no or insufficient transportation reactions
sbml_dfs (sbml_dfs_core.SBML_dfs) – A mechanistic model containing a set of molecular species which exist in multiple compartments and are interconverted by reactions
exchange_compartment (str, optional) – The name of an exchange compartment matching a c_name from sbml_dfs.compartments
- Returns:
The input sbml_dfs with additional transport reactions and compartmentalized species (in the exchange compartment) added.
- Return type: