Skip to content
Permalink
Browse files

minor update

  • Loading branch information...
schallerdavid committed Apr 4, 2019
1 parent ffc757b commit 677dddb55f97339adabfc5c5ba97036517e57a3e
@@ -3,3 +3,4 @@
modules/__pycache__
*trial*
todo
notes
@@ -1,6 +1,11 @@
* v0.7.3
- uses less memory
- support of pdb pharmacophore format for library and centroid generation
- pdb pharmacophore format with directionality
- changed internal pharmacophore format
- renamed folders, files and functions
- improved helper scripts
- minor changes
* v0.7.2
- added h2o dmif
- added centroid feature
@@ -15,21 +15,21 @@ directory:
###############################################################################
### Section for defining parameters for protein centroid generation. The ###
### provided trajectories will be screened for protein conformations that ###
### match the given pharmacophore (pml format) and are not involved in ###
### severe atom clashes with the ligand (mol2 format, optional). Matching ###
### protein conformations will be analyzed to select a protein centroid. ###
### First and last frame parameters can be used to specify the part of the ###
### match the given pharmacophore and are not involved in severe atom ###
### clashes with the ligand (mol2 format, optional). Matching protein ###
### conformations will be analyzed to select a protein centroid. First and ###
### last frame parameters can be used to specify the part of the ###
### trajectories to analyze. If both parameters are empty, trajectories ###
### will be analyzed from beginning to end. Important metals can be ###
### specified comma-separated as named in the topology file (e.g. FE). ###
### Multi processing is supported. If a ligand is not provided, protein ###
### conformations are only checked to match the given pharmacophore. ###
### Several parameters in the pml pharmacophore file !have! to be adjusted ###
### to allow screening of protein conformations (see box below centroid ###
### Several parameters in the pharmacophore file !have! to be adjusted to ###
### allow screening of protein conformations (see box below centroid ###
### parameter section). ###
###############################################################################
ligand:
pharmacophore: /path/to/pharmacophore.pml
pharmacophore: /path/to/pharmacophore.file
topology: /path/to/topology.pdb
trajectories: /path/to/trajectory0.dcd, /path/to/trajectory1.dcd, /path/to/trajectory2.dcd, /path/to/trajectory3.dcd, /path/to/trajectory4.dcd
first frame: 1001
@@ -39,15 +39,18 @@ output name: centroid
number of processes: 1

###############################################################################
### The parameters in the pml file !have! to be modified to provide score ###
### minima for hydrophobic, aromatic and ionizable interactions and !can! ###
### be further modified to make the search for protein interaction partners ###
### for hydrogen bonds and aromatic interactions less or more restrictive. ###
### This can be done in LigandScout or directly in the pml file. ###
### The parameters in the pharmacophore file !have! to be modified to ###
### provide score minima for hydrophobic, aromatic and ionizable ###
### interactions and !can! be further modified to make the search for ###
### protein interaction partners for hydrogen bonds and aromatic ###
### interactions less or more restrictive. This can be done in LigandScout ###
### for pml pharmacophores or directly in the pml or pdb pharmacophore ###
### file using a text editor. ###
### ###
### Score minima are provided with the weight parameters (default = 1) in ###
### the pml file and specify the minimal score to accept an interaction in ###
### the protein conformation screen: ###
### the pml file or the b-factor column in the pdb pharmacophore file and ###
### specify the minimal score to accept an interaction in the protein ###
### conformation screen: ###
### The score of hydrophobic features corresponds to the number of ###
### hydrophobic atoms nearby scaled by buriedness and can be estimated with ###
### the hi_norm dmif, e.g. a score of 3 will filter protein conformations ###
@@ -63,9 +66,9 @@ number of processes: 1
### the atom groups. An optimal distance leads to a score of 1 and is ###
### different for pi-stacking (3.5 A), t-stacking (5.0 A) and cation-pi ###
### interactions (3.8 A). The complete distance based scoring can be found ###
### in pyrod/modules/lookup.py. Similar to ionizable interactions, aromatic ###
### interaction can involve multiple partners leading to a score bigger ###
### than 1. ###
### in pyrod/pyrod_lib/lookup.py. Similar to ionizable interactions, ###
### aromatic interaction can involve multiple partners leading to a score ###
### higher than 1. ###
### The scores of hydrogen bonds are ignored. ###
### ###
### The restrictiveness of the protein conformation search can be further ###
@@ -24,7 +24,7 @@ directory:
### you want to keep the feature weights/scores from the input ###
### pharmacophore. By default they are changed to 1 for every feature. ###
###############################################################################
pharmacophore path: /path/to/pharmacophore.pml
pharmacophore path: /path/to/pharmacophore.file
output format: pml
minimal features: 3
maximal features: 5
@@ -1,18 +1,23 @@
#!/usr/bin/python

