Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency migration #15

Merged
merged 22 commits into from
Nov 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
FROM python:3.12.6-bullseye

# Install required packages using apt
# RUN apt-get update && apt-get install -y \
# libmariadb3 libmariadb-dev build-essential linux-headers-amd64 mariadb-connector-c \
# && rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -y \
libmariadb3 libmariadb-dev build-essential linux-headers-amd64 \
default-mysql-client default-libmysqlclient-dev build-essential linux-headers-amd64 \
&& rm -rf /var/lib/apt/lists/*

# Upgrade pip
Expand All @@ -12,11 +16,13 @@ WORKDIR /server
COPY . /server

RUN pip3 --no-cache-dir install -r requirements.txt
RUN pip install debugpy


# the mariadb plugin directory seems to be misconfigured
# bei default. In order to work properly we manually adjust
# the path.
ENV MARIADB_PLUGIN_DIR=/usr/lib/mariadb/plugin
# ENV MARIADB_PLUGIN_DIR /usr/lib/mariadb/plugin

# EXPOSE 5000
# CMD ["python3", "server.py"]
Expand Down
3 changes: 3 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
MODEL_PATH = os.getenv("SPONGEFFECTS_MODEL_PATH")
SPONGEFFECTS_PREDICT_SCRIPT = os.getenv("SPONGEFFECTS_PREDICT_SCRIPT")

# latest database version
LATEST = 2

# Configure the SQLAlchemy part of the app instance
app.config['SQLALCHEMY_ECHO'] = False
app.config['SQLALCHEMY_DATABASE_URI'] = "mysql://root:[email protected]:9669/SPONGEdb_v2" # os.getenv("SPONGE_DB_URI")
Expand Down
9 changes: 5 additions & 4 deletions externalInformation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from flask import abort
import models
from flask import Response
from sqlalchemy.sql import text
import sqlalchemy as sa
import os


def getAutocomplete(searchString):
Expand Down Expand Up @@ -43,8 +46,6 @@ def getAutocomplete(searchString):
else:
abort(404, "No gene symbol found for the given String")

import sqlalchemy as sa
import os

def getGeneInformation(ensg_number=None, gene_symbol=None):
"""
Expand Down Expand Up @@ -120,7 +121,7 @@ def getOverallCount():
session = Session()
# test for each dataset if the gene(s) of interest are included in the ceRNA network

count = session.execute(
count = session.execute(text(
"select * "
" from (select sum(count_all)/2 as count_interactions, sum(count_sign)/2 as count_interactions_sign, run_ID "
"from gene_counts group by run_ID) as t1 "
Expand All @@ -129,7 +130,7 @@ def getOverallCount():
"using(run_ID) "
"join "
"(SELECT dataset.disease_name, run.run_ID from dataset join run where dataset.dataset_ID = run.dataset_ID) as t3 "
"using(run_ID);").fetchall()
"using(run_ID);")).fetchall()

session.close()
some_engine.dispose()
Expand Down
6 changes: 2 additions & 4 deletions geneInteraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,10 +649,10 @@ def read_mirna_for_specific_interaction(disease_name=None, ensg_number=None, gen
session = Session()
# test for each dataset if the gene(s) of interest are included in the ceRNA network

mirna_filter = session.execute(text(text("select mirna_ID from interactions_genemirna where sponge_run_ID IN ( "
mirna_filter = session.execute(text("select mirna_ID from interactions_genemirna where sponge_run_ID IN ( "
+ ','.join(str(e) for e in run_IDs) + ") and gene_ID IN ( "
+ ','.join(str(e) for e in gene_IDs)
+ ") group by mirna_ID HAVING count(mirna_ID) >= 2;"))).fetchall()
+ ") group by mirna_ID HAVING count(mirna_ID) >= 2;")).fetchall()

session.close()
some_engine.dispose()
Expand Down Expand Up @@ -811,5 +811,3 @@ def get_distinc_ceRNA_sets(disease_name):
#else:
#abort(404, "No data found with input parameter")
return

get_distinc_ceRNA_sets(disease_name="kidney clear")
1 change: 0 additions & 1 deletion gsea.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from flask import abort
import models
import gseapy as gp
from gseapy.plot import GSEAPlot
import base64
import io
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ flask-marshmallow==1.2.1
Flask-SQLAlchemy==3.1.1
fonttools==4.54.1
greenlet==3.1.1
gseapy==1.1.3
gunicorn==23.0.0
h11==0.14.0
h2==4.1.0
Expand Down Expand Up @@ -80,7 +81,6 @@ typing_extensions==4.12.2
tzdata==2024.2
urllib3==2.2.3
uvicorn==0.30.6
uWSGI==2.0.23
Werkzeug==3.0.4
wheel==0.44.0
zipp==3.20.2
Expand Down
2 changes: 1 addition & 1 deletion survivalAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def get_survival_rate(disease_name, ensg_number = None, gene_symbol = None, samp

# database version
if db_version is not None:

queries.append(models.Dataset.version == db_version)

result = models.SurvivalRate.query \
.filter(*queries) \
Expand Down
2 changes: 1 addition & 1 deletion swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ paths:
content:
application/json:
schema:
type: array
type: object
items:
properties:
data_origin:
Expand Down
Loading