📄 rdfprotondescriptor_ghrtest.java
字号:
package org.openscience.cdk.test.qsar.descriptors.atomic;import java.io.InputStream;import junit.framework.Test;import junit.framework.TestSuite;import org.openscience.cdk.ChemFile;import org.openscience.cdk.ChemObject;import org.openscience.cdk.interfaces.IChemModel;import org.openscience.cdk.interfaces.IChemSequence;import org.openscience.cdk.interfaces.IMolecule;import org.openscience.cdk.interfaces.IMoleculeSet;import org.openscience.cdk.io.MDLReader;import org.openscience.cdk.qsar.DescriptorValue;import org.openscience.cdk.qsar.descriptors.atomic.RDFProtonDescriptor_GHR;import org.openscience.cdk.qsar.result.DoubleArrayResult;import org.openscience.cdk.qsar.result.IDescriptorResult;import org.openscience.cdk.test.CDKTestCase;/** * @cdk.module test-qsar */public class RDFProtonDescriptor_GHRTest extends CDKTestCase { public RDFProtonDescriptor_GHRTest() { } public static Test suite() { return new TestSuite(RDFProtonDescriptor_GHRTest.class); } /** * @cdk.bug 1632419 */ public void testExample1() throws Exception { //firstly read file to molecule String filename = "data/mdl/hydroxyamino.mol" + ""; InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); MDLReader reader = new MDLReader(ins); ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile()); IChemSequence seq = chemFile.getChemSequence(0); IChemModel model = seq.getChemModel(0); IMoleculeSet som = model.getMoleculeSet(); IMolecule mol = som.getMolecule(0); RDFProtonDescriptor_GHR descriptor = new RDFProtonDescriptor_GHR(); int hNumber =0; for (int i=0; i < mol.getAtomCount(); i++) { System.out.println("Atom: " + mol.getAtom(i).getSymbol()); System.out.println(" charge: " + mol.getAtom(i).getCharge()); if(mol.getAtom(i).getSymbol().equals("H")){ hNumber++; //secondly perform calculation on it. DescriptorValue dv = descriptor.calculate(mol.getAtom(i),mol ); IDescriptorResult result = dv.getValue(); System.out.println("array: " + result.toString()); assertNotNull(result); } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -