本文整理汇总了Java中org.openscience.cdk.io.MDLV2000Reader类的典型用法代码示例。如果您正苦于以下问题:Java MDLV2000Reader类的具体用法?Java MDLV2000Reader怎么用?Java MDLV2000Reader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MDLV2000Reader类属于org.openscience.cdk.io包,在下文中一共展示了MDLV2000Reader类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getContainer
import org.openscience.cdk.io.MDLV2000Reader; //导入依赖的package包/类
/**
* Retrieves the IAtomContainer for a moldata string.
*
* @param mol the moldata as String
*
* @return the container as IAtomContainer object, null if Exception occurs
*/
public IAtomContainer getContainer(String mol) {
if(mol.isEmpty() || mol.equals("0\n")) {
return null;
}
InputStream is = new ByteArrayInputStream(mol.getBytes());
MDLV2000Reader reader = new MDLV2000Reader(is);
IChemFile chemFile = new ChemFile();
IAtomContainer container = null;
try {
chemFile = (IChemFile) reader.read(chemFile);
container = ChemFileManipulator.getAllAtomContainers(chemFile).get(0);
// hydrogen handling
container = hydrogenHandling(container);
} catch (CDKException e) {
System.err.println("CDKException occured!");
return null;
}
return container;
}
开发者ID:mgerlich,项目名称:MetFusion,代码行数:28,代码来源:MassBankUtilities.java
示例2: Structure2DComponent
import org.openscience.cdk.io.MDLV2000Reader; //导入依赖的package包/类
public Structure2DComponent(String structure) throws CDKException,
IOException {
// Create a silend CDK builder
IChemObjectBuilder builder = SilentChemObjectBuilder.getInstance();
// Create a new molecule instance
molecule = builder.newInstance(IAtomContainer.class);
// Load the structure into the molecule
MDLV2000Reader molReader = new MDLV2000Reader(new StringReader(
structure));
molReader.read(molecule);
molReader.close();
// Suppress the hydrogens
AtomContainerManipulator.suppressHydrogens(molecule);
// If the model has no coordinates, let's generate them
if (!GeometryUtil.has2DCoordinates(molecule)) {
StructureDiagramGenerator sdg = new StructureDiagramGenerator();
sdg.setMolecule(molecule, false);
sdg.generateCoordinates();
}
// Generators make the image elements
Font font = new Font("Verdana", Font.PLAIN, 14);
List<IGenerator<IAtomContainer>> generators = new ArrayList<IGenerator<IAtomContainer>>();
generators.add(new BasicSceneGenerator());
generators.add(new StandardGenerator(font));
// Renderer needs to have a toolkit-specific font manager
renderer = new AtomContainerRenderer(generators, new AWTFontManager());
// Set default atom colors for the renderer
RendererModel rendererModel = renderer.getRenderer2DModel();
rendererModel.set(StandardGenerator.AtomColor.class,
new CDK2DAtomColors());
}
开发者ID:mzmine,项目名称:mzmine2,代码行数:41,代码来源:Structure2DComponent.java
示例3: loadMol
import org.openscience.cdk.io.MDLV2000Reader; //导入依赖的package包/类
private IAtomContainer loadMol(String str) throws CDKException
{
if (str.contains("V2000")) {
try (MDLV2000Reader mdlr = new MDLV2000Reader(new StringReader(str))) {
return mdlr.read(new AtomContainer(0, 0, 0, 0));
} catch (CDKException | IOException e3) {
throw new CDKException("Could not parse input");
}
} else {
return smipar.parseSmiles(str);
}
}
开发者ID:cdk,项目名称:depict,代码行数:13,代码来源:DepictController.java
注:本文中的org.openscience.cdk.io.MDLV2000Reader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论