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


Java CDKException类代码示例

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


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

示例1: prepareAtomContainer

import org.openscience.cdk.exception.CDKException; //导入依赖的package包/类
/**
 * 
 * @param container
 * @throws CDKException 
 */
protected void prepareAtomContainer(IAtomContainer container) throws CDKException {
	while(true) {
   		try {
       		AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(container);
			Aromaticity arom = new Aromaticity(ElectronDonation.cdk(), Cycles.cdkAromaticSet());
			arom.apply(container);
   		} catch (java.lang.NullPointerException e) { 
   			//bad workaround for cdk bug?! but what shall I do...
   			//sometimes NullPointerException occurs but not in one of the further trials?!
       		continue;
       	}
   		break;
       }
       CDKHydrogenAdder hAdder = CDKHydrogenAdder.getInstance(container.getBuilder());
       for(int i = 0; i < container.getAtomCount(); i++) {
      		hAdder.addImplicitHydrogens(container, container.getAtom(i));
       }
       AtomContainerManipulator.convertImplicitToExplicitHydrogens(container);
       hAdder = null;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:26,代码来源:OnlinePubChemDatabaseMicha.java

示例2: getInchiKey

import org.openscience.cdk.exception.CDKException; //导入依赖的package包/类
/**
 * Gets generated InChIKey string.
 */
public String getInchiKey() throws CDKException {
    JniInchiOutputKey key;
    try {
        key = JniInchiWrapper.getInchiKey(output.getInchi());
        if (key.getReturnStatus() == INCHI_KEY.OK) {
            return key.getKey();
        } else {
            throw new CDKException("Error while creating InChIKey: " +
                                   key.getReturnStatus());
        }
    } catch (JniInchiException exception) {
        throw new CDKException("Error while creating InChIKey: " +
                               exception.getMessage(), exception);
    }
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:19,代码来源:InChIGenerator.java

示例3: calculate

import org.openscience.cdk.exception.CDKException; //导入依赖的package包/类
public void calculate() {
	this.value = 0.0;
	SMARTSQueryTool[] smartsQuerytools = (SMARTSQueryTool[])this.settings.get(VariableNames.SMARTS_SUBSTRUCTURE_INCLUSION_SCORE_LIST_NAME);
	if(smartsQuerytools == null) return;

		for(int i = 0; i < smartsQuerytools.length; i++) {
		try {
			if(smartsQuerytools[i].matches(candidate.getPrecursorMolecule().getStructureAsIAtomContainer())) {
				this.value++;
			}
		} catch (CDKException e) {
			e.printStackTrace();
		}
	}
		this.calculationFinished = true;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:17,代码来源:SmartsSubstructureInclusionScore.java

示例4: calculate

import org.openscience.cdk.exception.CDKException; //导入依赖的package包/类
public void calculate() {
	this.value = 0.0;
	SMARTSQueryTool[] smartsQuerytools = (SMARTSQueryTool[])this.settings.get(VariableNames.SMARTS_SUBSTRUCTURE_EXCLUSION_SCORE_LIST_NAME);
	if(smartsQuerytools == null) return;

		for(int i = 0; i < smartsQuerytools.length; i++) {
		try {
			if(smartsQuerytools[i].matches(candidate.getPrecursorMolecule().getStructureAsIAtomContainer())) {
				this.value++;
			}
		} catch (CDKException e) {
			e.printStackTrace();
		}
	}
		this.calculationFinished = true;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:17,代码来源:SmartsSubstructureExclusionScore.java

示例5: getAromaticAtoms

import org.openscience.cdk.exception.CDKException; //导入依赖的package包/类
/**
 * 
 * @param molecule
 * @return
 */
public static BitArray getAromaticAtoms(IAtomContainer molecule) {
	Aromaticity arom = new Aromaticity(ElectronDonation.cdk(),
	Cycles.cdkAromaticSet());
	BitArray aromaticAtoms = new BitArray(molecule.getAtomCount());
	try {
		AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule);
		arom.apply(molecule);
		Set<IBond> aromaticBonds = arom.findBonds(molecule);
		Iterator<IBond> it = aromaticBonds.iterator();
		while(it.hasNext()) {
			IBond bond = it.next();
			for(int k = 0; k < bond.getAtomCount(); k++)
				aromaticAtoms.set(molecule.getAtomNumber(bond.getAtom(k)));
		}
	} catch (CDKException e) {
		e.printStackTrace();
	}
	return aromaticAtoms;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:25,代码来源:InChIDeuteriumGeneration.java

示例6: calculateInchiKey

import org.openscience.cdk.exception.CDKException; //导入依赖的package包/类
/**
 * 
 * @param con
 * @return
 * @throws CDKException
 */
public static String calculateInchiKey(IAtomContainer con) throws CDKException {
	AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(con);
       CDKHydrogenAdder hAdder = CDKHydrogenAdder.getInstance(con.getBuilder());
       for(int i = 0; i < con.getAtomCount(); i++) {
       	try {
       		hAdder.addImplicitHydrogens(con, con.getAtom(i));
       	} 
       	catch(CDKException e) {
       		continue;
       	}
       }
       AtomContainerManipulator.convertImplicitToExplicitHydrogens(con);
	InChIGeneratorFactory factory = InChIGeneratorFactory.getInstance();
	InChIGenerator gen = factory.getInChIGenerator(con);
	return gen.getInchiKey().split("-")[0];
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:23,代码来源:GetRankOfCandidateCSV.java

示例7: getAtomContainerFromSMILES

import org.openscience.cdk.exception.CDKException; //导入依赖的package包/类
public static IAtomContainer getAtomContainerFromSMILES(String smiles) throws Exception {
	IAtomContainer molecule = sp.parseSmiles(smiles);
	for(int i = 0; i < molecule.getAtomCount(); i++) {
		if(molecule.getAtom(i).getSymbol().equals("H")) continue;
		else {
			java.util.List<IAtom> atoms = molecule.getConnectedAtomsList(molecule.getAtom(i));
			short numDs = 0;
			for(IAtom atom : atoms)
				if(atom.getSymbol().equals("H") && (atom.getMassNumber() != null && atom.getMassNumber() == 2))
					numDs++;
			molecule.getAtom(i).setProperty(VariableNames.DEUTERIUM_COUNT_NAME, numDs);
		}
	}
	try {
		AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule);
		Aromaticity arom = new Aromaticity(ElectronDonation.cdk(), Cycles.cdkAromaticSet());
		arom.apply(molecule);
	} catch (CDKException e) {
		e.printStackTrace();
	}
	return molecule;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:23,代码来源:MoleculeFunctions.java

示例8: getAtomContainerFromInChI

import org.openscience.cdk.exception.CDKException; //导入依赖的package包/类
/**
 * 
 * @param inchi
 * @return
 * @throws Exception 
 */
public static IAtomContainer getAtomContainerFromInChI(String inchi) throws Exception {
	de.ipbhalle.metfraglib.inchi.InChIToStructure its = inchiFactory.getInChIToStructure(inchi, DefaultChemObjectBuilder.getInstance());
	if(its == null) {
		throw new Exception("InChI problem: " + inchi);
	}
	INCHI_RET ret = its.getReturnStatus();
	if (ret == INCHI_RET.WARNING) {
	//	logger.warn("InChI warning: " + its.getMessage());
	} else if (ret != INCHI_RET.OKAY) {
		throw new Exception("InChI problem: " + inchi);
	}
	IAtomContainer molecule = its.getAtomContainer();
	try {
		AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule);
		Aromaticity arom = new Aromaticity(ElectronDonation.cdk(), Cycles.cdkAromaticSet());
		arom.apply(molecule);
	} catch (CDKException e) {
		e.printStackTrace();
	}
	return molecule;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:28,代码来源:MoleculeFunctions.java

示例9: calculateFingerprint

import org.openscience.cdk.exception.CDKException; //导入依赖的package包/类
private void calculateFingerprint(IAtomContainer ac) throws FingerPrinterException, MoltyperException,CDKException{
	this.iteration=0;
	this.completeFeatures=new ArrayList<IFeature>();
	this.molecule=ac;
	this.featuresOfLastIteration = new HashMap<IAtom,ECFPFeature>();
	
	computeInitialIdentifiers();
	
	for(int i=0;i<this.getSearchDepth();i++){
		iteration++;
		computeIteration();
	}
	
	// wegner: this is still ugly, I would prefer the molecule is persistent within this object, which it is only 
	//      for the lifetime of a calculateFingerprint function call, very strange design, and not in a good way.
	//      Anyway, workaround is to pass a molecule object along to the ECFPFeature as workaround.
	this.featuresOfLastIteration=null;
	this.molecule=null;
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:20,代码来源:Encoding2DECFP.java

示例10: checkBit22

import org.openscience.cdk.exception.CDKException; //导入依赖的package包/类
private boolean checkBit22(IAtomContainer ac){
	boolean setBit22 = false;
	AllRingsFinder ringFinder = new AllRingsFinder();
	try {
		//find all rings
		IRingSet rings = ringFinder.findAllRings(ac);
		//check if there are rings with three atoms
		for (int i = 0; i < rings.getAtomContainerCount(); i++) {
			IAtomContainer currentRing = rings.getAtomContainer(i);
			int numberOfRingAtoms = currentRing.getAtomCount();
			if(numberOfRingAtoms == 3){
				setBit22 = true;
				break;
			}
		}
		
	} catch (CDKException e) {
		e.printStackTrace();
	}
	return setBit22;
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:22,代码来源:MACCS166.java

示例11: checkBit121

import org.openscience.cdk.exception.CDKException; //导入依赖的package包/类
private boolean checkBit121(IAtomContainer ac){
	boolean setBit121 = false;
	ArrayList<IAtom> heterocyclicAtoms = new ArrayList<IAtom>();
	AllRingsFinder ringFinder = new AllRingsFinder();
	try {
		//find all rings
		IRingSet rings = ringFinder.findAllRings(ac);
		//search after one N atom at the rings
		for (int i = 0; i < rings.getAtomContainerCount(); i++) {
			//if one N atom was found, stop
			if(setBit121) break;
			IAtomContainer currentRing = rings.getAtomContainer(i);
			//search after one N atom
			for(int j = 0; j < currentRing.getAtomCount(); j++){
				IAtom currentAtom = currentRing.getAtom(j);
				if(currentAtom.getSymbol().equals("N")){
					setBit121 = true;
					break;
				}
			}
		}
	}  catch (CDKException e) {
		e.printStackTrace();
	}
	return setBit121;
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:27,代码来源:MACCS166.java

示例12: checkBit137

import org.openscience.cdk.exception.CDKException; //导入依赖的package包/类
private boolean checkBit137(IAtomContainer ac){
	boolean setBit137 = false;
	AllRingsFinder ringFinder = new AllRingsFinder();
	try {
		//find all rings
		IRingSet rings = ringFinder.findAllRings(ac);
		for (int i = 0; i < rings.getAtomContainerCount(); i++) {
			if(setBit137) break;
			IAtomContainer currentRing = rings.getAtomContainer(i);
			//check if at least one atom of the current ring isn't a C atom.
			for(int j = 0; j < currentRing.getAtomCount(); j++){
				IAtom currentAtom = currentRing.getAtom(j);
				if(!(currentAtom.getSymbol().equals("C"))){
					setBit137 = true;
					break;
				}
			}
		}
	}  catch (CDKException e) {
		e.printStackTrace();
	}
	return setBit137;
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:24,代码来源:MACCS166.java

示例13: checkBit101

import org.openscience.cdk.exception.CDKException; //导入依赖的package包/类
private boolean checkBit101(IAtomContainer ac){
	boolean setBit101 = false;
	AllRingsFinder ringFinder = new AllRingsFinder();
	try {
		//find all rings
		IRingSet rings = ringFinder.findAllRings(ac);
		//search if one ring exists with eight or more atoms
		for (int i = 0; i < rings.getAtomContainerCount(); i++){
			IAtomContainer currentRing = rings.getAtomContainer(i);
			int ringSize = currentRing.getAtomCount();
			if(ringSize >= 8){
				setBit101 = true;
				break;
			}
		}
	} catch (CDKException e) {
		e.printStackTrace();
	}
	return setBit101;
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:21,代码来源:MACCS166.java

示例14: getMolRaf

import org.openscience.cdk.exception.CDKException; //导入依赖的package包/类
/**
 * returns the ith Molecule (index of first structure is 0!)
 * 
 * @param mr
 * @return
 * @throws IOException
 * @throws CDKException
 */
private AtomContainer getMolRaf(Long mr) throws IOException, CDKException {
	this.raf.seek(mr.longValue());
	final StringBuffer mdl = new StringBuffer();

	String line = null;
	while ((line = this.raf.readLineBuffered()) != null) {
		mdl.append(line + "\n");
		if (line.startsWith("$$$$")) {
			break;
		}
	}

       AtomContainer molecule = null;
	String mdlString = mdl.toString();
	molecule = this.getRawMolecule(mdlString);

	return molecule;
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:27,代码来源:RandomAccessMDLReader.java

示例15: addExplicitHydrogens

import org.openscience.cdk.exception.CDKException; //导入依赖的package包/类
/**
 * add hydrogens
 * 
 * @param mol
 * @throws CDKException
 */
private static IAtomContainer addExplicitHydrogens(IAtomContainer mol) throws CDKException{

	CDKAtomTypeMatcher matcher = CDKAtomTypeMatcher.getInstance(mol.getBuilder());
	for (IAtom atom : mol.atoms()) {
	     IAtomType type = matcher.findMatchingAtomType(mol, atom);
	     try{
	    	 AtomTypeManipulator.configure(atom, type);
	     }
	     catch(IllegalArgumentException e){
	    	 throw new CDKException(e.toString()+" for atom "+atom.getAtomicNumber()+" "+atom.getSymbol());
	     }
	   }
	CDKHydrogenAdder hydrogenAdder = CDKHydrogenAdder.getInstance(mol.getBuilder());
	hydrogenAdder.addImplicitHydrogens(mol);
	AtomContainerManipulator.convertImplicitToExplicitHydrogens(mol);

	return mol;

}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:26,代码来源:MoleculePreprocessor.java


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