Skip to content

Commit

Permalink
Merge pull request #52 from BackofenLab/workNico
Browse files Browse the repository at this point in the history
correct issues happend by rebasing master onto workNico
  • Loading branch information
TripZz authored Nov 30, 2023
2 parents 318f454 + 9762df4 commit e13bdc1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion backend/src/enrichment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
5 changes: 2 additions & 3 deletions backend/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import queries
import signal
from util.stopwatch import Stopwatch
import g4f, asyncio

app = Flask(__name__)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"])

Expand Down Expand Up @@ -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()
3 changes: 2 additions & 1 deletion backend/src/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

0 comments on commit e13bdc1

Please sign in to comment.