@ Override public AFPChain align ( Atom [ ] ca1 , Atom [ ] ca2 , Object param ) throws StructureException { if ( ! ( param instanceof CeParameters ) ) throw new IllegalArgumentException ( "CE algorithm needs an object of call CeParameters as argument." ) ; params = ( CeParameters ) param ; // we don't want to rotate input atoms, do we? ca2clone = new Atom [ ca2 . length ] ; int pos = 0 ; for ( Atom a : ca2 ) { Group g = ( Group ) a . getGroup ( ) . clone ( ) ; // works because each group has only a CA atom ca2clone [ pos ] = g . getAtom ( a . getName ( ) ) ; pos ++ ; } calculator = new CECalculator ( params ) ; //Build alignment ca1 to ca2-ca2 AFPChain afpChain = new AFPChain ( algorithmName ) ; afpChain = calculator . extractFragments ( afpChain , ca1 , ca2clone ) ; calculator . traceFragmentMatrix ( afpChain , ca1 , ca2clone ) ; calculator . nextStep ( afpChain , ca1 , ca2clone ) ; afpChain . setAlgorithmName ( getAlgorithmName ( ) ) ; afpChain . setVersion ( version ) ; // Try to guess names if ( ca1 . length != 0 && ca1 [ 0 ] . getGroup ( ) . getChain ( ) != null && ca1 [ 0 ] . getGroup ( ) . getChain ( ) . getStructure ( ) != null ) afpChain . setName1 ( ca1 [ 0 ] . getGroup ( ) . getChain ( ) . getStructure ( ) . getName ( ) ) ; if ( ca2 . length != 0 && ca2 [ 0 ] . getGroup ( ) . getChain ( ) != null && ca2 [ 0 ] . getGroup ( ) . getChain ( ) . getStructure ( ) != null ) afpChain . setName2 ( ca2 [ 0 ] . getGroup ( ) . getChain ( ) . getStructure ( ) . getName ( ) ) ; if ( afpChain . getNrEQR ( ) == 0 ) return afpChain ; // Set the distance matrix int winSize = params . getWinSize ( ) ; int winSizeComb1 = ( winSize - 1 ) * ( winSize - 2 ) / 2 ; double [ ] [ ] m = calculator . initSumOfDistances ( ca1 . length , ca2 . length , winSize , winSizeComb1 , ca1 , ca2clone ) ; afpChain . setDistanceMatrix ( new Matrix ( m ) ) ; afpChain . setSequentialAlignment ( true ) ; return afpChain ; }
Align ca2 onto ca1 .