def _extract_sheet_coords_normals(self, aes): groups_ix = groupby_ix(aes.secondary_id) sheets_ix = groups_ix[aes.secondary_type[groups_ix[:, 0]] == 'E'] ca_list = [aes.xyz[aes.types == 'CA'][i:j] for i, j in sheets_ix if j - i] c_list = [aes.xyz[aes.types == 'C'][i:j] for i, j in sheets_ix if j - i] o_list = [aes.xyz[aes.types == 'O'][i:j] for i, j in sheets_ix if j - i] normals_list = [beta_sheet_normals(ca, c, o) for ca, c, o in zip(ca_list, c_list, o_list)] return ca_list, normals_list
def test_geom_ribbon(): # For this test we need chemlab from chemlab.io import datafile system = datafile('tests/data/pdb1g8p.ent', format='pdb').read('system') sheet = system.sub(secondary_structure='E', secondary_id=1) coordinates = sheet.sub(atom_name='CA').r_array normals = beta_sheet_normals(coordinates, sheet.sub(atom_name='C').r_array, sheet.sub(atom_name='O').r_array) ribbon = GeomRibbon(Aes(xyz=coordinates, normals=normals)) reps = ribbon.produce(Aes()) eq_(reps[0]['rep_type'], 'ribbon') npeq_(reps[0]['options']['coordinates'], coordinates) npeq_(reps[0]['options']['normals'], normals)
def test_geom_ribbon(): # For this test we need chemlab from chemlab.io import datafile system = datafile("tests/data/pdb1g8p.ent", format="pdb").read("system") sheet = system.sub(secondary_structure="S", secondary_id=1) coordinates = sheet.sub(atom_name="CA").r_array normals = beta_sheet_normals(sheet) ribbon = GeomRibbon(Aes(xyz=coordinates, normals=normals)) reps = ribbon.produce(Aes()) eq_(reps[0]["rep_type"], "ribbon") npeq_(reps[0]["options"]["coordinates"], coordinates) npeq_(reps[0]["options"]["normals"], normals)