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


Java UniversalIsomorphismTester类代码示例

本文整理汇总了Java中org.openscience.cdk.isomorphism.UniversalIsomorphismTester的典型用法代码示例。如果您正苦于以下问题:Java UniversalIsomorphismTester类的具体用法?Java UniversalIsomorphismTester怎么用?Java UniversalIsomorphismTester使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UniversalIsomorphismTester类属于org.openscience.cdk.isomorphism包,在下文中一共展示了UniversalIsomorphismTester类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isIsomorph

import org.openscience.cdk.isomorphism.UniversalIsomorphismTester; //导入依赖的package包/类
/**
 * Checks if the given structures are isomorph.
 * 
 * @param candidate1 the candidate1
 * @param candidate2 the candidate2
 * 
 * @return true, if is isomorph
 * 
 * @throws CDKException the CDK exception
 */
public boolean isIsomorph(String candidate1, String candidate2) throws CDKException
{
	IAtomContainer cand1 = null;
	IAtomContainer cand2 = null;
	
	if(hasAtomContainer)
	{
		cand1 = this.candidateToStructure.get(candidate1);
		cand2 = this.candidateToStructure.get(candidate2);
	}
	else
	{
		SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
		cand1 = sp.parseSmiles(candidatesToSmiles.get(candidate1));
		cand2 = sp.parseSmiles(candidatesToSmiles.get(candidate2));
	}
	
	return UniversalIsomorphismTester.isIsomorph(cand1, cand2);
}
 
开发者ID:mgerlich,项目名称:MetFusion,代码行数:30,代码来源:Similarity.java

示例2: perform

import org.openscience.cdk.isomorphism.UniversalIsomorphismTester; //导入依赖的package包/类
/**
 * 
 * @param adduct
 * @return
 */
public void perform(Adduct adduct)
{
    IMolecule cdkMolecule = adduct.getMolecule();
    try
    {
        List<List<RMap>> bondMappings = UniversalIsomorphismTester.getSubgraphMaps(cdkMolecule,
                ReduceDoubleBondAdd2HMod.cDoubleBondC);
        int bondIdInMolecule = bondMappings.get(0).get(0).getId1();
        IBond bondInMolecule = cdkMolecule.getBond(bondIdInMolecule);

        bondInMolecule.setOrder(IBond.Order.SINGLE);

        for (int i=0; i<=1; i++)
        {


            ReduceDoubleBondAdd2HMod.unsetAtomProperties(bondInMolecule.getAtom(i));
        }

        //Add OH to one end
        IAtom atom1 = bondInMolecule.getAtom(0);
        IAtom newOxygen = cdkMolecule.getBuilder().newAtom("O");
        cdkMolecule.addAtom(newOxygen);
        IAtom newHydrogen1 = cdkMolecule.getBuilder().newAtom("H");
        cdkMolecule.addAtom(newHydrogen1);
        cdkMolecule.addBond(cdkMolecule.getBuilder().newBond(atom1, newOxygen, IBond.Order.SINGLE));
        cdkMolecule.addBond(cdkMolecule.getBuilder().newBond(newOxygen, newHydrogen1, IBond.Order.SINGLE));

        //Add H to other end
        IAtom atom2 = bondInMolecule.getAtom(1);
        IAtom newHydrogen2 = cdkMolecule.getBuilder().newAtom("H");
        cdkMolecule.addAtom(newHydrogen2);
        cdkMolecule.addBond(cdkMolecule.getBuilder().newBond(atom2, newHydrogen2, IBond.Order.SINGLE));            


        AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(cdkMolecule);
        adduct.updateFormula();
        adduct.getModifications().add(this);            
    }
    catch (CDKException e)
    {
        ApplicationContext.errorMessage("Reaction failure",e);
    }

}
 
开发者ID:dhmay,项目名称:msInspect,代码行数:51,代码来源:ReduceDoubleBondAddWaterMod.java


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