Search in sources :

Example 1 with DoubleBondAromaticityNotSpecified

use of ambit2.smarts.DoubleBondAromaticityNotSpecified in project ambit-mirror by ideaconsult.

the class SLN2ChemObject method slnBondToQueryBond.

/*
	 * Converts only the bond type/expression info
	 * connected atoms info is not handled 
	 */
public IQueryBond slnBondToQueryBond(SLNBond slnBo) {
    currentConversionError = null;
    currentConversionWarning = null;
    if (slnBo == null) {
        currentConversionError = "Bond is null";
        return null;
    }
    if (slnBo.bondType == 0) {
        if (slnBo.bondExpression == null)
            return new AnyOrderQueryBond(SilentChemObjectBuilder.getInstance());
    // TODO handle bond expression
    } else {
        if (slnBo.bondExpression == null) {
            IQueryBond bond = null;
            switch(slnBo.bondType) {
                case 1:
                    if (conversionConfig.FlagSLNSingleBondToSingleOrAromaticBond)
                        bond = new SingleOrAromaticBond(SilentChemObjectBuilder.getInstance());
                    else if (conversionConfig.FlagSupportSingleBondAromaticityNotSpecified)
                        bond = new SingleBondAromaticityNotSpecified(SilentChemObjectBuilder.getInstance());
                    else
                        bond = new SingleNonAromaticBond(SilentChemObjectBuilder.getInstance());
                    break;
                case 2:
                    if (conversionConfig.FlagSupportDoubleBondAromaticityNotSpecified)
                        bond = new DoubleBondAromaticityNotSpecified(SilentChemObjectBuilder.getInstance());
                    else
                        bond = new DoubleNonAromaticBond(SilentChemObjectBuilder.getInstance());
                    break;
                case 3:
                    bond = new OrderQueryBond(IBond.Order.TRIPLE, SilentChemObjectBuilder.getInstance());
                    break;
            }
            return bond;
        }
    // TODO handle bond expression
    }
    return null;
}
Also used : AnyOrderQueryBond(org.openscience.cdk.isomorphism.matchers.smarts.AnyOrderQueryBond) SingleOrAromaticBond(ambit2.smarts.SingleOrAromaticBond) SingleBondAromaticityNotSpecified(ambit2.smarts.SingleBondAromaticityNotSpecified) DoubleNonAromaticBond(ambit2.smarts.DoubleNonAromaticBond) DoubleBondAromaticityNotSpecified(ambit2.smarts.DoubleBondAromaticityNotSpecified) AnyOrderQueryBond(org.openscience.cdk.isomorphism.matchers.smarts.AnyOrderQueryBond) OrderQueryBond(org.openscience.cdk.isomorphism.matchers.smarts.OrderQueryBond) IQueryBond(org.openscience.cdk.isomorphism.matchers.IQueryBond) SingleNonAromaticBond(ambit2.smarts.SingleNonAromaticBond)

Example 2 with DoubleBondAromaticityNotSpecified

use of ambit2.smarts.DoubleBondAromaticityNotSpecified in project ambit-mirror by ideaconsult.

the class RuleStateBondDistribution method calcDistribution.

public void calcDistribution(IQueryAtomContainer statePattern) {
    int n = 0;
    SmartsToChemObject stco = new SmartsToChemObject(SilentChemObjectBuilder.getInstance());
    List<Integer> v2 = new ArrayList<Integer>();
    List<Integer> v3 = new ArrayList<Integer>();
    for (int i = 0; i < statePattern.getBondCount(); i++) {
        if (hasRingClosure)
            if (ringClosureBondIndex == i)
                // It is obligatory that closure bond is not registered in the distribution arrays.
                continue;
        if (statePattern.getBond(i) instanceof DoubleNonAromaticBond) {
            v2.add(new Integer(i));
            continue;
        }
        if (statePattern.getBond(i) instanceof DoubleBondAromaticityNotSpecified) {
            v2.add(new Integer(i));
            continue;
        }
        if (statePattern.getBond(i) instanceof OrderQueryBond) {
            OrderQueryBond bo = (OrderQueryBond) statePattern.getBond(i);
            if (bo.getOrder() == IBond.Order.DOUBLE)
                v2.add(new Integer(i));
            if (bo.getOrder() == IBond.Order.TRIPLE)
                v3.add(new Integer(i));
            continue;
        }
        if (statePattern.getBond(i) instanceof SmartsBondExpression) {
            IBond bo = stco.smartsExpressionToBond((SmartsBondExpression) statePattern.getBond(i));
            if (bo != null) {
                if (bo.getOrder() == IBond.Order.DOUBLE)
                    v2.add(new Integer(i));
                if (bo.getOrder() == IBond.Order.TRIPLE)
                    v3.add(new Integer(i));
            }
            continue;
        }
    }
    DBPositions = new int[v2.size()];
    for (int i = 0; i < v2.size(); i++) DBPositions[i] = v2.get(i).intValue();
    TBPositions = new int[v3.size()];
    for (int i = 0; i < v3.size(); i++) TBPositions[i] = v3.get(i).intValue();
}
Also used : SmartsToChemObject(ambit2.smarts.SmartsToChemObject) DoubleNonAromaticBond(ambit2.smarts.DoubleNonAromaticBond) DoubleBondAromaticityNotSpecified(ambit2.smarts.DoubleBondAromaticityNotSpecified) ArrayList(java.util.ArrayList) IBond(org.openscience.cdk.interfaces.IBond) OrderQueryBond(org.openscience.cdk.isomorphism.matchers.smarts.OrderQueryBond) SmartsBondExpression(ambit2.smarts.SmartsBondExpression)

Aggregations

DoubleBondAromaticityNotSpecified (ambit2.smarts.DoubleBondAromaticityNotSpecified)2 DoubleNonAromaticBond (ambit2.smarts.DoubleNonAromaticBond)2 OrderQueryBond (org.openscience.cdk.isomorphism.matchers.smarts.OrderQueryBond)2 SingleBondAromaticityNotSpecified (ambit2.smarts.SingleBondAromaticityNotSpecified)1 SingleNonAromaticBond (ambit2.smarts.SingleNonAromaticBond)1 SingleOrAromaticBond (ambit2.smarts.SingleOrAromaticBond)1 SmartsBondExpression (ambit2.smarts.SmartsBondExpression)1 SmartsToChemObject (ambit2.smarts.SmartsToChemObject)1 ArrayList (java.util.ArrayList)1 IBond (org.openscience.cdk.interfaces.IBond)1 IQueryBond (org.openscience.cdk.isomorphism.matchers.IQueryBond)1 AnyOrderQueryBond (org.openscience.cdk.isomorphism.matchers.smarts.AnyOrderQueryBond)1