""" This script automatically performs a pharmacophore ROC analysis of a pharmacophore library generated by PyRod using
iscreen as implemented in LigandScout. The output file contains a table with enrichment factors, area under the curve
and found actives for each pharmacophore passing the minimum of identified actives criteria. """

import contextlib
import math
import numpy as np
import os
import subprocess
import sys

last_file = 10
current_file = 0
actives = '/path/to/actives.ldb'
decoys = '/path/to/decoys.ldb'
directory = '/path/to/pharmacophore/library'
output_file_name = 'enrichment_factors.txt'
minimum_of_actives = 5 # minimum actives to be found to run a roc curve analysis in percent
last_file = 10 # highest number of names of pharmacophores
current_file = 0 # usually 0 to start screening of 0.pml, can be higher if iscreen crashed at a certain pharmacophore
actives = '/path/to/actives.ldb' # path to actives library
decoys = '/path/to/decoys.ldb' # path to decoys/inactives library
directory = '/path/to/pharmacophore/library' # directory containing the pharmacophore library generated by PyRod
output_file_name = 'roc_statistics.txt' # table with roc statistics for each pharmacophore
minimum_of_actives = 5 # minimum of actives to be found to run a roc curve analysis in percent


def sdf_parser(sdf_path, molecule_count_only=False):
@@ -1,3 +1,8 @@
#!/usr/bin/python

""" This script runs MD simulations as replica in a serial fashion with OpenMM and automatically converts the output
with vmd by centering the protein in the water box and by aligning on heavy atoms of the protein of the first frame. """

import simtk.openmm.app as app
import simtk.openmm as mm
import simtk.unit as unit
@@ -25,27 +30,27 @@
directory = directory + '/'

# create tcl-file for vmd conversion
with open(directory + '/md_conversion.tcl', 'w') as file:
with open(directory + 'md_conversion.tcl', 'w') as file:
file.write(
'package require pbctools\n' +
'pbc wrap -centersel protein -center com -compound res -all\n' +
'proc fitframes { molid seltext } {\n' +
' set ref [atomselect \$molid \$seltext frame 0]\n' +
' set sel [atomselect \$molid \$seltext]\n' +
' set all [atomselect \$molid all]\n' +
' set n [molinfo \$molid get numframes]\n' +
'\n' +
' for { set i 1 } { \$i < \$n } { incr i } {\n' +
' \$sel frame \$i\n' +
' \$all frame \$i\n' +
' \$all move [measure fit \$sel \$ref]\n' +
' }\n' +
' return\n' +
'}\n' +
'fitframes top backbone\n' +
'animate write pdb mds_prep/\$argv.pdb beg 0 end 0\n' +
'animate write dcd mds_prep/\$argv.dcd beg 1 end -1\n' +
'quit\n'
'pbc wrap -centersel protein -center com -compound res -all\n' +
'proc fitframes { molid seltext } {\n' +
' set ref [atomselect \$molid \$seltext frame 0]\n' +
' set sel [atomselect \$molid \$seltext]\n' +
' set all [atomselect \$molid all]\n' +
' set n [molinfo \$molid get numframes]\n' +
'\n' +
' for { set i 1 } { \$i < \$n } { incr i } {\n' +
' \$sel frame \$i\n' +
' \$all frame \$i\n' +
' \$all move [measure fit \$sel \$ref]\n' +
' }\n' +
' return\n' +
'}\n' +
'fitframes top backbone\n' +
'animate write pdb mds_prep/\$argv.pdb beg 0 end 0\n' +
'animate write dcd mds_prep/\$argv.dcd beg 1 end -1\n' +
'quit\n'
)

