Skip to content

Commit

Permalink
Check round trip of chain attributes
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
benmwebb committed Dec 4, 2024
1 parent 49f026e commit fc21af9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions modules/rmf/test/test_round_trip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"""
Expand Down

0 comments on commit fc21af9

Please sign in to comment.