public float calculate ( HELM2Notation helm2notation , int unitType ) throws ExtinctionCoefficientException , ChemistryException { LOG . debug ( "ExtinctionCalculation is starting with the unitType: " + unitType ) ; float result = 0.0f ; List < PolymerNotation > polymerNodes = helm2notation . getListOfPolymers ( ) ; for ( PolymerNotation polymerNode : polymerNodes ) { String polymerType = polymerNode . getPolymerID ( ) . getType ( ) ; float ext = 0.0f ; ArrayList < PolymerNotation > not = new ArrayList < PolymerNotation > ( ) ; not . add ( polymerNode ) ; if ( polymerType . equals ( Monomer . NUCLIEC_ACID_POLYMER_TYPE ) ) { try { ext = calculateExtinctionFromRNA ( MethodsMonomerUtils . getListOfHandledMonomersOnlyBase ( polymerNode . getPolymerElements ( ) . getListOfElements ( ) ) ) ; } catch ( CalculationException | IOException | HELM2HandledException | NotationException e ) { throw new ExtinctionCoefficientException ( e . getMessage ( ) ) ; } if ( unitType == PEPTIDE_UNIT_TYPE ) { ext = ext * UNIT ; } } else if ( polymerType . equals ( Monomer . PEPTIDE_POLYMER_TYPE ) ) { try { ext = calculateExtinctionFromPeptide ( MethodsMonomerUtils . getListOfHandledMonomers ( polymerNode . getPolymerElements ( ) . getListOfElements ( ) ) ) ; } catch ( IOException | HELM2HandledException e ) { throw new ExtinctionCoefficientException ( e . getMessage ( ) ) ; } if ( unitType == RNA_UNIT_TYPE ) { ext = ext / UNIT ; } } result = result + ext ; } return result ; }
method to calculate the extinction coefficient for the whole HELM molecule