use of org.openscience.cdk.inchi.InChIGenerator in project ambit-mirror by ideaconsult.
the class InChI method calculate.
public DescriptorValue calculate(IAtomContainer mol) {
try {
InChIGenerator gen = processor.process(mol);
INCHI_RET ret = gen.getReturnStatus();
if (ret.equals(INCHI_RET.OKAY) || ret.equals(INCHI_RET.WARNING)) {
StringArrayResult value = new StringArrayResult(new String[] { gen.getInchi(), null, gen.getInchiKey() });
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), value, getDescriptorNames());
} else {
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), null, getDescriptorNames(), new Exception(String.format("[%s] %s", gen.getReturnStatus(), gen.getMessage())));
}
} catch (Exception x) {
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), null, getDescriptorNames(), x);
}
}
use of org.openscience.cdk.inchi.InChIGenerator in project ambit-mirror by ideaconsult.
the class SimilarityManager method getInchiKey.
String getInchiKey(IAtomContainer mol) throws Exception {
InChIGenerator ig = inchiGeneratorFactory.getInChIGenerator(mol, inchiOptions);
INCHI_RET returnCode = ig.getReturnStatus();
if (INCHI_RET.ERROR == returnCode) {
// Error
}
return ig.getInchiKey();
}
use of org.openscience.cdk.inchi.InChIGenerator in project ambit-mirror by ideaconsult.
the class ReactionSequence method getInchiKey.
public String getInchiKey(IAtomContainer mol) {
try {
InChIGenerator ig = inchiGeneratorFactory.getInChIGenerator(mol, inchiOptions);
INCHI_RET returnCode = ig.getReturnStatus();
if (INCHI_RET.ERROR == returnCode) {
Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, ig.getMessage());
}
return ig.getInchiKey();
} catch (Exception e) {
Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, e.getMessage());
}
return null;
}
use of org.openscience.cdk.inchi.InChIGenerator in project ambit-mirror by ideaconsult.
the class Reactor method addReagent.
void addReagent(ReactorNode node, IAtomContainer mol) {
if (strategy.FlagCalcProductInchiKey) {
try {
InChIGenerator ig = igf.getInChIGenerator(mol, igf_options);
mol.setProperty(PropertyInchiKey, ig.getInchiKey());
} catch (Exception e) {
}
;
}
if (strategy.FlagRemoveReagentIfAllowedProduct) {
String inchiKey = mol.getProperty(PropertyInchiKey);
if (isAllowedProduct(inchiKey)) {
node.allowedProducts.addAtomContainer(mol);
return;
}
}
if (strategy.FlagRemoveReagentIfForbiddenProduct) {
String inchiKey = mol.getProperty(PropertyInchiKey);
if (isForbiddenProduct(inchiKey)) {
node.forbiddenProducts.addAtomContainer(mol);
return;
}
}
node.reagents.addAtomContainer(mol);
}
use of org.openscience.cdk.inchi.InChIGenerator in project ambit-mirror by ideaconsult.
the class ReactorStrategy method configureStructureRecord.
public static void configureStructureRecord(StructureRecord strRecord, InChIGeneratorFactory igf, List<INCHI_OPTION> options) throws Exception {
if (strRecord.getSmiles() == null)
return;
IAtomContainer mol = SmartsHelper.getMoleculeFromSmiles(strRecord.getSmiles());
InChIGenerator ig = igf.getInChIGenerator(mol, options);
// String inchi = ig.getInchi();
strRecord.setInchiKey(ig.getInchiKey());
}
Aggregations