Skip to content

Commit

Permalink
Add report of atomic representation segments
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Sep 13, 2023
1 parent c84a653 commit 33115a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions ihm/representation.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ class AtomicSegment(Segment):
count = None
granularity = 'by-atom'

def _get_report(self):
asym = self.asym_unit
return ("%s %d-%d as %s atoms%s"
% (asym.details, asym.seq_id_range[0], asym.seq_id_range[1],
"rigid" if self.rigid else "flexible",
_starting_model_report(self)))

def __init__(self, asym_unit, rigid, starting_model=None,
description=None):
self.asym_unit = asym_unit
Expand Down
3 changes: 2 additions & 1 deletion test/test_representation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ def test_segment(self):

def test_atomic_segment(self):
"""Test AtomicSegment class"""
asym = ihm.AsymUnit(ihm.Entity('A' * 30))
asym = ihm.AsymUnit(ihm.Entity('A' * 30), "testdetail")
s = ihm.representation.AtomicSegment(
asym_unit=asym(1, 10), rigid=True, starting_model=None)
self.assertEqual(s.asym_unit.seq_id_range, (1, 10))
self.assertEqual(s.primitive, 'atomistic')
self.assertEqual(s.granularity, 'by-atom')
self.assertIsNone(s.count)
self.assertEqual(s.rigid, True)
self.assertEqual(s._get_report(), "testdetail 1-10 as rigid atoms")

def test_residue_segment(self):
"""Test ResidueSegment class"""
Expand Down

0 comments on commit 33115a9

Please sign in to comment.