def models_from_pdb(fname): """Get models from a PDB as individual poses. Parameters ---------- fname : str Path to a PDB. Yields ------ pyrosetta.Pose The next model in the PDB. """ p = pyrosetta.Pose() with open(fname, "r") as f: model = [] for l in f: if (l.startswith("#")): continue line = l.rstrip() model.append(line) if (line.startswith("ENDMDL")): pose_from_pdbstring(p, pdbcontents="\n".join(model)) yield p.clone() model = [] if (len(model)): pose_from_pdbstring(p, pdbcontents="\n".join(model)) yield p.clone()
def pose_from_pdbstring(*args, **kwargs): result = pose.Pose() import_pose.pose_from_pdbstring(result, *args, **kwargs) return result
CONECT 5 4 CONECT 6 4 CONECT 7 8 CONECT 8 7 9 12 CONECT 9 8 10 11 CONECT 10 9 13 14 CONECT 11 9 15 16 CONECT 12 8 CONECT 13 10 CONECT 14 10 CONECT 15 11 CONECT 16 11 """ pose = Pose() pose_from_pdbstring(pose, contents) sc_donor = { 1: [ pick_ray(pose.residue(1), "1HD2", "ND2"), pick_ray(pose.residue(1), "2HD2", "ND2") ], 2: [ pick_ray(pose.residue(2), "HE", "NE"), pick_ray(pose.residue(2), "1HH1", "NH1"), pick_ray(pose.residue(2), "2HH1", "NH1"), pick_ray(pose.residue(2), "1HH2", "NH2"), pick_ray(pose.residue(2), "2HH2", "NH2") ] }
def dummy(): p = Pose() pose_from_pdbstring(p, contents) return p