public AFPChain invertAlignment ( AFPChain a ) { String name1 = a . getName1 ( ) ; String name2 = a . getName2 ( ) ; a . setName1 ( name2 ) ; a . setName2 ( name1 ) ; int len1 = a . getCa1Length ( ) ; a . setCa1Length ( a . getCa2Length ( ) ) ; a . setCa2Length ( len1 ) ; int beg1 = a . getAlnbeg1 ( ) ; a . setAlnbeg1 ( a . getAlnbeg2 ( ) ) ; a . setAlnbeg2 ( beg1 ) ; char [ ] alnseq1 = a . getAlnseq1 ( ) ; a . setAlnseq1 ( a . getAlnseq2 ( ) ) ; a . setAlnseq2 ( alnseq1 ) ; Matrix distab1 = a . getDisTable1 ( ) ; a . setDisTable1 ( a . getDisTable2 ( ) ) ; a . setDisTable2 ( distab1 ) ; int [ ] focusRes1 = a . getFocusRes1 ( ) ; a . setFocusRes1 ( a . getFocusRes2 ( ) ) ; a . setFocusRes2 ( focusRes1 ) ; //What are aftIndex and befIndex used for? How are they indexed? //a.getAfpAftIndex() String [ ] [ ] [ ] pdbAln = a . getPdbAln ( ) ; if ( pdbAln != null ) { for ( int block = 0 ; block < a . getBlockNum ( ) ; block ++ ) { String [ ] paln1 = pdbAln [ block ] [ 0 ] ; pdbAln [ block ] [ 0 ] = pdbAln [ block ] [ 1 ] ; pdbAln [ block ] [ 1 ] = paln1 ; } } int [ ] [ ] [ ] optAln = a . getOptAln ( ) ; if ( optAln != null ) { for ( int block = 0 ; block < a . getBlockNum ( ) ; block ++ ) { int [ ] aln1 = optAln [ block ] [ 0 ] ; optAln [ block ] [ 0 ] = optAln [ block ] [ 1 ] ; optAln [ block ] [ 1 ] = aln1 ; } } a . setOptAln ( optAln ) ; // triggers invalidate() Matrix distmat = a . getDistanceMatrix ( ) ; if ( distmat != null ) a . setDistanceMatrix ( distmat . transpose ( ) ) ; // invert the rotation matrices Matrix [ ] blockRotMat = a . getBlockRotationMatrix ( ) ; Atom [ ] shiftVec = a . getBlockShiftVector ( ) ; if ( blockRotMat != null ) { for ( int block = 0 ; block < a . getBlockNum ( ) ; block ++ ) { if ( blockRotMat [ block ] != null ) { // if y=x*A+b, then x=y*inv(A)-b*inv(A) blockRotMat [ block ] = blockRotMat [ block ] . inverse ( ) ; Calc . rotate ( shiftVec [ block ] , blockRotMat [ block ] ) ; shiftVec [ block ] = Calc . invert ( shiftVec [ block ] ) ; } } } return a ; }
Swaps the order of structures in an AFPChain