public static String getTrimmedNucleotideSequence ( PolymerNotation polymer ) throws RNAUtilsException , HELM2HandledException , ChemistryException { checkRNA ( polymer ) ; List < Nucleotide > list = getNucleotideList ( polymer ) ; int start = 0 ; Nucleotide na = list . get ( start ) ; while ( null == na . getBaseMonomer ( ) ) { start ++ ; na = list . get ( start ) ; } int end = list . size ( ) - 1 ; na = list . get ( end ) ; while ( null == na . getBaseMonomer ( ) ) { end -- ; na = list . get ( end ) ; } StringBuffer sb = new StringBuffer ( ) ; for ( int i = start ; i <= end ; i ++ ) { sb . append ( list . get ( i ) . getNaturalAnalog ( ) ) ; } return sb . toString ( ) ; }
method to get the trimmed nucleotide sequence