private static float calculateExtinctionFromRNA ( List < Monomer > monomers ) throws CalculationException , IOException { LOG . debug ( "ExtinctionCalculation of RNA" ) ; float resultSingle = 0.0f ; float resultDi = 0.0f ; String previous = "" ; if ( monomers . size ( ) == 0 ) { throw new CalculationException ( "Input sequence cannot be null" ) ; } else { if ( monomers . size ( ) == 1 ) { if ( monoNucleotideMap . containsKey ( monomers . get ( 0 ) . getNaturalAnalog ( ) ) ) { return monoNucleotideMap . get ( monomers . get ( 0 ) . getNaturalAnalog ( ) ) . floatValue ( ) ; } else { throw new CalculationException ( "Unknown nucleotide found" ) ; } } for ( int i = 0 ; i < monomers . size ( ) ; i ++ ) { if ( i > 0 && i < monomers . size ( ) - 1 ) { if ( monoNucleotideMap . containsKey ( monomers . get ( i ) . getNaturalAnalog ( ) ) ) { Float value = monoNucleotideMap . get ( monomers . get ( i ) . getNaturalAnalog ( ) ) . floatValue ( ) ; resultSingle += ( value . floatValue ( ) * 1.0 ) ; } } if ( previous != "" ) { if ( diNucleotideMap . containsKey ( previous + monomers . get ( i ) . getNaturalAnalog ( ) ) ) { Float value = diNucleotideMap . get ( previous + monomers . get ( i ) . getNaturalAnalog ( ) ) . floatValue ( ) ; resultDi += ( value . floatValue ( ) * 1.0 ) ; } } previous = monomers . get ( i ) . getNaturalAnalog ( ) ; } } resultSingle = BigDecimal . valueOf ( resultSingle ) . floatValue ( ) ; resultDi = BigDecimal . valueOf ( resultDi ) . floatValue ( ) ; return 2 * resultDi - resultSingle ; }
method to calculate the extinction coefficient for rna