From 9d3d6bbf490d89715b5a1fd2e059644bad798617 Mon Sep 17 00:00:00 2001 From: Maluuck Date: Wed, 13 Dec 2023 19:43:51 +0100 Subject: [PATCH] Last fixes regarding pathway download --- backend/src/pathway_data/pathway_data.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/backend/src/pathway_data/pathway_data.py b/backend/src/pathway_data/pathway_data.py index 2a926847..748f4b67 100644 --- a/backend/src/pathway_data/pathway_data.py +++ b/backend/src/pathway_data/pathway_data.py @@ -183,15 +183,18 @@ def read_data(species, file_name): for line in f: fields = line.strip().split("\t") name = fields[0].split("%") - source = name[1] - ids = name[2] - descr = fields[1] - symbols = fields[2:] - # Exclude lines where source starts with "REACTOME" - if not source.startswith("REACTOME"): - data.append([ids, descr, source, symbols]) - symbol.append(symbols) - unique_symbols.update(symbols) + if len(name) >= 2: + source = name[1] + ids = name[2] + descr = fields[1] + symbols = fields[2:] + # Exclude lines where source starts with "REACTOME" + if not source.startswith("REACTOME"): + data.append([ids, descr, source, symbols]) + symbol.append(symbols) + unique_symbols.update(symbols) + else: + pass unique_symbols = list(unique_symbols) gene_mapping, genes_to_map = symbols_to_ensembl(unique_symbols, f"{species}", "gene")