def _dssp(self, structure): structure_temp = NamedTemporaryFile(dir = self.dir) structure_file = structure_temp.name with open(structure_file,"w") as handle: handle.write(structure.text) dssp_temp = NamedTemporaryFile(dir = self.dir) cmd = "dssp %s > %s" % (structure_file, dssp_temp.name) import subprocess print cmd subprocess.check_call(cmd,shell=True) from Bio.PDB.DSSP import make_dssp_dict dict, keys = make_dssp_dict(dssp_temp.name) # This can be dangerous... #os.system("rm "+out_file) return dict
def get_dssp(pdbid): f = os.path.join(DSSP_DIR,"%s.dssp"%pdbid) assert(os.path.exists(f)) dssp,keys = make_dssp_dict(f) return DSSP(dssp)