From dae386847131c9158aa482ffdc1b80bfbd0f4a93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9mence=20R=C3=A9da?= Date: Thu, 16 May 2024 10:45:45 +0000 Subject: [PATCH] gt bioss notebooks --- {GTBioss2024 => Application_GTBioss2024}/README.md | 1 + .../synthetic_random_diff3-1.ipynb | 0 .../toy_reprogramming_1.ipynb | 0 .../toy_star_1.ipynb | 0 src/NORDic/UTILS/STRING_utils.py | 10 +++++++--- 5 files changed, 8 insertions(+), 3 deletions(-) rename {GTBioss2024 => Application_GTBioss2024}/README.md (96%) rename {GTBioss2024 => Application_GTBioss2024}/synthetic_random_diff3-1.ipynb (100%) rename {GTBioss2024 => Application_GTBioss2024}/toy_reprogramming_1.ipynb (100%) rename {GTBioss2024 => Application_GTBioss2024}/toy_star_1.ipynb (100%) diff --git a/GTBioss2024/README.md b/Application_GTBioss2024/README.md similarity index 96% rename from GTBioss2024/README.md rename to Application_GTBioss2024/README.md index 1057814..fe4d271 100644 --- a/GTBioss2024/README.md +++ b/Application_GTBioss2024/README.md @@ -9,6 +9,7 @@ Note that NORDic relies on [BoneSiS](https://github.com/bioasp/bonesis) for the conda create -n nordic_env python=3.8 -y conda activate nordic_env +conda install -c colomoto -y -q maboss python3 -m pip install nordic jupyter ## clean up (if needed) diff --git a/GTBioss2024/synthetic_random_diff3-1.ipynb b/Application_GTBioss2024/synthetic_random_diff3-1.ipynb similarity index 100% rename from GTBioss2024/synthetic_random_diff3-1.ipynb rename to Application_GTBioss2024/synthetic_random_diff3-1.ipynb diff --git a/GTBioss2024/toy_reprogramming_1.ipynb b/Application_GTBioss2024/toy_reprogramming_1.ipynb similarity index 100% rename from GTBioss2024/toy_reprogramming_1.ipynb rename to Application_GTBioss2024/toy_reprogramming_1.ipynb diff --git a/GTBioss2024/toy_star_1.ipynb b/Application_GTBioss2024/toy_star_1.ipynb similarity index 100% rename from GTBioss2024/toy_star_1.ipynb rename to Application_GTBioss2024/toy_star_1.ipynb diff --git a/src/NORDic/UTILS/STRING_utils.py b/src/NORDic/UTILS/STRING_utils.py index 32e7bdf..831457c 100755 --- a/src/NORDic/UTILS/STRING_utils.py +++ b/src/NORDic/UTILS/STRING_utils.py @@ -8,7 +8,7 @@ from io import StringIO from copy import deepcopy from subprocess import check_output as sbcheck_output -from subprocess import call as sbcall +from subprocess import Popen string_api_url = lambda v : "https://version-"+"-".join(v.split("."))+".string-db.org/api" @@ -78,6 +78,9 @@ def get_protein_names_from_STRING(gene_list, taxon_id, app_name=None, version="1 if ("Error" in res_df.columns): print(" Error from STRING: %s" % str(res_df["ErrorMessage"])) return None + print(gene_list[:5]) + print(len(gene_list)) + print(res_df.columns) return res_df[["queryItem", "stringId", "preferredName", "annotation"]] def get_image_from_STRING(my_genes, taxon_id, file_name="network.png", min_score=0, network_flavor="evidence", network_type="functional", app_name=None, version="11.5", quiet=False): @@ -318,7 +321,8 @@ def get_interactions_from_STRING(gene_list, taxon_id, min_score=0, app_name=None if (not quiet): print(" Retrieving the file from STRING", end="... ") if (file_folder is not None and not os.path.exists(protein_action_fname)): - sbcall("wget -qO- \""+STRING_url+"\" | gzip -d -c > "+protein_action_fname, shell=True) + proc = Popen(("wget -qO- \""+STRING_url+"\" | gzip -d -c > "+protein_action_fname).split(" "), shell=True) + proc.wait() if (file_folder is not None): if (not quiet): print("Saved at %s" % protein_action_fname) @@ -412,4 +416,4 @@ def get_interactions_from_STRING(gene_list, taxon_id, min_score=0, app_name=None print("... Aggregate info once again") network.index = range(network.shape[0]) network.sort_values(by="score", ascending=False) - return network \ No newline at end of file + return network