public static String toTransformMatrices ( MultipleAlignment alignment ) { StringBuffer txt = new StringBuffer ( ) ; for ( int bs = 0 ; bs < alignment . getBlockSets ( ) . size ( ) ; bs ++ ) { List < Matrix4d > btransforms = alignment . getBlockSet ( bs ) . getTransformations ( ) ; if ( btransforms == null || btransforms . size ( ) < 1 ) continue ; if ( alignment . getBlockSets ( ) . size ( ) > 1 ) { txt . append ( "Operations for block " ) ; txt . append ( bs + 1 ) ; txt . append ( "\n" ) ; } for ( int str = 0 ; str < alignment . size ( ) ; str ++ ) { String origString = "ref" ; txt . append ( String . format ( " X" + ( str + 1 ) + " = (%9.6f)*X" + origString + " + (%9.6f)*Y" + origString + " + (%9.6f)*Z" + origString + " + (%12.6f)" , btransforms . get ( str ) . getElement ( 0 , 0 ) , btransforms . get ( str ) . getElement ( 0 , 1 ) , btransforms . get ( str ) . getElement ( 0 , 2 ) , btransforms . get ( str ) . getElement ( 0 , 3 ) ) ) ; txt . append ( "\n" ) ; txt . append ( String . format ( " Y" + ( str + 1 ) + " = (%9.6f)*X" + origString + " + (%9.6f)*Y" + origString + " + (%9.6f)*Z" + origString + " + (%12.6f)" , btransforms . get ( str ) . getElement ( 1 , 0 ) , btransforms . get ( str ) . getElement ( 1 , 1 ) , btransforms . get ( str ) . getElement ( 1 , 2 ) , btransforms . get ( str ) . getElement ( 1 , 3 ) ) ) ; txt . append ( "\n" ) ; txt . append ( String . format ( " Z" + ( str + 1 ) + " = (%9.6f)*X" + origString + " + (%9.6f)*Y" + origString + " + (%9.6f)*Z" + origString + " + (%12.6f)" , btransforms . get ( str ) . getElement ( 2 , 0 ) , btransforms . get ( str ) . getElement ( 2 , 1 ) , btransforms . get ( str ) . getElement ( 2 , 2 ) , btransforms . get ( str ) . getElement ( 2 , 3 ) ) ) ; txt . append ( "\n\n" ) ; } } return txt . toString ( ) ; }
Converts the transformation Matrices of the alignment into a String output .