Esempio n. 1
0
 def __init__(self, threshold=0.0, target=None, cavities=False,
              *args, **kwargs):
     ObjectiveProvider.__init__(self, **kwargs)
     self.threshold = threshold
     self._target = target
     self.cavities = cavities
     self.evaluate = self.evaluate_convexhull if self.cavities else self.evaluate_volume
Esempio n. 2
0
 def __init__(self,
              probes=None,
              radius=5.0,
              which='hydrophobic',
              clash_threshold=0.6,
              hydrophobic_threshold=-0.4,
              cutoff=0.0,
              hydrophobic_elements=('C', 'S'),
              bond_separation=4,
              same_residue=True,
              only_internal=False,
              *args,
              **kwargs):
     ObjectiveProvider.__init__(self, **kwargs)
     self.which = which
     self.radius = radius
     self.clash_threshold = clash_threshold
     self.hydrophobic_threshold = hydrophobic_threshold
     self.cutoff = cutoff
     self.hydrophobic_elements = set(hydrophobic_elements)
     self.bond_separation = bond_separation
     self.same_residue = same_residue
     self._probes = probes
     self.only_internal = only_internal
     if which == 'hydrophobic':
         self.evaluate = self.evaluate_hydrophobic
         self.threshold = hydrophobic_threshold
     else:
         self.evaluate = self.evaluate_clashes
         self.threshold = clash_threshold
Esempio n. 3
0
    def __init__(self,
                 binary=None,
                 potentials=None,
                 proteins=('Protein', ),
                 ligands=('Ligand', ),
                 terms=None,
                 sorting=1,
                 cofactor_mode=0,
                 with_covalent=False,
                 with_metals=True,
                 *args,
                 **kwargs):
        ObjectiveProvider.__init__(self, **kwargs)
        self.binary = find_executable(
            'drugscorex') if binary is None else binary
        if not self.binary:
            raise ValueError(
                'Could not find `drugscorex` executable. Please install it '
                'with `conda install -c insilichem drugscorex` or manually '
                'specify the location with `binary` and `potentials` keys.')
        self.potentials = potentials
        self.protein_names = proteins
        self.ligand_names = ligands
        self.terms = terms
        self.sorting = sorting
        self.cofactor_mode = cofactor_mode
        self.with_covalent = with_covalent
        self.with_metals = with_metals

        self._oldworkingdir = os.getcwd()
        self._paths = {}
        if os.name == 'posix' and os.path.exists('/dev/shm'):
            self.tmpdir = '/dev/shm'
        else:
            self.tmpdir = default_tempdir()
Esempio n. 4
0
    def __init__(self,
                 targets=None,
                 forcefields=('amber99sbildn.xml', ),
                 auto_parametrize=None,
                 parameters=None,
                 platform=None,
                 *args,
                 **kwargs):
        if kwargs.get('precision', 6) < 6:
            kwargs['precision'] = 6
        ObjectiveProvider.__init__(self, **kwargs)
        self.auto_parametrize = auto_parametrize
        self._targets = targets
        self._parameters = parameters
        self.platform = platform
        self.topology = None
        self._simulation = None

        additional_ffxml = []
        if parameters:
            additional_ffxml.append(create_ffxml_file(*zip(*parameters)))
        if auto_parametrize:
            filenames = [
                g.path for m in auto_parametrize
                for g in self.environment.cfg.genes if g.name == m
            ]
            additional_ffxml.append(self._gaff2xml(*filenames))

        self._forcefields = tuple(forcefields) + tuple(additional_ffxml)
        self.forcefield = openmm_app.ForceField(*self._forcefields)
Esempio n. 5
0
 def __init__(self,
              protein='Protein',
              ligand='Ligand',
              scoring='chemscore',
              score_component='Score',
              radius=10,
              *args,
              **kwargs):
     ObjectiveProvider.__init__(self, **kwargs)
     self.protein_names = [protein]
     self.ligand_names = [ligand]
     self.scoring = scoring
     self.score_component = score_component
     self.radius = radius
     self.executable = find_executable('gold_auto')
     if self.executable is None:
         sys.exit(
             'GOLD could not be found in $PATH. Is it (correctly) installed?'
         )
     self._oldworkingdir = os.getcwd()
     self._paths = {}
     if os.name == 'posix' and os.path.exists('/dev/shm'):
         self.tmpdir = '/dev/shm'
     else:
         self.tmpdir = default_tempdir()
Esempio n. 6
0
 def __init__(self, probes=None, radius=5.0, distance_tolerance=0.4, angle_tolerance=20.0,
              only_intermolecular=True, *args, **kwargs):
     ObjectiveProvider.__init__(self, **kwargs)
     self._probes = probes
     self.distance_tolerance = distance_tolerance
     self.angle_tolerance = angle_tolerance
     self.radius = radius
     self.intramodel = False if only_intermolecular else True
