public static int [ ] btopDecode ( String alignment , Alphabet alphabet ) { Matcher matcher = btopPattern . matcher ( alignment ) ; IntArrayList mutations = new IntArrayList ( ) ; int sPosition = 0 ; while ( matcher . find ( ) ) { String g = matcher . group ( ) ; if ( isPositiveInteger ( g ) ) sPosition += Integer . parseInt ( g ) ; else if ( g . charAt ( 0 ) == ' ' ) { mutations . add ( createDeletion ( sPosition , alphabet . symbolToCodeWithException ( g . charAt ( 1 ) ) ) ) ; ++ sPosition ; } else if ( g . charAt ( 1 ) == ' ' ) mutations . add ( createInsertion ( sPosition , alphabet . symbolToCodeWithException ( g . charAt ( 0 ) ) ) ) ; else { mutations . add ( createSubstitution ( sPosition , alphabet . symbolToCodeWithException ( g . charAt ( 1 ) ) , alphabet . symbolToCodeWithException ( g . charAt ( 0 ) ) ) ) ; ++ sPosition ; } } return mutations . toArray ( ) ; }
Decodes btop - encoded mutations .