public static AFPChain replaceOptAln ( int [ ] [ ] [ ] newAlgn , AFPChain afpChain , Atom [ ] ca1 , Atom [ ] ca2 ) throws StructureException { //The order is the number of groups in the newAlgn int order = newAlgn . length ; //Calculate the alignment length from all the subunits lengths int [ ] optLens = new int [ order ] ; for ( int s = 0 ; s < order ; s ++ ) { optLens [ s ] = newAlgn [ s ] [ 0 ] . length ; } int optLength = 0 ; for ( int s = 0 ; s < order ; s ++ ) { optLength += optLens [ s ] ; } //Create a copy of the original AFPChain and set everything needed for the structure update AFPChain copyAFP = ( AFPChain ) afpChain . clone ( ) ; //Set the new parameters of the optimal alignment copyAFP . setOptLength ( optLength ) ; copyAFP . setOptLen ( optLens ) ; copyAFP . setOptAln ( newAlgn ) ; //Set the block information of the new alignment copyAFP . setBlockNum ( order ) ; copyAFP . setBlockSize ( optLens ) ; copyAFP . setBlockResList ( newAlgn ) ; copyAFP . setBlockResSize ( optLens ) ; copyAFP . setBlockGap ( calculateBlockGap ( newAlgn ) ) ; //Recalculate properties: superposition, tm-score, etc Atom [ ] ca2clone = StructureTools . cloneAtomArray ( ca2 ) ; // don't modify ca2 positions AlignmentTools . updateSuperposition ( copyAFP , ca1 , ca2clone ) ; //It re-does the sequence alignment strings from the OptAlgn information only copyAFP . setAlnsymb ( null ) ; AFPAlignmentDisplay . getAlign ( copyAFP , ca1 , ca2clone ) ; return copyAFP ; }
It replaces an optimal alignment of an AFPChain and calculates all the new alignment scores and variables .