Skip to content

Commit

Permalink
gt bioss notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Clémence Réda committed May 16, 2024
1 parent 8bc3729 commit dae3868
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 7 additions & 3 deletions src/NORDic/UTILS/STRING_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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("<STRING_utils> 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):
Expand Down Expand Up @@ -318,7 +321,8 @@ def get_interactions_from_STRING(gene_list, taxon_id, min_score=0, app_name=None
if (not quiet):
print("<STRING> 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)
Expand Down Expand Up @@ -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
return network

0 comments on commit dae3868

Please sign in to comment.