Skip to content

Instantly share code, notes, and snippets.

View avrilcoghlan's full-sized avatar

Avril Coghlan avrilcoghlan

View GitHub Profile
@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_uniprot_for_pdbid.py
Created June 18, 2019 10:37
script to retrieve the UniProt id for a particular PDB id
#!/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 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 / retrieve_bioactivity_info_from_chembl.py
Created May 30, 2019 10:11
Python script to query the ChEMBL database to retrieve a list of compounds with bioactivities for certain target proteins, and then retrieve information on the molecular properties of those compounds
import pandas as pd # uses pandas python module to view and analyse data
import requests # this is used to access json files
#====================================================================#
# using a list of known targets, find compounds that are active on these targets:
def find_bioactivities_for_targets(targets):
targets = ",".join(targets) # join the targets into a suitable string to fulfil the search conditions of the ChEMBL api
@avrilcoghlan
avrilcoghlan / Find_compounds_for_NTD_targets_and_filter_those_compounds.ipynb
Created May 29, 2019 09:56
Python notebook to query ChEMBL, to retrieve compounds with bioactivities for certain targets, and obtain properties of those compounds
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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):
@avrilcoghlan
avrilcoghlan / list_dogdy_genes_in_embl_file.py
Created November 28, 2018 09:44
Script to make a list of dodgy genes in an EMBL file, based on the VAL_ERROR.txt file produced by the ENA's file validator
import sys
import os
from collections import defaultdict
#====================================================================#
# read in the set of lines with dodgy genes on them in the embl file:
def read_lines_with_dodgy_genes(input_error_file):