From 9762df46ae885d0671f551571414d1b7c167f657 Mon Sep 17 00:00:00 2001 From: TripZz Date: Thu, 30 Nov 2023 13:05:36 +0100 Subject: [PATCH] correct issues happend by rebasing master onto workNico --- backend/src/enrichment.py | 3 ++- backend/src/main.py | 5 ++--- backend/src/queries.py | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/src/enrichment.py b/backend/src/enrichment.py index b6c6bdd4..c3bcc2e1 100644 --- a/backend/src/enrichment.py +++ b/backend/src/enrichment.py @@ -83,6 +83,7 @@ def functional_enrichment(driver: neo4j.Driver, in_genes, species_id: Any): csv.field_size_limit(sys.maxsize) # Read Terms and put into Dataframe + df_terms = pd.DataFrame(queries.get_enrichment_terms(driver, species_id)) tot_tests = len(df_terms) stopwatch.round("setup_enrichment") @@ -134,4 +135,4 @@ def functional_enrichment(driver: neo4j.Driver, in_genes, species_id: Any): stopwatch.round("fdr_enrichment") stopwatch.total("functional_enrichment") - return df_terms + return df_terms \ No newline at end of file diff --git a/backend/src/main.py b/backend/src/main.py index dcfb1ddb..a828931e 100644 --- a/backend/src/main.py +++ b/backend/src/main.py @@ -19,7 +19,6 @@ import queries import signal from util.stopwatch import Stopwatch -import g4f, asyncio app = Flask(__name__) @@ -74,6 +73,7 @@ def proteins_enrichment(): json_str = json.dumps(list_enrichment.to_dict("records"), ensure_ascii=False, separators=(",", ":")) return Response(json_str, mimetype="application/json") + # ====================== Subgraph API ====================== # request comes from home.js # TODO Refactor this @@ -110,7 +110,6 @@ def proteins_subgraph_api(): pd.DataFrame(proteins).rename(columns={"ENSEMBL_PROTEIN": "external_id"}).drop_duplicates(subset="external_id") ) - edges = pd.DataFrame({"source": source, "target": target, "score": score}) edges = edges.drop_duplicates(subset=["source", "target"]) @@ -253,4 +252,4 @@ def run_flask(): if __name__ == "__main__": signal.signal(signal.SIGINT, signal_handler) flask_process = Process(target=run_flask) - flask_process.start() + flask_process.start() \ No newline at end of file diff --git a/backend/src/queries.py b/backend/src/queries.py index 8e284c81..8134c071 100644 --- a/backend/src/queries.py +++ b/backend/src/queries.py @@ -111,6 +111,7 @@ def get_protein_associations( result = session.run(query) return _convert_to_connection_info_score(result=result, _int=True, protein=True) + def get_enrichment_terms(driver: neo4j.Driver, species_id: int) -> list[dict[str, Any]]: if species_id == 10090: species = "Mus_Musculus" @@ -185,4 +186,4 @@ def _convert_to_connection_info_score( else: score.append(float(row["score"])) - return nodes, source, target, score + return nodes, source, target, score \ No newline at end of file