Esempio n. 7
0
 def __init__(self, receptor='Protein', ligand='Ligand', *args, **kwargs):
     ObjectiveProvider.__init__(self, **kwargs)
     self.receptor = receptor
     self.ligand = ligand
     self._paths = []
     if os.name == 'posix' and os.path.exists('/dev/shm'):
         self.tmpdir = '/dev/shm'
     else:
         self.tmpdir = _get_default_tempdir()
Esempio n. 8
0
 def __init__(self, threshold=None, tolerance=None, target=None, probes=None,
              center_of_mass=False, *args, **kwargs):
     ObjectiveProvider.__init__(self, **kwargs)
     self.threshold = threshold
     self.tolerance = tolerance
     self.center_of_mass = center_of_mass
     self._probes = probes
     self._target = target
     if self.center_of_mass:
         self.evaluate = self.evaluate_center_of_mass
     else:
         self.evaluate = self.evaluate_distances
Esempio n. 9
0
 def __init__(self,
              probes=None,
              radius=5.0,
              distance_tolerance=0.4,
              angle_tolerance=20.0,
              *args,
              **kwargs):
     ObjectiveProvider.__init__(self, **kwargs)
     self._probes = probes
     self.distance_tolerance = distance_tolerance
     self.angle_tolerance = angle_tolerance
     self.radius = radius
Esempio n. 10
0
 def __init__(self,
              targets=None,
              threshold=0.0,
              radius=5.0,
              method='area',
              *args,
              **kwargs):
     ObjectiveProvider.__init__(self, **kwargs)
     self._targets = targets
     self.threshold = threshold
     self.radius = radius
     self.method = method
     if method == 'area':
         self.evaluate = self.evaluate_area
     else:
         self.evaluate = self.evaluate_volume
Esempio n. 11
0
 def __init__(self,
              template=None,
              targets=('Ligand', ),
              parser=None,
              title=None,
              executable=None,
              basis_library=None,
              processors=None,
              *args,
              **kwargs):
     if kwargs.get('precision', 6) < 6:
         kwargs['precision'] = 6
     ObjectiveProvider.__init__(self, **kwargs)
     self.targets = targets
     self.executable = find_executable(
         'nwchem') if executable is None else executable
     if self.executable is None:
         sys.exit(
             'NWChem could not be found in $PATH. Is it (correctly) installed?'
         )
     self._nprocessors = processors
     self._mpirun = find_executable('mpirun') if processors else None
     self._title = title if title is not None else self.environment.cfg.output.name
     if template is None:
         self.template = TEMPLATE
     elif os.path.isfile(template):
         with open(template) as f:
             self.template = f.read()
     else:
         self.template = template
     self.template = self.template.replace('$TITLE', self._title)
     if parser is not None:
         self.parse_output = imp.load_source('_nwchem_parser',
                                             parser).parse_output
     if basis_library is not None and os.path.isdir(basis_library):
         if basis_library[-1] != '/':
             basis_library += '/'
         os.environ['NWCHEM_BASIS_LIBRARY'] = basis_library
     self._oldworkingdir = os.getcwd()
     self._paths = {}
     if os.name == 'posix' and os.path.exists('/dev/shm'):
         self.tmpdir = '/dev/shm'
     else:
         self.tmpdir = default_tempdir()
Esempio n. 12
0
 def __init__(self,
              receptor='Protein',
              ligand='Ligand',
              scoring=None,
              custom_scoring=None,
              custom_atoms=None,
              prepare_each=False,
              *args,
              **kwargs):
     ObjectiveProvider.__init__(self, **kwargs)
     self.receptor = receptor
     self.ligand = ligand
     self.scoring = scoring
     self.custom_scoring = custom_scoring
     self.custom_atoms = custom_atoms
     self.prepare_each = prepare_each
     self._paths = []
     self._tmpfile = None
     if os.name == 'posix' and os.path.exists('/dev/shm'):
         self.tmpdir = '/dev/shm'
     else:
         self.tmpdir = _get_default_tempdir()
Esempio n. 13
0
    def __init__(self,
                 proteins=('Protein', ),
                 ligands=('Ligand', ),
                 method='pose',
                 binary=None,
                 library=None,
                 *args,
                 **kwargs):
        ObjectiveProvider.__init__(self, **kwargs)
        self.protein_names = proteins
        self.ligand_names = ligands
        self.binary = find_executable(
            'ligand_score') if binary is None else binary
        self.library = library
        self.method = method

        self._oldworkingdir = os.getcwd()
        self._paths = {}
        if os.name == 'posix' and os.path.exists('/dev/shm'):
            self.tmpdir = '/dev/shm'
        else:
            self.tmpdir = default_tempdir()
Esempio n. 14
0
 def __init__(self, reference=None, targets=None, only_primaries=False,
              threshold=0.84, *args, **kwargs):
     ObjectiveProvider.__init__(self, **kwargs)
     self.threshold = threshold
     self._reference = reference
     self._targets = targets
Esempio n. 15
0
 def __init__(self, threshold=None, probes=None, *args, **kwargs):
     ObjectiveProvider.__init__(self, **kwargs)
     self.threshold = threshold
     self._probes = probes