@ Override public DescriptorValue calculate ( IAtomContainer container ) { if ( taeParams == null ) return getDummyDescriptorValue ( new CDKException ( "TAE parameters were not initialized" ) ) ; if ( ! ( container instanceof IBioPolymer ) ) return getDummyDescriptorValue ( new CDKException ( "The molecule should be of type IBioPolymer" ) ) ; IBioPolymer peptide = ( IBioPolymer ) container ; // I assume that we get single letter names //Collection aas = peptide.getMonomerNames(); double [ ] desc = new double [ ndesc ] ; for ( int i = 0 ; i < ndesc ; i ++ ) desc [ i ] = 0.0 ; List < IMonomer > monomers = getMonomers ( peptide ) ; for ( Iterator < IMonomer > iterator = monomers . iterator ( ) ; iterator . hasNext ( ) ; ) { IMonomer monomer = iterator . next ( ) ; String o = monomer . getMonomerName ( ) ; if ( o . length ( ) == 0 ) continue ; String olc = String . valueOf ( o . toLowerCase ( ) . charAt ( 0 ) ) ; String tlc = ( String ) nametrans . get ( olc ) ; logger . debug ( "Converted " + olc + " to " + tlc ) ; // get the params for this AA Double [ ] params = ( Double [ ] ) taeParams . get ( tlc ) ; for ( int i = 0 ; i < ndesc ; i ++ ) desc [ i ] += params [ i ] ; } DoubleArrayResult retval = new DoubleArrayResult ( ndesc ) ; for ( int i = 0 ; i < ndesc ; i ++ ) retval . ( desc [ i ] ) ; return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , retval , getDescriptorNames ( ) ) ; }
Calculates the 147 TAE descriptors for amino acids .