@@ -266,12 +266,13 @@ public void identify(final List<Chain> chains,
266266 return ;
267267 }
268268
269-
269+ Map < String , Chain > mapChainIdChain = new HashMap < String , Chain >( chains . size ());
270270 residues = new ArrayList <Group >();
271271 List <Group > ligands = new ArrayList <Group >();
272272 Map <Component , Set <Group >> mapCompGroups = new HashMap <Component , Set <Group >>();
273273
274274 for (Chain chain : chains ) {
275+ mapChainIdChain .put (chain .getChainID (), chain );
275276
276277 List <Group > ress = StructureUtil .getAminoAcids (chain );
277278
@@ -316,7 +317,7 @@ public void identify(final List<Chain> chains,
316317 if (recordAdditionalAttachments ) {
317318 // identify additional groups that are not directly attached to amino acids.
318319 for (ModifiedCompound mc : modComps ) {
319- identifyAdditionalAttachments (mc , ligands , chains );
320+ identifyAdditionalAttachments (mc , ligands , mapChainIdChain );
320321 }
321322 }
322323
@@ -382,7 +383,7 @@ private void processCrosslink1(Map<Component, Set<Group>> mapCompGroups,
382383 * @return a list of added groups
383384 */
384385 private void identifyAdditionalAttachments (ModifiedCompound mc ,
385- List <Group > ligands , List < Chain > chains ) {
386+ List <Group > ligands , Map < String , Chain > mapChainIdChain ) {
386387 if (ligands .isEmpty ()) {
387388 return ;
388389 }
@@ -406,7 +407,7 @@ private void identifyAdditionalAttachments(ModifiedCompound mc,
406407 resNum .setInsCode (num .getInsCode ());
407408 //group = chain.getGroupByPDB(numIns);
408409
409- group = getGroup (num , chains );
410+ group = mapChainIdChain . get (num . getChainId ()). getGroupByPDB ( resNum );
410411 //group = mapChainIdChain.get(num.getChainId()).getGroupByPDB(resNum);
411412 } catch (StructureException e ) {
412413 logger .error ("Exception: " , e );
@@ -565,7 +566,7 @@ private void recordUnidentifiableModifiedResidues(List<ModifiedCompound> modComp
565566 if (group .getType ().equals (GroupType .HETATM )) {
566567 StructureGroup strucGroup = StructureUtil .getStructureGroup (
567568 group , true );
568- strucGroup .setChainId (group .getChainId ());
569+ // strucGroup.setChainId(group.getChainId());
569570
570571 if (!identifiedComps .contains (strucGroup )) {
571572 unidentifiableModifiedResidues .add (strucGroup );
0 commit comments