📄 ipbonddescriptor.java
字号:
/* $Revision: 6228 $ $Author: egonw $ $Date: 2006-05-11 18:34:42 +0200 (Thu, 11 May 2006) $
*
* Copyright (C) 2006-2007 Miguel Rojas <miguel.rojas@uni-koeln.de>
*
* Contact: cdk-devel@lists.sourceforge.net
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.openscience.cdk.qsar.descriptors.bond;
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;
import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.interfaces.IMoleculeSet;
import org.openscience.cdk.interfaces.IReaction;
import org.openscience.cdk.interfaces.IReactionSet;
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.result.DoubleArrayResult;
import org.openscience.cdk.qsar.result.DoubleResult;
import org.openscience.cdk.reaction.IReactionProcess;
import org.openscience.cdk.reaction.type.ElectronImpactPDBReaction;
/**
*
* This class returns the ionization potential of a Bond. It is
* based on a decision tree which is extracted from Weka(J48) from
* experimental values (NIST data). Up to now is
* only possible predict for double- or triple bonds and they are not belong to
* conjugated system or not adjacent to an heteroatom.
*
* <p>This descriptor uses these parameters:
* <table border="1">
* <tr>
* <td>Name</td>
* <td>Default</td>
* <td>Description</td>
* </tr>
* <tr>
* <td></td>
* <td></td>
* <td>no parameters</td>
* </tr>
* </table>
*
* @author Miguel Rojas
* @cdk.created 2006-05-26
* @cdk.module qsar
* @cdk.set qsar-descriptors
* @cdk.dictref qsar-descriptors:ionizationPotential
*/
public class IPBondDescriptor implements IBondDescriptor {
private IReactionSet reactionSet;
/**
* Constructor for the IPBondDescriptor object
*/
public IPBondDescriptor() {
}
/**
* Gets the specification attribute of the IPBondDescriptor object
*
*@return The specification value
*/
public DescriptorSpecification getSpecification() {
return new DescriptorSpecification(
"http://www.blueobelisk.org/ontologies/chemoinformatics-algorithms/#ionizationPotential",
this.getClass().getName(),
"$Id: IPBondDescriptor.java 6171 2006-5-22 19:29:58Z egonw $",
"The Chemistry Development Kit");
}
/**
* This descriptor does have any parameter.
*/
public void setParameters(Object[] params) throws CDKException {
}
/**
* Gets the parameters attribute of the IPBondDescriptor object.
*
*@return The parameters value
* @see #setParameters
*/
public Object[] getParameters() {
return null;
}
/**
* This method calculates the ionization potential of a bond.
*
*@param atomContainer Parameter is the IAtomContainer.
*@return The ionization potential
*@exception CDKException Description of the Exception
*/
public DescriptorValue calculate(IBond bond, IAtomContainer atomContainer) throws CDKException{
IAtomContainer localClone = null;
try {
localClone = (IAtomContainer) atomContainer.clone();
} catch (CloneNotSupportedException e) {
throw new CDKException("Error during clone");
}
IBond clonedBond = localClone.getBond(atomContainer.getBondNumber(bond));
String[] descriptorNames = {"DoubleResult"};
reactionSet = localClone.getBuilder().newReactionSet();
double resultD = -1.0;
boolean isTarget = false;
double[] resultsH = null;
try{
HueckelAromaticityDetector.detectAromaticity(localClone,true);
} catch (Exception exc){}
if(clonedBond.getOrder() > 1 &&
(localClone.getConnectedLonePairsCount(clonedBond.getAtom(0)) == 0) && /*not containing heteroatoms*/
(localClone.getConnectedLonePairsCount(clonedBond.getAtom(1)) == 0) &&
!clonedBond.getAtom(0).getFlag(CDKConstants.ISAROMATIC) && !clonedBond.getAtom(1).getFlag(CDKConstants.ISAROMATIC)){ /*not belonging to aromatics*/
AtomContainerSet conjugatedPi = ConjugatedPiSystemsDetector.detect(localClone);
Iterator acI = conjugatedPi.atomContainers();
boolean isConjugatedPi = false;
boolean isConjugatedPi_withHeteroatom = false;
while(acI.hasNext()){
IAtomContainer ac = (IAtomContainer) acI.next();
if(ac.contains(clonedBond)){
isConjugatedPi = true;
Iterator atoms = ac.atoms();
while(atoms.hasNext()){
IAtom atomsss = (IAtom) atoms.next();
if(localClone.getConnectedLonePairsCount(atomsss) > 0){
isConjugatedPi_withHeteroatom = true;
// resultsH = calculateCojugatedPiSystWithHeteroDescriptor(bond, container, ac);
// resultD = getPySystWithHetero(resultsH);
// resultD += 0.05;
// isTarget = true;
break;
}
}
if(!isConjugatedPi_withHeteroatom){
resultsH = calculateCojugatedPiSystDescriptor(clonedBond, localClone, ac);
resultD = getConjugatedPiSys(resultsH);
resultD += 0.05;
isTarget = true;
break;
}
}
}
if(!isConjugatedPi){
resultsH = calculatePiSystDescriptor(clonedBond, localClone);
resultD = getAcetyl_EthylWithoutHetero(resultsH);
resultD += 0.05;
isTarget = true;
}
}
if(isTarget){
/* iniziate reaction*/
IMoleculeSet setOfReactants = localClone.getBuilder().newMoleculeSet();
setOfReactants.addMolecule((IMolecule) localClone);
IReactionProcess type = new ElectronImpactPDBReaction();
bond.setFlag(CDKConstants.REACTIVE_CENTER,true);
Object[] params = {Boolean.TRUE};
type.setParameters(params);
IReactionSet pbb = type.initiate(setOfReactants, null);
Iterator it = pbb.reactions();
while(it.hasNext()){
IReaction reaction = (IReaction)it.next();
reaction.setProperty("IonizationEnergy", new Double(resultD));
reactionSet.addReaction(reaction);
}
}
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(resultD),descriptorNames);
}
/**
* tree desicion for the ConjugatedPiSys
*
* @param resultsH Array which contains the results of each descriptor
* @return the result
*/
private double getConjugatedPiSys(double[] resultsH) {
double result = 0.0;
double SE_1 = resultsH[0];
double EE_1 = resultsH[1];
double RES_c2 = resultsH[2];
if (RES_c2 <= 8.242293)
{
if (EE_1 <= 0.324173)
{
if (EE_1 <= 0.263763)
{
if (EE_1 <= 0.196384)
{
if (EE_1 <= 0.150372) { result = 06.2; /* 2.0/1.0 */}
else if (EE_1 > 0.150372) { result = 07.9; /* 3.0/1.0 */}
}
if (EE_1 > 0.196384) { result = 08.3; /* 5.0/2.0 */}
}
if (EE_1 > 0.263763)
{
if (RES_c2 <= 8.152026)
{
if (EE_1 <= 0.26488) { result = 08.7; /* 2.0 */}
else if (EE_1 > 0.26488) { result = 08.5; /* 2.0 */}
}
if (RES_c2 > 8.152026) { result = 07.7; /* 3.0/2.0 */}
}
}
if (EE_1 > 0.324173)
{
if (SE_1 <= 0.009142)
{
if (RES_c2 <= 8.152026) { result = 08.2; /* 29.0/19.0 */}
else if (RES_c2 > 8.152026)
{
if (RES_c2 <= 8.217601)
{
if (SE_1 <= 0.006519)
{
if (SE_1 <= 0.005641) { result = 07.8; /* 3.0/1.0 */}
else if (SE_1 > 0.005641) { result = 08.1; /* 2.0/1.0 */}
}
if (SE_1 > 0.006519)
{
if (EE_1 <= 1.552108) { result = 08.0; /* 5.0/1.0 */}
else if (EE_1 > 1.552108) { result = 07.8; /* 2.0/1.0 */}
}
}
if (RES_c2 > 8.217601) { result = 07.9; /* 2.0 */}
}
}
if (SE_1 > 0.009142)
{
if (RES_c2 <= 8.057972)
{
if (EE_1 <= 0.529275)
{
if (EE_1 <= 0.472268) { result = 08.6; /* 3.0/1.0 */}
else if (EE_1 > 0.472268) { result = 08.5; /* 2.0 */}
}
if (EE_1 > 0.529275) { result = 07.9; /* 2.0/1.0 */}
}
if (RES_c2 > 8.057972)
{
if (SE_1 <= 0.015444)
{
if (EE_1 <= 0.421993) { result = 08.1; /* 3.0/1.0 */}
else if (EE_1 > 0.421993)
{
if (SE_1 <= 0.015007)
{
if (SE_1 <= 0.014856) { result = 08.4; /* 7.0 */}
else if (SE_1 > 0.014856)
{
if (SE_1 <= 0.014941) { result = 08.2; /* 2.0 */}
else if (SE_1 > 0.014941) { result = 08.4; /* 2.0 */}
}
}
if (SE_1 > 0.015007)
{
if (RES_c2 <= 8.1046) { result = 08.6; /* 3.0/1.0 */}
else if (RES_c2 > 8.1046)
{
if (RES_c2 <= 8.11885) { result = 08.5; /* 4.0/2.0 */}
else if (RES_c2 > 8.11885) { result = 08.2; /* 3.0/1.0 */}
}
}
}
}
if (SE_1 > 0.015444) { result = 08.3; /* 6.0/4.0 */}
}
}
}
}
if (RES_c2 > 8.242293)
{
if (RES_c2 <= 8.568494)
{
if (EE_1 <= 0.79014)
{
if (SE_1 <= 0.016065)
{
if (EE_1 <= 0.301514) { result = 07.2; /* 3.0/2.0 */}
else if (EE_1 > 0.301514)
{
if (SE_1 <= 0.001726) { result = 07.3; /* 2.0/1.0 */}
else if (SE_1 > 0.001726) { result = 07.8; /* 6.0/2.0 */}
}
}
if (SE_1 > 0.016065) { result = 07.3; /* 3.0/2.0 */}
}
if (EE_1 > 0.79014)
{
if (SE_1 <= 0.005082) { result = 08.2; /* 2.0 */}
else if (SE_1 > 0.005082) { result = 07.5; /* 3.0/2.0 */}
}
}
if (RES_c2 > 8.568494)
{
if (SE_1 <= 0.004762)
{
if (EE_1 <= 0.324173)
{
if (EE_1 <= 0.124581) { result = 09.0; /* 4.0/3.0 */}
else if (EE_1 > 0.124581) { result = 07.5; /* 2.0/1.0 */}
}
if (EE_1 > 0.324173)
{
if (SE_1 <= 0.003414)
{
if (RES_c2 <= 8.965872) { result = 08.4; /* 3.0 */}
else if (RES_c2 > 8.965872) { result = 08.1; /* 2.0/1.0 */}
}
if (SE_1 > 0.003414)
{
if (RES_c2 <= 8.917376) { result = 09.0; /* 4.0/2.0 */}
else if (RES_c2 > 8.917376)
{
if (SE_1 <= 0.004702) { result = 08.8; /* 2.0/1.0 */}
else if (SE_1 > 0.004702) { result = 08.4; /* 2.0/1.0 */}
}
}
}
}
if (SE_1 > 0.004762)
{
if (EE_1 <= 1.140026)
{
if (SE_1 <= 0.016032)
{
if (RES_c2 <= 9.853716) { result = 09.5; /* 3.0/1.0 */}
else if (RES_c2 > 9.853716) { result = 08.6; /* 5.0/3.0 */}
}
if (SE_1 > 0.016032)
{
if (RES_c2 <= 8.97498) { result = 08.6; /* 2.0 */}
else if (RES_c2 > 8.97498) { result = 08.5; /* 2.0 */}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -