当前位置: 首页>>代码示例>>Java>>正文


Java InChIToStructure类代码示例

本文整理汇总了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();
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:23,代码来源:OnlinePubChemDatabaseMicha.java

示例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;
}
 
开发者ID:mgerlich,项目名称:MetFusion,代码行数:33,代码来源:MassBankUtilities.java

示例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());
    }
}
 
开发者ID:johnmay,项目名称:efficient-bits,代码行数:13,代码来源:MolInput.java


注:本文中的org.openscience.cdk.inchi.InChIToStructure类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。