/** * Method to create a default AtomTypeFactory, using the structgen atom type list. * * @see #getInstance(String, IChemObjectBuilder) * @param builder IChemObjectBuilder used to make IChemObject instances * @return The AtomTypeFactory for the given data file */ public static AtomTypeFactory getInstance(IChemObjectBuilder builder) { return getInstance("org/openscience/cdk/config/data/structgen_atomtypes.xml", builder); }
/** * Method to create a default AtomTypeFactory, using the structgen atom type list. * * @see #getInstance(String, IChemObjectBuilder) * @param builder IChemObjectBuilder used to make IChemObject instances * @return The AtomTypeFactory for the given data file */ public static AtomTypeFactory getInstance(IChemObjectBuilder builder) { return getInstance("org/openscience/cdk/config/data/structgen_atomtypes.xml", builder); }
private void createAtomTypeFactory(IChemObjectBuilder builder) { if (factory == null) { factory = AtomTypeFactory.getInstance("org/openscience/cdk/dict/data/cdk-atom-types.owl", builder); } }
private static AtomTypeFactory getAtomTypeFactory(IChemObjectBuilder builder) { if (atomTypeFactory == null) { atomTypeFactory = AtomTypeFactory.getInstance( // "org/openscience/cdk/dict/data/cdk-atom-types.owl", builder); "org/openscience/cdk/config/data/structgen_atomtypes.xml", builder); } return atomTypeFactory; }
private CDKAtomTypeMatcher(IChemObjectBuilder builder, int mode) { factory = AtomTypeFactory.getInstance("org/openscience/cdk/dict/data/cdk-atom-types.owl", builder); this.mode = mode; }
private CDKAtomTypeMatcher(IChemObjectBuilder builder, int mode) { factory = AtomTypeFactory.getInstance("org/openscience/cdk/dict/data/cdk-atom-types.owl", builder); this.mode = mode; }
private SybylAtomTypeMatcher(IChemObjectBuilder builder) { InputStream stream = this.getClass().getClassLoader().getResourceAsStream(SYBYL_ATOM_TYPE_LIST); factory = AtomTypeFactory.getInstance(stream, "owl", builder); cdkMatcher = CDKAtomTypeMatcher.getInstance(builder); InputStream mapStream = this.getClass().getClassLoader().getResourceAsStream(CDK_TO_SYBYL_MAP); mapper = AtomTypeMapper.getInstance(CDK_TO_SYBYL_MAP, mapStream); }
private String typeHetatm(String resName, String atomName) { if (hetDictionary == null) { readHetDictionary(); cdkAtomTypeFactory = AtomTypeFactory.getInstance("org/openscience/cdk/dict/data/cdk-atom-types.owl", DefaultChemObjectBuilder.getInstance()); } String key = resName + "." + atomName; if (hetDictionary.containsKey(key)) { return hetDictionary.get(key); } return null; }
private String typeHetatm(String resName, String atomName) { if (hetDictionary == null) { readHetDictionary(); cdkAtomTypeFactory = AtomTypeFactory.getInstance("org/openscience/cdk/dict/data/cdk-atom-types.owl", DefaultChemObjectBuilder.getInstance()); } String key = resName + "." + atomName; if (hetDictionary.containsKey(key)) { return hetDictionary.get(key); } return null; }
protected AtomTypeFactory getAtomTypeFactory(IChemObjectBuilder builder) throws CDKException { if (structgenATF == null) { try { structgenATF = AtomTypeFactory.getInstance(atomTypeList, builder); } catch (Exception exception) { logger.debug(exception); throw new CDKException("Could not instantiate AtomTypeFactory!", exception); } } return structgenATF; }
protected AtomTypeFactory getAtomTypeFactory(IChemObjectBuilder builder) throws CDKException { if (structgenATF == null) { try { structgenATF = AtomTypeFactory.getInstance(atomTypeList, builder); } catch (Exception exception) { logger.debug(exception); throw new CDKException("Could not instantiate AtomTypeFactory!", exception); } } return structgenATF; }
@Test public void testGetInstance_InputStream_String_IChemObjectBuilder() throws Exception { String configFile = "org/openscience/cdk/config/data/structgen_atomtypes.xml"; InputStream ins = this.getClass().getClassLoader().getResourceAsStream(configFile); AtomTypeFactory atf = AtomTypeFactory.getInstance(ins, "xml", new ChemObject().getBuilder()); Assert.assertNotNull(atf); Assert.assertNotSame(0, atf.getSize()); }
@Test public void testToString() throws NoSuchAtomTypeException { AtomTypeFactory factory = AtomTypeFactory.getInstance( "org/openscience/cdk/dict/data/cdk-atom-types.owl", SilentChemObjectBuilder.getInstance() ); IAtomType type = factory.getAtomType("C.sp3"); Assert.assertTrue(type instanceof ImmutableAtomType); String output = type.toString(); Assert.assertTrue(output.contains("ImmutableAtomType(")); Assert.assertTrue(output.contains("MBO:")); }
@Test public void testGetInstance_IChemObjectBuilder() throws Exception { AtomTypeFactory atf = AtomTypeFactory.getInstance(new ChemObject().getBuilder()); Assert.assertNotNull(atf); }
@Test public void testGetSize() throws Exception { AtomTypeFactory atf = AtomTypeFactory.getInstance(new ChemObject().getBuilder()); Assert.assertNotSame(0, atf.getSize()); }
@Test public void testGetAllAtomTypes() throws Exception { AtomTypeFactory atf = AtomTypeFactory.getInstance(new ChemObject().getBuilder()); IAtomType[] types = atf.getAllAtomTypes(); Assert.assertNotNull(types); Assert.assertNotSame(0, types.length); }
@Test public void testGetInstance_String_IChemObjectBuilder() throws Exception { String configFile = "org/openscience/cdk/config/data/structgen_atomtypes.xml"; AtomTypeFactory atf = AtomTypeFactory.getInstance(configFile, new ChemObject().getBuilder()); Assert.assertNotNull(atf); Assert.assertNotSame(0, atf.getSize()); }
@Test public void testConfigure_IAtom() throws Exception { IAtomType atomType; IAtom atom = new org.openscience.cdk.Atom(); atom.setAtomTypeName("C.ar"); AtomTypeFactory factory = AtomTypeFactory.getInstance("org/openscience/cdk/config/data/mol2_atomtypes.xml", new ChemObject().getBuilder()); atomType = factory.configure(atom); Assert.assertNotNull(atomType); Assert.assertEquals("C", atom.getSymbol()); }
@Test public void testGetAtomTypeFromPDB() throws Exception { AtomTypeFactory factory = AtomTypeFactory.getInstance("org/openscience/cdk/config/data/pdb_atomtypes.xml", new ChemObject().getBuilder()); IAtomType atomType = factory.getAtomType("ALA.CA"); Assert.assertNotNull(atomType); Assert.assertEquals("C", atomType.getSymbol()); Assert.assertEquals("ALA.CA", atomType.getAtomTypeName()); }
@Test public void testGetAtomTypeFromJmol() throws Exception { AtomTypeFactory factory = AtomTypeFactory.getInstance("org/openscience/cdk/config/data/jmol_atomtypes.txt", new ChemObject().getBuilder()); IAtomType atomType = factory.getAtomType("H"); Assert.assertNotNull(atomType); Assert.assertEquals("H", atomType.getSymbol()); Assert.assertEquals("H", atomType.getAtomTypeName()); }