@@ -879,6 +879,18 @@ def finalize(self):
879879 for e in self .system .entities :
880880 e .sequence = tuple (e .sequence )
881881
882+ # If the input file defines the complete assembly, transfer
883+ # user-provided info to system.complete_assembly.
884+ # (Assembly._signature() may hash Entities, so the sequence
885+ # needs to be immutable first.)
886+ self .system ._make_complete_assembly ()
887+ complete_sig = self .system .complete_assembly ._signature ()
888+
889+ for a in self .system .orphan_assemblies :
890+ if complete_sig is not None and a ._signature () == complete_sig :
891+ self .system .complete_assembly .name = a .name
892+ self .system .complete_assembly .description = a .description
893+
882894
883895class Handler :
884896 """Base class for all handlers of mmCIF data.
@@ -1488,21 +1500,10 @@ def finalize(self):
14881500 for (a , obj , entity_poly_segment_id ) in self ._read_args :
14891501 a .append (self .sysr .ranges .get (obj , entity_poly_segment_id ))
14901502
1491- self .system ._make_complete_assembly ()
1492- # The order of components should not matter, so put in a consistent
1493- # order so we can compare against other assemblies
1494- complete = sorted (self .system .complete_assembly ,
1495- key = lambda x : id (x ))
1496-
14971503 for a in self .system .orphan_assemblies :
14981504 # Any EntityRange or AsymUnitRange which covers an entire entity,
14991505 # replace with Entity or AsymUnit object
15001506 a [:] = [self ._handle_component (x ) for x in a ]
1501- # If the input file defines the complete assembly, transfer
1502- # user-provided info to system.complete_assembly
1503- if sorted (a , key = lambda x : id (x )) == complete :
1504- self .system .complete_assembly .name = a .name
1505- self .system .complete_assembly .description = a .description
15061507
15071508 def _handle_component (self , comp ):
15081509 if isinstance (comp , ihm .EntityRange ) \
0 commit comments