Last active
August 29, 2015 14:15
-
-
Save mnowotka/72b801c0265ca9000461 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from chembl_webresource_client.new_client import new_client | |
# Get Molecules with ATC 'A10' classification | |
molecules = new_client.molecule.filter(atc_classifications__level5__startswith='A10') | |
molecule_ids = [mol['molecule_chembl_id'] for mol in molecules] | |
# Get Targets for Molecules | |
activities = new_client.activity.filter(molecule_chembl_id__in=molecule_ids).filter(pchembl_value__gte=6) | |
target_ids = set([act['target_chembl_id'] for act in activities]) | |
# Get Target Details | |
targets = new_client.target.filter(target_chembl_id__in=target_ids) | |
for target in targets: | |
accessions = ", ".join([comp['accession'] for comp in target['target_components']]) | |
print [target['pref_name'], target['organism'], target['target_type'], accessions] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment