3030import javax .vecmath .Point3d ;
3131
3232import org .biojava .nbio .structure .Atom ;
33+ import org .biojava .nbio .structure .Calc ;
3334import org .biojava .nbio .structure .Chain ;
3435import org .biojava .nbio .structure .ChainImpl ;
3536import org .biojava .nbio .structure .Group ;
@@ -602,7 +603,7 @@ public static MultipleAlignment toRepeatsAlignment(CeSymmResult result)
602603
603604 for (Structure s : repSt )
604605 atomArrays .add (StructureTools .getRepresentativeAtomArray (s ));
605-
606+
606607 newEnsemble .setAtomArrays (atomArrays );
607608
608609 for (int su = 0 ; su < block .size (); su ++) {
@@ -689,6 +690,7 @@ public static MultipleAlignment fromAFP(AFPChain symm, Atom[] atoms)
689690 * error allowed in the axis comparison
690691 * @return true if equivalent, false otherwise
691692 */
693+ @ Deprecated
692694 public static boolean equivalentAxes (Matrix4d axis1 , Matrix4d axis2 ,
693695 double epsilon ) {
694696
@@ -795,6 +797,7 @@ else if (!corePos.contains(pos))
795797 * the symmetry alignment
796798 * @return true if the alignment is refined
797799 */
800+ @ Deprecated
798801 public static boolean isRefined (MultipleAlignment symm ) {
799802
800803 if (symm .getBlocks ().size () > 1 ) {
@@ -834,6 +837,7 @@ public static boolean isRefined(MultipleAlignment symm) {
834837 * @return
835838 * @throws StructureException
836839 */
840+ @ Deprecated
837841 public static boolean isSignificant (MultipleAlignment msa ,
838842 double symmetryThreshold ) throws StructureException {
839843
@@ -892,36 +896,42 @@ public static List<Group> getGroups(Atom[] rAtoms) {
892896 * SymmetryAxes object. It will be modified.
893897 * @param msa
894898 * MultipleAlignment. It will be modified.
895- * @param atoms
896- * Atom array of the structure
897899 */
898900 public static void updateSymmetryTransformation (SymmetryAxes axes ,
899- MultipleAlignment msa , Atom [] atoms ) throws StructureException {
901+ MultipleAlignment msa ) throws StructureException {
900902
901903 List <List <Integer >> block = msa .getBlocks ().get (0 ).getAlignRes ();
902904 int length = block .get (0 ).size ();
905+ Atom [] atoms = StructureTools .cloneAtomArray (msa .getEnsemble ()
906+ .getAtomArrays ().get (0 ));
903907
904908 if (axes != null ) {
905- for (int t = 0 ; t < axes .getElementaryAxes (). size (); t ++) {
909+ for (int level = 0 ; level < axes .getNumLevels (); level ++) {
906910
907- Matrix4d axis = axes .getElementaryAxes ().get (t );
908- List <Integer > chain1 = axes .getRepeatRelation (t ).get (0 );
909- List <Integer > chain2 = axes .getRepeatRelation (t ).get (1 );
910-
911- // Calculate the aligned atom arrays
911+ // Calculate the aligned atom arrays to superimpose
912912 List <Atom > list1 = new ArrayList <Atom >();
913913 List <Atom > list2 = new ArrayList <Atom >();
914914
915- for (int pair = 0 ; pair < chain1 . size (); pair ++ ) {
916- int p1 = chain1 . get ( pair );
917- int p2 = chain2 . get ( pair );
915+ for (int firstRepeat : axes . getFirstRepeats ( level ) ) {
916+
917+ Matrix4d transform = axes . getRepeatTransform ( firstRepeat );
918918
919- for (int k = 0 ; k < length ; k ++) {
920- Integer pos1 = block .get (p1 ).get (k );
921- Integer pos2 = block .get (p2 ).get (k );
922- if (pos1 != null && pos2 != null ) {
923- list1 .add (atoms [pos1 ]);
924- list2 .add (atoms [pos2 ]);
919+ List <List <Integer >> relation = axes .getRepeatRelation (
920+ level , firstRepeat );
921+
922+ for (int index = 0 ; index < relation .get (0 ).size (); index ++) {
923+ int p1 = relation .get (0 ).get (index );
924+ int p2 = relation .get (1 ).get (index );
925+
926+ for (int k = 0 ; k < length ; k ++) {
927+ Integer pos1 = block .get (p1 ).get (k );
928+ Integer pos2 = block .get (p2 ).get (k );
929+ if (pos1 != null && pos2 != null ) {
930+ Calc .transform (atoms [pos1 ], transform );
931+ Calc .transform (atoms [pos2 ], transform );
932+ list1 .add (atoms [pos1 ]);
933+ list2 .add (atoms [pos2 ]);
934+ }
925935 }
926936 }
927937 }
@@ -932,8 +942,8 @@ public static void updateSymmetryTransformation(SymmetryAxes axes,
932942 // Calculate the new transformation information
933943 if (arr1 .length > 0 && arr2 .length > 0 ) {
934944 SVDSuperimposer svd = new SVDSuperimposer (arr1 , arr2 );
935- axis = svd .getTransformation ();
936- axes .updateAxis (t , axis );
945+ Matrix4d axis = svd .getTransformation ();
946+ axes .updateAxis (level , axis );
937947 }
938948
939949 // Get the transformations from the SymmetryAxes
0 commit comments