Skip to content

Commit

Permalink
Add ins code to output pdbx_branch_scheme table
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Feb 10, 2024
1 parent 4a01eba commit 34aba4a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions ihm/dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ class _BranchSchemeDumper(Dumper):
def dump(self, system, writer):
with writer.loop("_pdbx_branch_scheme",
["asym_id", "entity_id", "mon_id", "num",
"pdb_seq_num", "auth_seq_num",
"pdb_seq_num", "pdb_ins_code", "auth_seq_num",
"auth_mon_id", "pdb_mon_id", "pdb_asym_id"]) as lp:
for asym in system.asym_units:
entity = asym.entity
Expand All @@ -758,7 +758,7 @@ def dump(self, system, writer):
lp.write(asym_id=asym._id, pdb_asym_id=asym.strand_id,
entity_id=entity._id,
num=num + 1,
pdb_seq_num=pdb_seq_num,
pdb_seq_num=pdb_seq_num, pdb_ins_code=ins,
auth_seq_num=auth_seq_num,
mon_id=comp.id, auth_mon_id=comp.id,
pdb_mon_id=comp.id)
Expand Down
22 changes: 15 additions & 7 deletions test/test_dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5112,12 +5112,17 @@ def test_branch_scheme_dumper(self):
ihm.SaccharideChemComp('FUC')])
e2 = ihm.Entity([ihm.SaccharideChemComp('FUC'),
ihm.SaccharideChemComp('BGC')])
e3 = ihm.Entity([ihm.SaccharideChemComp('NAG'),
ihm.SaccharideChemComp('BGC')])
# Non-branched entity
e3 = ihm.Entity('ACT')
system.entities.extend((e1, e2, e3))
e4 = ihm.Entity('ACT')
system.entities.extend((e1, e2, e3, e4))
system.asym_units.append(ihm.AsymUnit(e1, 'foo'))
system.asym_units.append(ihm.AsymUnit(e2, 'bar', auth_seq_id_map=5))
system.asym_units.append(ihm.AsymUnit(e3, 'baz'))
system.asym_units.append(ihm.AsymUnit(
e3, 'bar', auth_seq_id_map={1: 6, 2: (7, 'A')},
orig_auth_seq_id_map={1: 100}))
system.asym_units.append(ihm.AsymUnit(e4, 'baz'))
ihm.dumper._EntityDumper().finalize(system)
ihm.dumper._StructAsymDumper().finalize(system)
dumper = ihm.dumper._BranchSchemeDumper()
Expand All @@ -5129,14 +5134,17 @@ def test_branch_scheme_dumper(self):
_pdbx_branch_scheme.mon_id
_pdbx_branch_scheme.num
_pdbx_branch_scheme.pdb_seq_num
_pdbx_branch_scheme.pdb_ins_code
_pdbx_branch_scheme.auth_seq_num
_pdbx_branch_scheme.auth_mon_id
_pdbx_branch_scheme.pdb_mon_id
_pdbx_branch_scheme.pdb_asym_id
A 1 NAG 1 1 1 NAG NAG A
A 1 FUC 2 2 2 FUC FUC A
B 2 FUC 1 6 6 FUC FUC B
B 2 BGC 2 7 7 BGC BGC B
A 1 NAG 1 1 . 1 NAG NAG A
A 1 FUC 2 2 . 2 FUC FUC A
B 2 FUC 1 6 . 6 FUC FUC B
B 2 BGC 2 7 . 7 BGC BGC B
C 3 NAG 1 6 . 100 NAG NAG C
C 3 BGC 2 7 A 7 BGC BGC C
#
""")

Expand Down

0 comments on commit 34aba4a

Please sign in to comment.