def test_dimer_tags(self): """Checks the DSSP data tagged to a coiled-coil dimer.""" cc_di = specs.CoiledCoil(2) cc_packed = pack_side_chains_scwrl(cc_di, cc_di.basis_set_sequences) tag_dssp_data(cc_packed) for residue in cc_packed.get_monomers(): self.assertTrue('dssp_data' in residue.tags)
def test_helix_non_canonical_lower(self, sequence): """Test Scwrl sidechain packing using upper and lower case labels.""" helix = ampal.Assembly(specs.Helix(5)) helix = pack_side_chains_scwrl(helix, [sequence]) r_seq = sequence[:] non_can = [x for x in sequence if x.upper() not in cannonical_labels] if non_can: for aa in non_can: r_seq = r_seq.replace(aa, 'G') self.assertEqual(helix.sequences, [r_seq.upper()]) else: self.assertEqual(helix.sequences, [r_seq.upper()])
def test_helix_non_canonical(self, sequence): """Test Scwrl sidechain packing when given non-cannonical residue labels.""" helix = ampal.Assembly(specs.Helix(5)) helix = pack_side_chains_scwrl(helix, [sequence]) non_can = [x for x in sequence if x not in cannonical_labels] r_seq = sequence if non_can: for aa in non_can: r_seq = r_seq.replace(aa, 'G') self.assertEqual(helix.sequences, [r_seq]) else: self.assertEqual(helix.sequences, [r_seq])
def test_convert_pro_to_hyp(self): col = specs.CoiledCoil.tropocollagen(aa=21) col = pack_side_chains_scwrl(col, ['GPPGPPGPPGPPGPPGPPGPP'] * 3) to_convert = [ res for (i, res) in enumerate(col.get_monomers()) if not (i + 1) % 3 ] ori_pros = copy.deepcopy(to_convert) for pro in to_convert: convert_pro_to_hyp(pro) self.assertEqual(col.sequences, ['GPXGPXGPXGPXGPXGPXGPX'] * 3) hyps = to_convert self.assertEqual(len(hyps), 7 * 3) hyp_atom_labels = ('N', 'CA', 'C', 'O', 'CB', 'CG', 'CD', 'OD1') common_atoms = ('N', 'CA', 'C', 'O', 'CB') for (pro, hyp) in zip(ori_pros, hyps): for (label, atom) in hyp.atoms.items(): self.assertTrue(label in hyp_atom_labels) if label in common_atoms: self.assertTrue( numpy.allclose(atom.array, hyp[label].array))
def test_basis_set_tetramer(self): """Test packing basis set tetramer model.""" cc_tet = specs.CoiledCoil(4) cc_packed = pack_side_chains_scwrl(cc_tet, cc_tet.basis_set_sequences) self.assertEqual(cc_packed.sequences, cc_tet.basis_set_sequences)
def test_basis_set_dimer(self): """Test packing basis set dimer model.""" cc_di = specs.CoiledCoil(2) cc_packed = pack_side_chains_scwrl(cc_di, cc_di.basis_set_sequences) self.assertEqual(cc_packed.sequences, cc_di.basis_set_sequences)
def test_helix_seq_packing(self, sequence): """Test Scwrl sidechain packing using a small helix.""" helix = ampal.Assembly(specs.Helix(5)) helix = pack_side_chains_scwrl(helix, [sequence]) self.assertEqual(helix.sequences, [sequence])