def test_is_backbone_intact(self): """Check all kinds of backbone discontinuities in one residue.""" chain=PDBParser().get_structure('test_struc',BROKEN_BACKBONE)[0].child_list[0] residues = [r for r in chain] for resi in residues[:5]: mr = RNAResidue(resi) self.assertFalse(is_backbone_intact(mr)) mr = RNAResidue(chain[6]) self.assertTrue(is_backbone_intact(mr))
def is_intact(self): """Checks whether the backbone is complete.""" if not is_backbone_intact(self.resi1, mode="3'") or \ not is_backbone_intact(self.resi2, mode="5'") or \ not are_residues_connected(self.resi1, self.resi2) or \ not is_phosphate_intact(self.resi2) or \ is_backbone_congested(self.resi1, mode="3'") or \ is_backbone_congested(self.resi2, mode="5'"): return False return True
def test_is_backbone_intact_5p3p(self): """Check all kinds of backbone discontinuities in one residue.""" chain=PDBParser().get_structure('test_struc',BROKEN_BACKBONE)[0].child_list[0] residues = [r for r in chain] result_5p = [] result_3p = [] for resi in residues[:6]: mr = RNAResidue(resi) result_5p.append(is_backbone_intact(mr, mode="5'")) result_3p.append(is_backbone_intact(mr, mode="3'")) self.assertEqual(result_5p, [False, False, False, False, True, True]) self.assertEqual(result_3p, [True, True, True, False, False, True])
def write_resi_status(self, resi): log.write_message('Status of residue: %s' % resi.identifier) if is_backbone_intact(resi): log.write_message('\tbackbone OK') else: log.write_message('\tbackbone INTERRUPTED') if is_phosphate_intact(resi): log.write_message('\tphosphate OK') else: log.write_message('\tphosphate BROKEN') if is_backbone_congested(resi): log.write_message('\tclashes OCCUR') else: log.write_message('\clashes OK')
def test_validation(self): """Makes sure test data is set up properly.""" self.assertFalse(is_backbone_intact(self.resi2)) self.assertFalse(are_residues_connected(self.resi1, self.resi2))