public static String getNucleotideSequence ( PolymerNotation polymer ) throws NotationException , RNAUtilsException , HELM2HandledException , NucleotideLoadingException , ChemistryException { List < Nucleotide > nucleotides = getNucleotideList ( polymer ) ; StringBuffer sb = new StringBuffer ( ) ; int count = 0 ; Map < String , String > reverseNucMap = NucleotideFactory . getInstance ( ) . getReverseNucleotideTemplateMap ( ) ; for ( Nucleotide nuc : nucleotides ) { String nucleotide = nuc . getNotation ( ) ; String nucleoside = nuc . getNucleosideNotation ( ) ; String linker = nuc . getLinkerNotation ( ) ; // it is ok for the first nucleotide not to have a nucleoside if ( count == 0 && nucleoside . length ( ) == 0 ) { sb . append ( nuc . getPhosphateMonomer ( ) . getAlternateId ( ) ) ; count ++ ; continue ; } // it is ok for the last nucleotide not to have a linker if ( count == nucleotides . size ( ) - 1 && linker . length ( ) == 0 ) { nucleotide = nucleotide + Monomer . ID_P ; } if ( reverseNucMap . containsKey ( nucleotide ) ) { sb . append ( reverseNucMap . get ( nucleotide ) ) ; } else { throw new NotationException ( "Unknown nucleotide found for " + nucleotide + " : missing nucleotide template" ) ; } count ++ ; } return sb . toString ( ) ; }
method to get the nucleotide sequence for the polymer