def test_subsequence(self): """Test setup of subsequence""" mh = IMP.atom.read_pdb(self.get_input_file_name('chainA.pdb'),self.mdl) sd = Subsequence(chain='A',residue_tuple=(100,125)) sd.add_range(chain='A',residue_tuple=(325,355)) sel = sd.get_selection(hier=mh,atom_type=IMP.atom.AtomType('CA')) idxs = sorted([IMP.atom.get_residue(IMP.atom.Atom(h)).get_index() for h in sel.get_selected_particles()]) self.assertEqual(idxs,list(range(100,126))+list(range(325,356))) self.assertEqual(sd.__repr__(),'100-125.A_325-355.A')
def test_subsequence_data(self): """Test the SubsequenceData collection""" ssd = SubsequenceData() ssd.add_subsequence('helix',Subsequence(molecule='m1', residue_tuple=(55,58))) ssd.add_subsequence('helix',Subsequence(molecule='m2', residue_tuple=(195,208))) beta = Subsequence(molecule='m1',residue_tuple=(5,10)) beta.add_range(molecule='m2',residue_tuple=(95,100)) ssd.add_subsequence('beta',beta) self.assertEqual(len(ssd['helix']),2) self.assertEqual(len(ssd['beta']),1) self.assertEqual(ssd['helix'][0].__repr__(), '55-58.m1') self.assertEqual(ssd['helix'][1].__repr__(), '195-208.m2') self.assertEqual(ssd['beta'][0].__repr__(), '5-10.m1_95-100.m2')
def test_subsequence(self): """Test setup of subsequence""" mh = IMP.atom.read_pdb(self.get_input_file_name('chainA.pdb'), self.mdl) sd = Subsequence(chain='A', residue_tuple=(100, 125)) sd.add_range(chain='A', residue_tuple=(325, 355)) sel = sd.get_selection(hier=mh, atom_type=IMP.atom.AtomType('CA')) idxs = sorted([ IMP.atom.get_residue(IMP.atom.Atom(h)).get_index() for h in sel.get_selected_particles() ]) self.assertEqual(idxs, list(range(100, 126)) + list(range(325, 356))) self.assertEqual(sd.__repr__(), '100-125.A_325-355.A')
def test_subsequence_data(self): """Test the SubsequenceData collection""" ssd = SubsequenceData() ssd.add_subsequence('helix', Subsequence(molecule='m1', residue_tuple=(55, 58))) ssd.add_subsequence( 'helix', Subsequence(molecule='m2', residue_tuple=(195, 208))) beta = Subsequence(molecule='m1', residue_tuple=(5, 10)) beta.add_range(molecule='m2', residue_tuple=(95, 100)) ssd.add_subsequence('beta', beta) self.assertEqual(len(ssd['helix']), 2) self.assertEqual(len(ssd['beta']), 1) self.assertEqual(ssd['helix'][0].__repr__(), '55-58.m1') self.assertEqual(ssd['helix'][1].__repr__(), '195-208.m2') self.assertEqual(ssd['beta'][0].__repr__(), '5-10.m1_95-100.m2')