From: <mig...@us...> - 2006-11-29 09:33:45
|
Revision: 7378 http://svn.sourceforge.net/cdk/?rev=7378&view=rev Author: miguelrojasch Date: 2006-11-29 01:33:41 -0800 (Wed, 29 Nov 2006) Log Message: ----------- calculation of IP for conjugated pi systems. Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/bond/IPBondDescriptor.java trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/bond/IPBondDescriptorTest.java Added Paths: ----------- trunk/cdk/src/data/arff/ConjugatedPiSys.arff Added: trunk/cdk/src/data/arff/ConjugatedPiSys.arff =================================================================== --- trunk/cdk/src/data/arff/ConjugatedPiSys.arff (rev 0) +++ trunk/cdk/src/data/arff/ConjugatedPiSys.arff 2006-11-29 09:33:41 UTC (rev 7378) @@ -0,0 +1,166 @@ +@relation ConjugatedPiSys +@attribute SE_1 numeric +@attribute EE_1 numeric +@attribute RES_c2 numeric +@attribute class {05_0,05_1,05_2,05_3,05_4,05_5,05_6,05_7,05_8,05_9,06_0,06_1,06_2,06_3,06_4,06_5,06_6,06_7,06_8,06_9,07_0,07_1,07_2,07_3,07_4,07_5,07_6,07_7,07_8,07_9,08_0,08_1,08_2,08_3,08_4,08_5,08_6,08_7,08_8,08_9,09_0,09_1,09_2,09_3,09_4,09_5,09_6,09_7,09_8,09_9,10_0,10_1,10_2,10_3,10_4,10_5,10_6,10_7,10_8,10_9,11_0,11_1,11_2,11_3,11_4,11_5,11_6,11_7,11_8,11_9,12_0,12_1,12_2,12_3,12_4,12_5,12_6,12_7,12_8,12_9,13_0,13_1,13_2,13_3,13_4,13_5,13_6,13_7,13_8,13_9,14_0,14_1,14_2,14_3,14_4,14_5,14_6,14_7,14_8,14_9} +@data + 0.014940764240207564 , 0.3923088046643676 , 8.663224132551656 ,09_5, + 0.01493735531850792 , 0.4165703452233212 , 8.219737895231422 ,08_8, + 0.014829986142253504 , 0.554067332829014 , 8.017534309250385 ,09_0, + 0.005081779064925242 , 0.24732492484337135 , 10.055313149835085 ,08_6, + 0.015007001741086315 , 2.2125054046928305 , 8.090649041299988 ,08_4, + 0.004810555975427776 , 0.37105195126604507 , 9.90504995908529 ,08_6, + 0.0029557115624993906 , 0.5450879723650338 , 8.281291946879396 ,07_4, + 0.002768031694085107 , 0.31593169685429767 , 8.11751678571257 ,08_3, + 0.0 , 2.4146571425282066 , 8.682722488070882 ,12_3, + 0.003954744016425375 , 0.315717793908928 , 8.091964697625295 ,08_1, + 0.0 , 0.21840246725631757 , 8.931018974871005 ,08_9, + 0.015290833382203536 , 1.8649125995085252 , 8.104599942247052 ,08_6, + 0.01219935613516415 , 1.2197406316758972 , 8.965322657040122 ,08_7, + 0.015339556966881536 , 1.1226485168982803 , 8.115026036224224 ,08_6, + 0.014854654089370894 , 0.4320654786828737 , 8.057971614929226 ,08_5, + 0.015058695727311812 , 1.529439292119374 , 8.259505324519157 ,08_5, + 0.0028852341614840054 , 0.4947974730583426 , 8.361135296644248 ,07_5, + 0.007402861323856244 , 1.0174351753951334 , 8.090638720621323 ,08_6, + 0.00875008447035039 , 0.5536072028185541 , 8.148423610896895 ,08_2, + 0.004701802169854457 , 0.3288047882762199 , 8.91737607905812 ,09_1, + 0.014853809989152603 , 0.42800287205538723 , 8.050939414804102 ,08_6, + 0.015160311066177712 , 1.6716074751355186 , 8.130347053659776 ,08_2, + 0.01530624959939325 , 1.8660007325024093 , 8.11226520693427 ,08_5, + 0.004827880334585895 , 0.3710489655093479 , 9.903743056819234 ,08_8, + 0.0048111299501078 , 0.3710517106766638 , 9.9050083511714 ,08_7, + 0.004762038235152711 , 0.12245409106921257 , 9.244282743221191 ,09_1, + 0.004762038235152711 , 0.12245409106921257 , 9.244282743221191 ,09_0, + 0.0148833331741144 , 0.179399076717754 , 8.129403650085948 ,07_8, + 0.003411943270810363 , 0.31994748986600785 , 8.09962398700958 ,08_4, + 0.004722254084798743 , 0.1455085244758897 , 8.568493701112702 ,07_2, + 0.01714536062207937 , 1.1580416851738955 , 8.975001253431007 ,08_5, + 0.017145360592131672 , 1.158041492642082 , 8.974980483278092 ,08_6, + 0.0 , 0.21840418929455352 , 8.931693678059903 ,08_8, + 0.014883322908775596 , 0.17844716758349924 , 8.107347630962444 ,07_9, + 0.007740994255326014 , 1.4847655045001886 , 8.163759529303181 ,07_8, + 0.004701802169854457 , 0.3288047882762199 , 8.91737607905812 ,09_0, + 0.014853809989152603 , 0.42800287205538723 , 8.050939414804102 ,08_5, + 0.004115531557394376 , 0.33079345459104526 , 8.25314883449386 ,08_3, + 0.014854654089370894 , 0.4377405324418027 , 8.057971614929226 ,08_5, + 0.0 , 0.0 , 10.086794636249065 ,08_3, + 0.0 , 0.0 , 10.162595966321579 ,08_1, + 0.0 , 0.0 , 10.208076773054351 ,08_0, + 0.015382746163114717 , 0.30934729147324 , 8.158035414944447 ,08_1, + 0.015322584153021623 , 1.1117170652236268 , 8.113576479472746 ,08_5, + 0.007740994255326013 , 1.4847655045001886 , 8.163759529303181 ,08_1, + 0.002754989883760565 , 0.2429687905851681 , 8.117955056139339 ,08_7, + 0.007279750397548967 , 0.8486691673999974 , 8.287497531356555 ,08_0, + 0.004701802169854457 , 0.3288047882762199 , 8.91737607905812 ,08_5, + 0.014883312711178587 , 0.20486622911643507 , 8.085075552787531 ,08_4, + 0.00914232187843061 , 0.5452959070404598 , 8.126492579349517 ,08_2, + 0.015444406426181256 , 1.8121991005668834 , 8.134684565890254 ,08_2, + 0.01714535323354188 , 1.1579439062806212 , 8.974348892446386 ,08_6, + 0.014854665065881812 , 0.43206307970691454 , 8.058558345048308 ,08_4, + 0.007740994255326013 , 1.479227383933325 , 8.163759529303181 ,08_0, + 0.014907374915071993 , 0.6185022684018435 , 8.111975093980446 ,08_2, + 0.0035590259346010354 , 2.235086286614217 , 8.260166852520575 ,08_5, + 0.014883312711178587 , 0.20486622911643507 , 8.085075552787531 ,08_3, + 0.004719541572263376 , 0.33792708289708573 , 8.964610606218322 ,08_5, + 0.007402861323856244 , 1.0119347956749267 , 8.090638720621321 ,08_4, + 0.007402861323856244 , 1.0119347956749267 , 8.090638720621321 ,08_3, + 0.0015798081767423161 , 0.19767955271273477 , 8.428211024245023 ,07_4, + 0.004719556683819548 , 0.32888352702282797 , 8.965871594407568 ,08_4, + 0.005015083264877905 , 0.37098797263920624 , 9.887983059581163 ,08_9, + 0.015322008849920575 , 1.297804422552269 , 8.113531910834055 ,08_9, + 0.01603060543426945 , 0.936844235811965 , 8.192700130696496 ,08_0, + 0.0036030561526609302 , 0.33053773908287554 , 8.421970306007962 ,08_5, + 0.00899578091432903 , 0.5453278210522543 , 8.134011122375373 ,07_7, + 0.0 , 0.0 , 10.001048357465299 ,09_5, + 0.014992590531447308 , 2.2897526471947245 , 8.057235631757214 ,07_9, + 0.016028489150634585 , 0.9076255183843344 , 8.17402437336093 ,08_6, + 0.0 , 0.7023066694892027 , 8.29223618724089 ,09_0, + 0.0 , 1.8544493711035002 , 8.292236187240892 ,08_3, + 0.0056412785738301115 , 0.9608747057464908 , 8.15713270526183 ,08_1, + 0.014855504397629168 , 0.43203709872740853 , 8.064996310486265 ,08_4, + 0.014938177854068058 , 0.41666253952770715 , 8.22763780749311 ,08_5, + 0.0 , 2.7343023733572127 , 8.142897040654756 ,09_0, + 0.015138258879246164 , 1.9201180244217895 , 8.064892836964999 ,08_8, + 0.009271110031163507 , 0.26223817697504354 , 8.33429002414252 ,08_4, + 0.0027645259423579537 , 0.3116188478486648 , 8.117602536809315 ,08_0, + 0.0028088997834376044 , 0.12729298538754893 , 8.152026261150054 ,06_2, + 0.014856360894710978 , 0.5546195781243706 , 8.072012600267893 ,08_4, + 0.015499549896810546 , 1.2986112415596565 , 8.130217155770872 ,08_4, + 0.015498426110881503 , 1.2985788250223083 , 8.130131156256875 ,08_3, + 0.017166387388757268 , 1.4239771489352575 , 8.823965880170197 ,09_0, + 0.0027693434293385223 , 0.31161867854869374 , 8.117487947836679 ,08_2, + 0.014883334442587203 , 0.11395257172876803 , 8.11884997317532 ,07_7, + 0.006269555256794201 , 0.37614724480967027 , 8.157700681652546 ,08_4, + 0.003411943270810363 , 0.31994748986600785 , 8.09962398700958 ,08_6, + 0.014854665110623371 , 0.43206299917004054 , 8.058577952221146 ,08_4, + 0.01521252507179916 , 1.728105898579591 , 8.299932928618974 ,08_1, + 0.014878569378766427 , 0.3839865536644945 , 8.09163955348604 ,08_0, + 0.0017264767516819819 , 0.6204929940917557 , 8.278932114246807 ,07_3, + 0.003410198264948922 , 0.3199473624925603 , 8.099666408631947 ,08_3, + 0.016031826100452454 , 1.5219959844041517 , 8.253359986715331 ,08_1, + 0.00879694134126179 , 0.5621366238594518 , 8.145957373315781 ,08_2, + 0.004702387698771252 , 0.33797263506211744 , 8.925091603864411 ,08_9, + 0.004702387698771252 , 0.33797263506211744 , 8.925091603864411 ,08_8, + 0.008798552884821094 , 0.4326558937342989 , 8.179721766992113 ,08_0, + 0.0020327234474595787 , 0.6184331753042638 , 8.26482129855025 ,07_8, + 0.0023252144675955685 , 0.31177764718021245 , 8.213490611814292 ,07_8, + 0.0023172108142900313 , 0.12608190091205088 , 8.161423311363068 ,08_4, + 0.0048107923965550175 , 0.18552453696661075 , 9.853716393468511 ,09_2, + 0.0 , 0.0 , 9.806593949687294 ,10_1, + 0.006270406775269552 , 0.5030605020845975 , 8.191377739764798 ,08_1, + 0.014878558337457866 , 0.38398689235595407 , 8.091051165917133 ,08_1, + 0.004998609610914084 , 0.18549405852733036 , 9.84578630742233 ,09_5, + 0.016064605957684 , 0.285524548462061 , 8.253359986715331 ,07_8, + 0.014853809989152603 , 0.42800287205538723 , 8.050939414804102 ,08_6, + 0.015145444603298579 , 1.853143173829958 , 8.096935735757219 ,08_6, + 0.003953092510611552 , 0.3157414581754286 , 8.08434568226478 ,08_2, + 0.003953092510611552 , 0.3157414581754286 , 8.08434568226478 ,08_2, + 0.016412959562885035 , 0.4901253306136075 , 8.266223924808656 ,08_8, + 0.00472226931573726 , 0.31647397399534216 , 8.987296027422252 ,07_8, + 0.0021602241997929917 , 0.47709837354322365 , 8.964206453791498 ,08_4, + 0.0021602241997929917 , 0.47709837354322365 , 8.964206453791498 ,08_4, + 0.002754989883760563 , 0.24570320409171054 , 8.117955056139339 ,08_5, + 0.0028088997834376044 , 0.12664450612454423 , 8.152026261150054 ,08_2, + 0.0034868980347140402 , 1.4882180467196815 , 8.260650810833061 ,08_2, + 0.014854665110623371 , 0.4320629981237937 , 8.05857820643738 ,08_4, + 0.003953092510611551 , 0.31157753311020964 , 8.08434568226478 ,08_4, + 0.003358556039509073 , 0.31572850156913507 , 8.100974756030112 ,08_2, + 0.008701239746625372 , 0.5453936812185022 , 8.150970047967691 ,08_2, + 0.0056412785738301115 , 0.9608747057464908 , 8.15713270526183 ,07_8, + 0.014856360894710978 , 0.5531515404151286 , 8.072012600267893 ,08_4, + 0.003953092510611552 , 0.3157414581754286 , 8.08434568226478 ,08_1, + 0.0 , 0.0 , 9.935204264197484 ,08_6, + 0.0 , 0.0 , 10.098286246932897 ,09_0, + 0.008192164379208083 , 1.1956071460823903 , 9.006232948085795 ,08_2, + 0.002864759364535612 , 0.3157173053754056 , 8.115063646002053 ,08_1, + 0.003954722880094968 , 0.3199656425698248 , 8.091377964232372 ,08_1, + 0.01623266613839807 , 0.4317170334501536 , 8.294417398859094 ,07_5, + 0.0 , 0.21837376728861146 , 8.92310570589974 ,09_0, + 0.0 , 0.13717035544864206 , 9.252514264631637 ,07_6, + 0.002868165191200149 , 0.3157173726599946 , 8.114980820175134 ,08_2, + 0.0027680315144045986 , 0.3157151528346904 , 8.117516789969823 ,08_2, + 0.007239960321331761 , 0.8331422954173255 , 8.23077366796273 ,07_9, + 0.0 , 4.023173074217438 , 8.474363868018191 ,06_3, + 0.0021554782325906123 , 0.4290633369360197 , 8.82614614139868 ,08_4, + 0.004685279646561477 , 0.07919165903144637 , 8.883991847729808 ,09_5, + 0.004762038235152711 , 0.12245409106921257 , 9.244282743221191 ,09_6, + 0.01714536062207937 , 1.1580416898728707 , 8.97500152082809 ,08_5, + 0.002942589466670152 , 0.4680503777520835 , 9.003726439312132 ,08_1, + 0.012218728464613504 , 1.3337178930238611 , 9.004443259056055 ,08_2, + 0.012218728464613504 , 1.3337178930238611 , 9.004443259056055 ,08_2, + 0.008220895565894396 , 1.359699006192413 , 9.045355310484048 ,07_8, + 0.007380513295483913 , 0.30313171940909966 , 8.235553381754245 ,07_7, + 0.00215941736860825 , 0.4771192126908712 , 8.972796577308493 ,08_5, + 0.0010002728915656785 , 0.31172957408277735 , 8.15051119732913 ,07_9, + 0.008749996300619973 , 0.5536071977864606 , 8.148427996547284 ,08_1, + 0.008750084831717886 , 0.5621201032172475 , 8.148423593079297 ,08_1, + 0.014883312711178587 , 0.20486622911643507 , 8.085075552787531 ,08_3, + 0.0 , 0.08129077120492371 , 8.77028770320369 ,08_5, + 0.007459789154085073 , 0.960708329305776 , 8.157143707936054 ,08_3, + 0.007459789154085073 , 0.960708329305776 , 8.157143707936054 ,08_0, + 0.015007001741086315 , 1.8604110220007675 , 8.090649041299987 ,08_4, + 0.017144783456338807 , 1.157985000412328 , 8.963211710512752 ,08_7, + 0.014877710129483477 , 0.43215284635528717 , 8.084020430807533 ,08_2, + 0.01518538496502686 , 1.748900623662117 , 8.108000912341883 ,08_4, + 0.011824659560284353 , 1.2200302096250215 , 8.973714366019951 ,08_6, + Modified: trunk/cdk/src/org/openscience/cdk/qsar/descriptors/bond/IPBondDescriptor.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/qsar/descriptors/bond/IPBondDescriptor.java 2006-11-29 04:41:16 UTC (rev 7377) +++ trunk/cdk/src/org/openscience/cdk/qsar/descriptors/bond/IPBondDescriptor.java 2006-11-29 09:33:41 UTC (rev 7378) @@ -23,8 +23,11 @@ import java.util.HashMap; import java.util.Iterator; +import org.openscience.cdk.AtomContainerSet; import org.openscience.cdk.CDKConstants; +import org.openscience.cdk.aromaticity.HueckelAromaticityDetector; import org.openscience.cdk.exception.CDKException; +import org.openscience.cdk.graph.invariant.ConjugatedPiSystemsDetector; import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.interfaces.IBond; @@ -35,6 +38,7 @@ import org.openscience.cdk.qsar.DescriptorSpecification; import org.openscience.cdk.qsar.DescriptorValue; import org.openscience.cdk.qsar.IBondDescriptor; +import org.openscience.cdk.qsar.descriptors.atomic.PartialPiChargeDescriptor; import org.openscience.cdk.qsar.descriptors.atomic.PartialSigmaChargeDescriptor; import org.openscience.cdk.qsar.descriptors.atomic.SigmaElectronegativityDescriptor; import org.openscience.cdk.qsar.model.weka.J48WModel; @@ -147,12 +151,37 @@ boolean isTarget = false; Double[][] resultsH = null; String path = ""; - if(bond.getOrder() > 1 && bond.getAtom(0).getSymbol().equals("C") && - bond.getAtom(1).getSymbol().equals("C")){ + + try{ + HueckelAromaticityDetector.detectAromaticity(container,true); + } catch (Exception exc) + { + } + + if(bond.getOrder() > 1 && bond.getAtom(0).getSymbol().equals("C") && + bond.getAtom(1).getSymbol().equals("C")){ + + AtomContainerSet conjugatedPi = ConjugatedPiSystemsDetector.detect(container); + Iterator acI = conjugatedPi.atomContainers(); + boolean contained_ConjugatedPi = false; + while(acI.hasNext()){ + IAtomContainer ac = (IAtomContainer) acI.next(); + if(ac.contains(bond)){ + contained_ConjugatedPi = true; + isTarget = true; + + resultsH = calculateCojugatedPiSystWithoutHeteroDescriptor(bond, container, ac); + path = "data/arff/ConjugatedPiSys.arff"; + break; + } + } + + if(!contained_ConjugatedPi){ - resultsH = calculatePiSystWithoutHeteroDescriptor(bond, container); - path = "data/arff/Acetyl_EthylWithoutHetero.arff"; - isTarget = true; + resultsH = calculatePiSystWithoutHeteroDescriptor(bond, container); + path = "data/arff/Acetyl_EthylWithoutHetero.arff"; + isTarget = true; + } } if(isTarget){ @@ -240,6 +269,71 @@ } return results; } + /** + * Calculate the necessary descriptors for pi systems without heteroatom + * + * @param atomContainer The IAtomContainer + * @return Array with the values of the descriptors. + */ + private Double[][] calculateCojugatedPiSystWithoutHeteroDescriptor(IBond bond, IAtomContainer atomContainer, IAtomContainer conjugatedSys) { + Double[][] results = new Double[1][3]; + + results[0][0] = 0.0; + results[0][1] = 0.0; + results[0][2] = 0.0; + Iterator atomIt = conjugatedSys.atoms(); + while(atomIt.hasNext()){ + IAtom atomsss = (IAtom) atomIt.next(); + + PartialPiChargeDescriptor descriptor1 = new PartialPiChargeDescriptor(); + double result1; + try { + result1 = ((DoubleResult)descriptor1.calculate(atomsss,atomContainer).getValue()).doubleValue(); + if(result1 > results[0][0]) + results[0][0] = result1; + + SigmaElectronegativityDescriptor descriptor2 = new SigmaElectronegativityDescriptor(); + double result2 = ((DoubleResult)descriptor2.calculate(atomsss,atomContainer).getValue()).doubleValue(); + results[0][2] += result2; + + } catch (CDKException e) { + e.printStackTrace(); + } + + + } + + Iterator bondIt = conjugatedSys.bonds(); + while(bondIt.hasNext()){ + + + IBond bondsss = (IBond) bondIt.next(); + + try { + ResonancePositiveChargeDescriptor descriptor5 = new ResonancePositiveChargeDescriptor(); + DoubleArrayResult dar = ((DoubleArrayResult)descriptor5.calculate(bondsss,atomContainer).getValue()); + double result1 = dar.get(0); + double resutt2 = dar.get(1); + double result12 = (result1+resutt2); + + double resultT = 0; + if(result12 != 0) + resultT = result12/2; + + results[0][1] += resultT; + + } catch (CDKException e) { + e.printStackTrace(); + } + } + if(results[0][1] != 0) + results[0][1] = results[0][1]/conjugatedSys.getAtomCount(); + + if(results[0][2] != 0) + results[0][2] = results[0][2]/conjugatedSys.getAtomCount(); + + return results; + } /** * Gets the parameterNames attribute of the IPBondDescriptor object. * Modified: trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/bond/IPBondDescriptorTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/bond/IPBondDescriptorTest.java 2006-11-29 04:41:16 UTC (rev 7377) +++ trunk/cdk/src/org/openscience/cdk/test/qsar/descriptors/bond/IPBondDescriptorTest.java 2006-11-29 09:33:41 UTC (rev 7378) @@ -200,6 +200,27 @@ double result= ((DoubleResult)descriptor.calculate(mol.getBond(0),mol).getValue()).doubleValue(); double resultAccordingNIST = 8.98; assertEquals(resultAccordingNIST, result, 0.1); + }/** + * A unit test for JUnit with CCCCCC + * + * @throws ClassNotFoundException + * @throws CDKException + * @throws java.lang.Exception + */ + public void testIPConjugatedDescriptor1() throws ClassNotFoundException, CDKException, java.lang.Exception{ + + SmilesParser sp = new SmilesParser(); + Molecule mol = sp.parseSmiles("C=C(C=CC)C"); + + HydrogenAdder hAdder = new HydrogenAdder(); + hAdder.addExplicitHydrogensToSatisfyValency(mol); + + LonePairElectronChecker lpcheck = new LonePairElectronChecker(); + lpcheck.newSaturate(mol); + + double result= ((DoubleResult)descriptor.calculate(mol.getBond(0),mol).getValue()).doubleValue(); + double resultAccordingNIST = 8.47; + assertEquals(resultAccordingNIST, result, 0.03); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |