@@ -493,32 +493,31 @@ public static UndirectedGraph<Integer, DefaultEdge> buildSymmetryGraph(
493493
494494 /**
495495 * Method that converts the symmetric units of a structure into different
496- * chains, so that internal symmetry can be translated into quaternary.
497- * <p>
498- * Application: obtain the internal symmetry axis with the quaternary
499- * symmetry code in biojava or calculate independent repeat properties.
496+ * structures, so that they can be individually visualized.
500497 *
501498 * @param symmetry
502499 * CeSymmResult
503- * @return Structure with different chains for every symmetric unit
500+ * @throws StructureException
501+ * @result List of structures, by repeat index sequentially
502+ *
504503 */
505- public static Structure getQuaternaryStructure (CeSymmResult symmetry ) {
504+ public static List <Structure > divideStructure (CeSymmResult symmetry )
505+ throws StructureException {
506506
507507 if (!symmetry .isRefined ())
508508 throw new IllegalArgumentException ("The symmetry result "
509509 + "is not refined, repeats cannot be defined" );
510510
511+ int order = symmetry .getMultipleAlignment ().size ();
511512 Atom [] atoms = StructureTools .cloneAtomArray (symmetry .getAtoms ());
512-
513- Structure symm = new StructureImpl ();
514- symm .setStructureIdentifier (symmetry .getStructureId ());
515- symm .setChains (new ArrayList <Chain >());
516- char chainID = 'A' ;
513+ List <StructureIdentifier > repeatsId = symmetry .getRepeatsID ();
514+ List <Structure > repeats = new ArrayList <Structure >(order );
517515
518516 // Create new structure containing the repeat atoms
519- for (int i = 0 ; i < symmetry . getMultipleAlignment (). size () ; i ++) {
517+ for (int i = 0 ; i < order ; i ++) {
520518
521- Chain newCh = new ChainImpl ();
519+ Structure s = new StructureImpl ();
520+ s .setStructureIdentifier (repeatsId .get (i ));
522521
523522 Block align = symmetry .getMultipleAlignment ().getBlock (0 );
524523
@@ -528,16 +527,17 @@ public static Structure getQuaternaryStructure(CeSymmResult symmetry) {
528527
529528 Atom [] repeat = Arrays .copyOfRange (atoms , res1 , res2 + 1 );
530529
530+ Chain newCh = new ChainImpl ();
531+ newCh .setChainID (repeat [0 ].getGroup ().getChainId ());
532+
531533 for (int k = 0 ; k < repeat .length ; k ++) {
532534 Group g = (Group ) repeat [k ].getGroup ().clone ();
533535 newCh .addGroup (g );
534536 }
535- newCh .setChainID (chainID + "" );
536- chainID ++;
537- symm .addChain (newCh );
538-
537+ s .addChain (newCh );
538+ repeats .add (s );
539539 }
540- return symm ;
540+ return repeats ;
541541 }
542542
543543 /**
@@ -594,20 +594,15 @@ public static MultipleAlignment toRepeatsAlignment(CeSymmResult result)
594594 MultipleAlignment msa = result .getMultipleAlignment ();
595595 MultipleAlignmentEnsemble newEnsemble = msa .getEnsemble ().clone ();
596596
597- // Modify atom arrays to include the repeat atoms only
598- List <Atom []> atomArrays = new ArrayList <Atom []>();
599- Structure divided = SymmetryTools .getQuaternaryStructure (result );
597+ List <Structure > repSt = SymmetryTools .divideStructure (result );
600598
601599 MultipleAlignment repeats = newEnsemble .getMultipleAlignment (0 );
602600 Block block = repeats .getBlock (0 );
601+ List <Atom []> atomArrays = new ArrayList <Atom []>();
603602
604- for (int i = 0 ; i < result .getMultipleAlignment ().size (); i ++) {
605- Structure newStr = new StructureImpl ();
606- Chain newCh = divided .getChain (i );
607- newStr .addChain (newCh );
608- Atom [] repeat = StructureTools .getRepresentativeAtomArray (newCh );
609- atomArrays .add (repeat );
610- }
603+ for (Structure s : repSt )
604+ atomArrays .add (StructureTools .getRepresentativeAtomArray (s ));
605+
611606 newEnsemble .setAtomArrays (atomArrays );
612607
613608 for (int su = 0 ; su < block .size (); su ++) {
@@ -752,8 +747,7 @@ public static QuatSymmetryResults getQuaternarySymmetry(CeSymmResult result)
752747 for (int str = 0 ; str < alignedCA .size (); str ++) {
753748 Atom [] array = alignedCA .get (str );
754749 List <Point3d > points = new ArrayList <Point3d >();
755- List <Integer > alignedRes = msa .getBlock (0 ).getAlignRes ()
756- .get (str );
750+ List <Integer > alignedRes = msa .getBlock (0 ).getAlignRes ().get (str );
757751 for (int pos = 0 ; pos < alignedRes .size (); pos ++) {
758752 Integer residue = alignedRes .get (pos );
759753 if (residue == null )
0 commit comments