Skip to content

Commit

Permalink
Merge pull request #54 from daisybio/dev
Browse files Browse the repository at this point in the history
Add Sponge logging and node sorting
  • Loading branch information
nictru authored Dec 20, 2024
2 parents 7569035 + c1856da commit 657e313
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 2 additions & 0 deletions app/controllers/spongEffects.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from app.controllers.externalInformation import get_genes, get_transcripts
import app.models as models
from app.config import LATEST, db
from server import logger


def get_spongEffects_run_ID(dataset_ID: int = None, disease_name: str = None, level: str = "gene", sponge_db_version: int = LATEST):
Expand Down Expand Up @@ -361,6 +362,7 @@ def run_spongEffects(file_path, out_path, params: Params = None, log: bool = Fal
process = subprocess.run(cmd, capture_output=True, text=True, check=True)
# get prediction output
stderr = process.stderr
logger.info(stderr)
with open(out_path, 'r') as json_file:
return json.load(json_file)
except subprocess.CalledProcessError as e:
Expand Down
22 changes: 11 additions & 11 deletions app/controllers/transcriptInteraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,21 +285,21 @@ def read_all_transcript_network_analysis(dataset_ID: int = None, disease_name=No
# add all sorting if given:
sort = [models.networkAnalysisTranscript.sponge_run_ID]
if sorting is not None:
if sort == "betweenness":
if sorting == "betweenness":
if descending:
sort.append(models.networkAnalysisTranscript.betweenness.desc())
else:
sort.append(models.networkAnalysisTranscript.betweenness.asc())
if sort == "degree":
if descending:
sort.append(models.networkAnalysisTranscript.node_degree.desc())
else:
sort.append(models.networkAnalysisTranscript.node_degree.asc())
if sort == "eigenvector":
if descending:
sort.append(models.networkAnalysisTranscript.eigenvector.desc())
else:
sort.append(models.networkAnalysisTranscript.eigenvector.asc())
if sorting == "degree":
if descending:
sort.append(models.networkAnalysisTranscript.node_degree.desc())
else:
sort.append(models.networkAnalysisTranscript.node_degree.asc())
if sorting == "eigenvector":
if descending:
sort.append(models.networkAnalysisTranscript.eigenvector.desc())
else:
sort.append(models.networkAnalysisTranscript.eigenvector.asc())

result = models.networkAnalysisTranscript.query \
.join(models.Transcript, models.Transcript.transcript_ID == models.networkAnalysisTranscript.transcript_ID) \
Expand Down

0 comments on commit 657e313

Please sign in to comment.