From fc21af9c7f826180bf69c5c910cc14720f271602 Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Wed, 4 Dec 2024 14:17:02 -0800 Subject: [PATCH] Check round trip of chain attributes Make sure that Chain attributes (UniProt accession, asym ID, sequence offset) are stored into and read back from RMF files, if a new enough version of RMF is present. --- modules/rmf/test/test_round_trip.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/modules/rmf/test/test_round_trip.py b/modules/rmf/test/test_round_trip.py index a25004d2c9..ce8ff026e5 100644 --- a/modules/rmf/test/test_round_trip.py +++ b/modules/rmf/test/test_round_trip.py @@ -19,6 +19,12 @@ def test_rt(self): name = self.get_tmp_file_name("test_round_trip" + suffix) h = IMP.atom.read_pdb(self.get_input_file_name("simple.pdb"), m, IMP.atom.NonAlternativePDBSelector()) + chain = h.get_child(0) + self.assertTrue(IMP.atom.Chain.get_is_setup(chain)) + chain = IMP.atom.Chain(chain) + chain.set_uniprot_accession('foobar') + chain.set_sequence_offset(-10) + chain.set_label_asym_id('AAA') h.get_is_valid(True) IMP.set_log_level(IMP.SILENT) IMP.atom.add_bonds(h) @@ -56,6 +62,16 @@ def test_rt(self): IMP.atom.get_surface_area(h2[0]), delta=1e-4) self.assertAlmostEqual(IMP.atom.get_volume(h), IMP.atom.get_volume(h2[0]), delta=1e-4) + chain = h2[0].get_child(0) + self.assertTrue(IMP.atom.Chain.get_is_setup(chain)) + chain = IMP.atom.Chain(chain) + # Accession and sequence offset requires RMF >= 1.6 + if hasattr(RMF.Chain, 'get_uniprot_accession'): + self.assertEqual(chain.get_uniprot_accession(), 'foobar') + self.assertEqual(chain.get_sequence_offset(), -10) + # asym ID requires RMF >= 1.7 + if hasattr(RMF.Chain, 'get_label_asym_id'): + self.assertEqual(chain.get_label_asym_id(), 'AAA') def test_part1(self): """Test round trip 1"""