Skip to content

Instantly share code, notes, and snippets.

Avatar

Avril Coghlan avrilcoghlan

View GitHub Profile
@avrilcoghlan
avrilcoghlan / retrieve_phenotypeinfo_from_wormbase_for_genelist.py
Created Jun 28, 2019
Script to use the WormBase REST API to retrieve phenotypes (from RNAi, mutants) for an input list of C.elegans genes
View retrieve_phenotypeinfo_from_wormbase_for_genelist.py
import os
import sys
import requests # this is used to access json files
#====================================================================#
# use the wormbase REST API to retrieve the phenotypes (from mutants, RNAi) for a particular gene:
def retrieve_phenotypes_from_wormbase(gene):
@avrilcoghlan
avrilcoghlan / retrieve_phenotypeinfo_from_wormbase.py
Created Jun 28, 2019
Example script to retrieve phenotype data for a C. elegans gene using the WormBase REST API
View retrieve_phenotypeinfo_from_wormbase.py
# script to retrieve the phenotype info for a particular gene from WormBase
import requests, sys
server = "http://rest.wormbase.org"
ext = "/rest/field/gene/WBGene00000079/phenotype"
r = requests.get(server+ext, headers={ "Content-Type" : "application/json", "Accept" : ""})
if not r.ok:
@avrilcoghlan
avrilcoghlan / retrieve_predictedtarget_info_from_chembl_for_compoundlist.py
Created Jun 27, 2019
Script to retrieve predicted targets from ChEMBL for an input list of ChEMBL compounds
View retrieve_predictedtarget_info_from_chembl_for_compoundlist.py
import os
import sys
import pandas as pd # uses pandas python module to view and analyse data
import requests # this is used to access json files
#====================================================================#
# call the 'target prediction' API to find the predicted targets of our list of compounds:
def find_predicted_targets_of_compounds(cmpd_chembl_ids):
@avrilcoghlan
avrilcoghlan / retrieve_genetrees_from_wormbase_parasite.py
Created Jun 20, 2019
Retrieve, and parse, all the gene trees from WormBase ParaSite for a list of Schistosoma mansoni genes
View retrieve_genetrees_from_wormbase_parasite.py
import os
import sys
import requests # this is used to access json files
from ete3 import Phyloxml
import datetime
# Note: this script must be run in Python2 because ete3 uses Python2
#====================================================================#
@avrilcoghlan
avrilcoghlan / retrieve_smansoni_genelist_from_wormbase_parasite.py
Created Jun 19, 2019
Script to get a list of all Schistosoma mansoni protein-coding genes from WormBase ParaSite
View retrieve_smansoni_genelist_from_wormbase_parasite.py
# script to retrieve a list of all protein-coding Schistosoma mansoni genes from wormbase parasite
# example script taken from https://parasite.wormbase.org/rest-13/documentation/info/lookup_genome
import requests, sys
server = "https://parasite.wormbase.org"
ext = "/rest-13/lookup/genome/schistosoma_mansoni_prjea36577?biotypes=protein_coding"
# took the PRJEA from https://parasite.wormbase.org/Schistosoma_mansoni_prjea36577/Info/Index/
r = requests.get(server+ext, headers={ "Content-Type" : "application/json", "Accept" : ""})
@avrilcoghlan
avrilcoghlan / pdb_rest_example_get_uniprot_for_pdbidlist.py
Created Jun 18, 2019
script to retrieve UniProt ids for an input list of PDB ids.
View pdb_rest_example_get_uniprot_for_pdbidlist.py
#!/usr/bin/env python
# example from https://github.com/PDBeurope/PDBe_Programming/blob/master/REST_API/snippets/basic_get_post.py
# edited to use the python 'requests' module, and to get the UniProt id. for particular PDBe entry ids
import argparse
import sys
import requests # this is used to access json files
PY3 = sys.version > '3'
@avrilcoghlan
avrilcoghlan / pdb_rest_example_get_uniprot_for_pdbid.py
Created Jun 18, 2019
script to retrieve the UniProt id for a particular PDB id
View pdb_rest_example_get_uniprot_for_pdbid.py
#!/usr/bin/env python
# example from https://github.com/PDBeurope/PDBe_Programming/blob/master/REST_API/snippets/basic_get_post.py
# edited to use the python 'requests' module, and to get the UniProt id. for a particular PDBe entry id.
import argparse
import sys
import requests # this is used to access json files
PY3 = sys.version > '3'
@avrilcoghlan
avrilcoghlan / "pdb_rest_example_get_pdbids_for_ligandidlist.py
Created Jun 18, 2019
Script to retrieve PDB entry ids for PDB entries that contain PDB ligand ids in an input list of PDB ligand ids.
View "pdb_rest_example_get_pdbids_for_ligandidlist.py
#!/usr/bin/env python
# example from https://github.com/PDBeurope/PDBe_Programming/blob/master/REST_API/snippets/basic_get_post.py
# edited to use the python 'requests' module, and to get the PDB ids. for an input list of PDB ligand ids.
import argparse
import sys
import requests # this is used to access json files
PY3 = sys.version > '3'
@avrilcoghlan
avrilcoghlan / unichem_rest_example_get_pdbligandids_for_chemblidlist.py
Created Jun 18, 2019
Script to retrieve the PDB ligand ids. for a list of input ChEMBL compounds
View unichem_rest_example_get_pdbligandids_for_chemblidlist.py
#!/usr/bin/env python
# script to find out the PDB three-letter ligand id. for a ChEMBL id., using UniChem
import argparse
import sys
import requests # this is used to access json files
PY3 = sys.version > '3'
if PY3:
@avrilcoghlan
avrilcoghlan / unichem_rest_example_get_pdbligandids_for_chemblid.py
Created Jun 17, 2019
Script to use the UniChem REST API to get the PDB ligand identifier for a particular ChEMBL identifier
View unichem_rest_example_get_pdbligandids_for_chemblid.py
#!/usr/bin/env python
# script to find out the PDB three-letter ligand id. for a ChEMBL id., using UniChem
import argparse
import sys
import requests # this is used to access json files
PY3 = sys.version > '3'
if PY3: