本文整理汇总了Java中org.openscience.cdk.inchi.InChIToStructure类的典型用法代码示例。如果您正苦于以下问题:Java InChIToStructure类的具体用法?Java InChIToStructure怎么用?Java InChIToStructure使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InChIToStructure类属于org.openscience.cdk.inchi包,在下文中一共展示了InChIToStructure类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAtomContainerFromInChI
import org.openscience.cdk.inchi.InChIToStructure; //导入依赖的package包/类
/**
*
* @param inchi
* @return
* @throws Exception
*/
protected IAtomContainer getAtomContainerFromInChI(String inchi) throws Exception {
if(this.inchiFactory == null) {
System.err.println("InChI-Factory not initialised");
throw new Exception();
}
InChIToStructure its = this.inchiFactory.getInChIToStructure(inchi, DefaultChemObjectBuilder.getInstance());
if(its == null) {
throw new Exception("InChI problem: " + inchi);
}
INCHI_RET ret = its.getReturnStatus();
if (ret == INCHI_RET.WARNING) {
} else if (ret != INCHI_RET.OKAY) {
throw new Exception("InChI problem: " + inchi);
}
return its.getAtomContainer();
}
示例2: getMolFromInchi
import org.openscience.cdk.inchi.InChIToStructure; //导入依赖的package包/类
/**
* Gets the mol from inchi.
*
* @param inchi the inchi
*
* @return the mol from inchi
*
* @throws CDKException the CDK exception
*/
public IAtomContainer getMolFromInchi(String inchi) throws CDKException {
IAtomContainer container = null;
// Generate factory - throws CDKException if native code does not load
InChIGeneratorFactory factory = InChIGeneratorFactory.getInstance();
// Get InChIToStructure
InChIToStructure intostruct = factory.getInChIToStructure(inchi, DefaultChemObjectBuilder.getInstance());
INCHI_RET ret = intostruct.getReturnStatus();
if (ret == INCHI_RET.WARNING) {
// Structure generated, but with warning message
System.out.println("InChI warning: " + intostruct.getMessage());
} else if (ret != INCHI_RET.OKAY) {
// Structure generation failed
throw new CDKException("Structure generation failed failed: "
+ ret.toString() + " [" + intostruct.getMessage() + "]");
}
container = intostruct.getAtomContainer();
// hydrogen handling
container = hydrogenHandling(container);
return container;
}
示例3: fromInChI
import org.openscience.cdk.inchi.InChIToStructure; //导入依赖的package包/类
static IAtomContainer fromInChI(String inchi) {
try {
InChIGeneratorFactory icipar = InChIGeneratorFactory.getInstance();
InChIToStructure itos = icipar.getInChIToStructure(inchi, bldr);
if (itos.getReturnStatus() != INCHI_RET.OKAY && itos.getReturnStatus() != INCHI_RET.WARNING) {
throw new IllegalArgumentException("Invalid InChI:" + itos.getMessage());
}
return layout(itos.getAtomContainer());
} catch (CDKException e) {
throw new IllegalArgumentException("Invalid InChI:" + e.getMessage());
}
}