Exemplo n.º 1
0
    def from_smiles(self,
                    smiles,
                    identifier=None,
                    generate_initial_sites=True):
        if identifier is None:
            identifier = smiles

        if generate_initial_sites:
            parameter_files = _CSDDatabaseLocator.get_conformer_parameter_file_location(
            )
            molmaker = ConformerGeneratorLib.MoleculeTo3D(parameter_files)
            mol = molecule.Molecule(identifier,
                                    molmaker.create_conformation(smiles))
        else:
            molmaker = ChemicalAnalysisLib.SMILESMoleculeMaker()
            mol = molecule.Molecule(identifier,
                                    _molecule=molmaker.siteless_atoms(smiles))
        return mol
Exemplo n.º 2
0
    def generate_fitting_points(self,
                                hr,
                                volume=400,
                                threshold=17,
                                mode='threshold'):
        """
        uses the Fragment Hotspot Maps to generate GOLD fitting points.

        GOLD fitting points are used to help place the molecules into the protein cavity. Pre-generating these fitting
        points using the Fragment Hotspot Maps helps to biast results towards making Hotspot interactions.

        :param `hotspots.result.Result` hr: a Fragment Hotspot Maps result
        :param int volume: volume of the occupied by fitting points in Angstroms ^ 3
        :param float threshold: points above this value will be included in the fitting points
        :param str mode: 'threshold'- assigns fitting points based on a score cutoff or 'bcv'- assigns fitting points from best continuous volume analysis (recommended)
        """
        temp = tempfile.mkdtemp()
        mol = molecule.Molecule(identifier="fitting_pts")

        if mode == 'threshold':
            dic = hr.super_grids["apolar"].grid_value_by_coordinates(
                threshold=threshold)

        elif mode == 'bcv':
            extractor = Extractor(hr=hr, volume=volume, mode="global")
            bv = extractor.extracted_hotspots[0].best_island
            dic = bv.grid_value_by_coordinates(threshold=17)

        else:
            raise TypeError(
                "{} not supported, see documentation for details".format(mode))

        for score, v in dic.items():
            for pts in v:
                atm = molecule.Atom(atomic_symbol='C',
                                    atomic_number=14,
                                    label='{:.2f}'.format(score),
                                    coordinates=pts)
                atm.partial_charge = score
                mol.add_atom(atom=atm)

        fname = os.path.join(temp, 'fit_pts.mol2')
        with io.MoleculeWriter(fname) as w:
            w.write(mol)

        self.fitting_points_file = fname