Skip to content

Commit

Permalink
Allow specifying a chain sequence offset
Browse files Browse the repository at this point in the history
Add a per-chain offset, which defaults to
zero, which maps from the sequence index
(which always starts at 1) to the residue
index (which may not).
  • Loading branch information
benmwebb committed Sep 15, 2023
1 parent 4de3082 commit ac807b5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/DecoratorsAndAttributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ The category name is `sequence` and it includes information about the types and
| `residue index` | int | The index of a residue |
| `chain id` | string | The chain ID |
| `sequence` | string | Primary sequence of a chain |
| `sequence offset`| int | Offset from sequence index to residue index |
| `chain type` | string | Type of chain sequence (e.g. Protein, DNA, RNA) |
| `first residue index` | int | The index of the first residue (in a domain) |
| `last residue index` | int | The index of the last residue (in a domain) |
Expand Down
3 changes: 3 additions & 0 deletions test/test_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ def test_chain(self):
# Check defaults
self.assertEqual(c.get_chain_type(), 'UnknownChainType')
self.assertEqual(c.get_sequence(), '')
self.assertEqual(c.get_sequence_offset(), 0)
# Check setters
c.set_chain_type('LPolypeptide')
c.set_sequence('CGY')
c.set_sequence_offset(10)
c.set_chain_id('X')

# Check both const and non-const getters
Expand All @@ -34,6 +36,7 @@ def check_rmf(self, cf, c0, c1):
c = cf.get(c0)
self.assertEqual(c.get_chain_type(), 'LPolypeptide')
self.assertEqual(c.get_sequence(), 'CGY')
self.assertEqual(c.get_sequence_offset(), 10)
self.assertEqual(c.get_chain_id(), 'X')

if __name__ == '__main__':
Expand Down
1 change: 1 addition & 0 deletions tools/build/make_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
"Chain",
[Attribute("chain id", "String"),
Attribute("sequence", "String", default=""),
Attribute("sequence offset", "Int", default=0),
Attribute("chain type", "String",
default='UnknownChainType')])

Expand Down

0 comments on commit ac807b5

Please sign in to comment.