<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">"""Code to convert ENSEMBL gene id to gene symbol"""

import pandas as pd


def strip_id_source(col):
    if col == '':
        return col
    else:
        return col.split(':')[1]


def extract_reactome_ensembl_ids(file):
    d = pd.read_csv(file, header=None, skiprows=1, sep='\t',
                    index_col=False,
                    usecols=[0, 1, 3, 4, 6, 7],
                    names=['from_uni', 'from_ensembl',
                           'to_uni', 'to_ensembl', 'type', 'reaction'],
                    converters={'from_uni': strip_id_source,
                                'from_ensembl': strip_id_source,
                                'to_uni': strip_id_source,
                                'to_ensembl': strip_id_source})
    return d

reactome_file = "../data/homo_sapiens_interactions.txt"
</pre></body></html>