napistu.ingestion.reactome_fi

Functions

convert_reactome_fi_to_sbml_dfs(interactions)

Format the Reactome FI interactions DataFrame as an edgelist for network analysis.

create_interaction_edgelist(interactions)

Create an edgelist of Reactome functional interactions

create_species_df(interactions[, ...])

Create a species DataFrame from a set of interactions.

download_reactome_fi(target_uri[, url])

Download the Reactome Functional Interactions (FI) dataset as a TSV file.

napistu.ingestion.reactome_fi._get_human_symbol_to_entrez_mapping(preferred_method: str = 'bioconductor', allow_fallback: bool = True) DataFrame

Get a mapping of human gene symbols to NCBI Entrez Gene IDs.

Parameters:
  • preferred_method (str) – The preferred method to use for the mapping.

  • allow_fallback (bool) – Whether to allow fallback to other methods if the preferred method fails.

Returns:

A DataFrame with columns for the gene symbol and NCBI Entrez Gene ID.

Return type:

pd.DataFrame

napistu.ingestion.reactome_fi._get_reactome_fi_species_systematic_ids(all_gene_names: set[str], preferred_method: str = 'bioconductor', allow_fallback: bool = True) DataFrame

Get the species systematic IDs for the genes in the interactions.

Parameters:
  • all_gene_names (set[str]) – The gene names to get the species systematic IDs for.

  • preferred_method (str) – The preferred Genodexito method to use for identifier mapping.

  • allow_fallback (bool) – Whether to allow fallback to other Genodexito methods if the preferred method fails.

Returns:

A DataFrame with columns for the gene symbol and NCBI Entrez Gene ID.

Return type:

pd.DataFrame

napistu.ingestion.reactome_fi._parse_reactome_fi_annotations(interactions: DataFrame) DataFrame

Parse and annotate Reactome FI interaction types and directions using regex-based rules.

Parameters:

interactions (pd.DataFrame) – DataFrame containing Reactome FI interactions, with annotation and direction columns.

Returns:

DataFrame with annotation, direction, SBO term name, and polarity for each unique annotation/direction pair.

Return type:

pd.DataFrame

Raises:

ValueError – If an annotation/direction pair cannot be matched to a rule or if invalid directions are found.

napistu.ingestion.reactome_fi.convert_reactome_fi_to_sbml_dfs(interactions: DataFrame, preferred_method: str = 'bioconductor', allow_fallback: bool = True) SBML_dfs

Format the Reactome FI interactions DataFrame as an edgelist for network analysis.

Parameters:
  • interactions (pd.DataFrame) – DataFrame containing Reactome FI interactions.

  • preferred_method (str) – The preferred Genodexito method to use for identifier mapping.

  • allow_fallback (bool) – Whether to allow fallback to other Genodexito methods for identifier mapping.

Returns:

A SBML_dfs object containing the species, compartments, and reactions data.

Return type:

sbml_dfs_core.SBML_dfs

napistu.ingestion.reactome_fi.create_interaction_edgelist(interactions: DataFrame) DataFrame

Create an edgelist of Reactome functional interactions

Parameters:

interactions (pd.DataFrame) – A DataFrame of Reactome functional interactions

Returns:

Functional interactions with the following columns: - upstream_name: the name of the upstream species - downstream_name: the name of the downstream species - upstream_sbo_term_name: the sbo term name for the upstream species - downstream_sbo_term_name: the sbo term name for the downstream species - r_Identifiers: an identifiers.Identifiers object - r_name: a human readable name for the interaction

Return type:

pd.DataFrame

napistu.ingestion.reactome_fi.create_species_df(interactions: DataFrame, preferred_method: str = 'bioconductor', allow_fallback: bool = True) DataFrame

Create a species DataFrame from a set of interactions.

Parameters:
  • interactions (pd.DataFrame) – The interactions to create the species DataFrame from.

  • preferred_method (str) – The preferred method to use for identifier mapping.

  • allow_fallback (bool) – Whether to allow fallback to other methods for identifier mapping.

Returns:

The species DataFrame containing the species names and their identifiers: - SBML_DFS.S_NAME : The species’ name - SBML_DFS.S_IDENTIFIERS : The identifiers for the species

Return type:

pd.DataFrame

napistu.ingestion.reactome_fi.download_reactome_fi(target_uri: str, url: str = 'http://cpws.reactome.org/caBigR3WebApp2025/FIsInGene_04142025_with_annotations.txt.zip') None

Download the Reactome Functional Interactions (FI) dataset as a TSV file.

Parameters:
  • target_uri (str) – The URI where the Reactome FI data should be saved. Should end with .tsv

  • url (str, optional) – URL to download the zipped Reactome functional interactions TSV from. Defaults to REACTOME_FI_URL.

Return type:

None

Raises:

ValueError – If target_uri does not end with .tsv