# create solvated system
@@ -110,10 +110,11 @@ def chunks(iterable, chunk_size):
update_user('Processing results.', logger)
dmif, partners = post_processing(results, total_number_of_frames)
results = None
pickle_writer(dmif, 'dmif', '/'.join([directory, 'data']), logger)
update_user('Writing raw data to {}/data.'.format(directory), logger)
pickle_writer(dmif, 'dmif', '{}/{}'.format(directory, 'data'))
if get_partners:
for key in grid_list_dict.keys():
pickle_writer(partners[key].tolist(), key, '/'.join([directory, 'data']), logger)
pickle_writer(partners[key].tolist(), key, '/'.join([directory, 'data']))
partners = None
update_user('Writing maps to {}/dmifs.'.format(directory), logger)
for map_format in map_formats:
@@ -128,7 +129,7 @@ def chunks(iterable, chunk_size):
dmif = pickle_reader(config.get('exclusion volume parameters', 'dmif'), 'dmif', logger)
shape_cutoff, restrictive = exclusion_volume_parameters(config)
evs = generate_exclusion_volumes(dmif, directory, debugging, shape_cutoff, restrictive)
pickle_writer(evs, 'exclusion_volumes', '/'.join([directory, 'data']), logger)
pickle_writer(evs, 'exclusion_volumes', '/'.join([directory, 'data']))
# generating features
if config.has_section('feature parameters'):
logger.debug('\n'.join([': '.join(list(_)) for _ in config.items('feature parameters')]))
@@ -154,7 +155,7 @@ def chunks(iterable, chunk_size):
process.join()
update_user('Generated {} features.'.format(len(results)), logger)
features = renumber_features(results)
pickle_writer(features, 'features', '/'.join([directory, 'data']), logger)
pickle_writer(features, 'features', '/'.join([directory, 'data']))
# pharmacophore generation
if config.has_section('pharmacophore parameters'):
logger.debug('\n'.join([': '.join(list(_)) for _ in config.items('pharmacophore parameters')]))
@@ -203,12 +204,12 @@ def chunks(iterable, chunk_size):
if config.has_section('centroid parameters'):
update_user('Starting screening of protein conformations.', logger)
logger.debug('\n'.join([': '.join(list(_)) for _ in config.items('centroid parameters')]))
ligand, pharmacophore, topology, trajectories, first_frame, last_frame, total_number_of_frames, metal_names, \
output_name, number_of_processes = centroid_parameters(config)
ligand, pharmacophore_path, topology, trajectories, first_frame, last_frame, total_number_of_frames, \
metal_names, output_name, number_of_processes = centroid_parameters(config)
frame_counter = multiprocessing.Value('i', 0)
trajectory_time = time.time()
processes = [multiprocessing.Process(target=screen_protein_conformations, args=(topology, trajectory,
pharmacophore, ligand, counter, first_frame, last_frame, metal_names, directory, output_name,
pharmacophore_path, ligand, counter, first_frame, last_frame, metal_names, directory, output_name,
debugging, total_number_of_frames, frame_counter, trajectory_time)) for counter, trajectory in
enumerate(trajectories)]
if len(trajectories) > 1:
@@ -7,11 +7,10 @@
# python standard library
import copy
import operator

# external libraries
import pickle
import sys

# external libraries
import numpy as np

# pyrod modules
@@ -4,12 +4,10 @@
"""

# python standard libraries
import copy
from itertools import combinations
import os
import sys
import time
import xml.etree.ElementTree as et

# external libraries
import numpy as np
@@ -132,7 +130,6 @@ def generate_features(positions, feature_scores, feature_type, features_per_feat
7 - score
"""
logger = setup_logger('_'.join(['features', feature_type]), directory, debugging)
#update_user('Starting {} feature generation.'.format(feature_type), logger)
if partner_path is None:
partner_path = directory + '/data'
if feature_type in grid_list_dict.keys():
@@ -4,8 +4,6 @@
"""


# python standard library

# external libraries
import numpy as np

@@ -4,18 +4,12 @@
"""

# python standard libraries
import copy
import time
from itertools import starmap
import logging
import os
import pickle
import sys
import xml.etree.ElementTree as et

# external libraries
import numpy as np

# pyrod modules
try:
from pyrod.pyrod_lib.lookup import feature_types
@@ -363,10 +357,9 @@ def dmif_writer(scores, positions, file_format, name, directory, logger):
return


def pickle_writer(data, name, directory, logger):
def pickle_writer(data, name, directory):
""" This function writes data using the pickle module. """
name = '{}.pkl'.format(name)
update_user('Writing {} to {}.'.format(name, directory), logger)
file_path(name, directory)
with open('{}/{}'.format(directory, name), 'wb') as file:
pickle.dump(data, file, pickle.HIGHEST_PROTOCOL)

0 comments on commit 677dddb

Please sign in to comment.
You can’t perform that action at this time.