Skip to content

Instantly share code, notes, and snippets.

View avrilcoghlan's full-sized avatar

Avril Coghlan avrilcoghlan

View GitHub Profile
@avrilcoghlan
avrilcoghlan / retrieve_phenotypeinfo_from_wormbase.py
Created June 28, 2019 10:34
Example script to retrieve phenotype data for a C. elegans gene using the WormBase REST API
# 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_genetrees_from_wormbase_parasite.py
Created June 20, 2019 09:35
Retrieve, and parse, all the gene trees from WormBase ParaSite for a list of Schistosoma mansoni genes
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 June 19, 2019 09:25
Script to get a list of all Schistosoma mansoni protein-coding genes from WormBase ParaSite
# 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 June 18, 2019 11:18
script to retrieve UniProt ids for an input list of PDB ids.
#!/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_pdbids_for_ligandidlist.py
Created June 18, 2019 10:15
Script to retrieve PDB entry ids for PDB entries that contain PDB ligand ids in an input list of PDB ligand ids.
#!/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 June 18, 2019 09:21
Script to retrieve the PDB ligand ids. for a list of input ChEMBL compounds
#!/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 June 17, 2019 11:39
Script to use the UniChem REST API to get the PDB ligand identifier for a particular ChEMBL identifier
#!/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 / pdb_rest_example_get_pbids_with_ligand.py
Created June 17, 2019 10:58
Use the PDB REST API to get a list of PDB entries that contain a particular ligand
#!/usr/bin/env python
# adapted example from https://github.com/PDBeurope/PDBe_Programming/blob/master/REST_API/snippets/basic_get_post.py
# edited to use the python 'requests' module
import argparse
import sys
import requests # this is used to access json files
PY3 = sys.version > '3'
@avrilcoghlan
avrilcoghlan / get_orths_from_newick_tree.pl
Created March 1, 2013 16:19
Perl script to read a Newick tree file from TreeFam, and print out the orthologs of a particular input gene based on the tree.
#!/usr/bin/perl
#---------------------------------------------------------------------------------------------#
#
# A Perl script to read a Newick tree file from Treefam, and
# print out the orthologues of a particular input gene.
#
# Avril Coghlan. 6-Dec-04.
# avril.coghlan@ucd.ie
#
@avrilcoghlan
avrilcoghlan / fix_embl_file_cds_error.py
Created November 28, 2018 10:04
Script to correct EMBL files so that CDSs with >50% internal Ns are marked as /pseudo
import sys
import os
from collections import defaultdict
#====================================================================#
# read in the line numbers of dodgy CDS:
def read_error_file(error_file):