예제 #1
0
 def update_grid(self):
     """
     reads the output file from the pocket detection and assigns values to a grid
     :return: None
     """
     lines = Helper.get_lines_from_file(self.settings.out_name)
     for line in lines:
         if line.startswith("HETATM"):
             coordinates = (float(line[31:38]), float(line[39:46]), float(line[47:54]))
             rinacc = float(line[61:66])
             i, j, k = self.grid.point_to_indices(coordinates)
             x, y, z = self.grid.nsteps
             if 0 < i < x and 0 < j < y and 0 < k < z:
                 self.grid.set_value(i, j, k, 9.5 - rinacc)
예제 #2
0
    def pdb_to_grid(path, template):
        """
        converts pdb file to grid

        :param path: path to the input PDB
        :param template: empty grid, NB: must have same grid spec as superstar grids
        :type path: str
        :type template: `hotspots.grid_extension.Grid`

        :return: populated grid
        :rtype: `hotspots.grid_extension.Grid`
        """

        lines = Helper.get_lines_from_file(path)
        for line in lines:
            if line.startswith("HETATM"):
                coordinates = (float(line[31:38]), float(line[39:46]), float(line[47:54]))
                rinacc = float(line[61:66])
                i, j, k = template.point_to_indices(coordinates)
                nx, ny, nz = template.nsteps
                if 0 < i < nx and 0 < j < ny and 0 < k < nz:
                    template.set_value(i, j, k, 9.5 - rinacc)
        return template