Example #1
0
 def _pre_exec(self):
     if self.occupancy_one:
         occ_file = "occupancy_one.pdb"
         npdb = NumPdb(self.pdb_input)
         npdb['occupancy'] = 1.0
         npdb.write(occ_file)
         self.pdb_input = self.outpath(occ_file)
Example #2
0
    def _post_exec(self):
        print('TEST 1')
        print(self.relpath(self.dowser_file))
        if '++' in self.relpath(self.dowser_file):
            print('TEST !!!')
            print('Dowser++ not looked at!')
            return None
        self._make_provi_file(input_file=self.relpath(self.input_file),
                              wat_file=self.relpath(self.wat_file),
                              watall_file=self.relpath(self.watall_file),
                              intsurf_file=self.relpath(self.intsurf_file))
        # make sure all file exist

        for f in [self.wat_file, self.watall_file, self.intsurf_file]:
            with open(f, "a"):
                pass
        # write a pdb with all dowser waters but no others
        with open(self.dowser_file, "w") as fp:
            with open(self.pdb_file, "r") as fp_pdb:
                for line in fp_pdb:
                    if (line[0:6] in ["ATOM  ", "HETATM"]
                            and line[17:20] != "HOH"):
                        fp.write(line)
            with open(self.wat_file, "r") as fp_wat:
                for line in fp_wat:
                    if line[0:6] in ["HETATM"]:
                        fp.write(line)
        # rename HOH.OW atoms to HOH.O and
        # repair atom index
        npdb = NumPdb(self.dowser_file)
        for i, a in enumerate(npdb._atoms, start=1):
            if a["atomname"] == " OW " and a["resname"] == "HOH":
                a["atomname"] = " O  "
            a["atomno"] = i
        npdb.write(self.dowser_file)
Example #3
0
 def _crop_pdb( self ):
     npdb = NumPdb( self.pdb_file )
     npdb.write(
         self.cropped_pdb,
         chain=self.res1["chain"],
         resno=[ self.res1["resno"] + 1, self.res2["resno"] - 1 ],
         invert=True
     )