@Test public void testReadAllAPClasses() throws Exception { DENOPTIMFragment frag = new DENOPTIMFragment(); IAtom atmC = new Atom("C"); atmC.setPoint3d(new Point3d(0.0, 0.0, 1.0)); IAtom atmH = new Atom("H"); atmH.setPoint3d(new Point3d(0.0, 1.0, 1.0)); frag.addAtom(atmC); frag.addAtom(atmH); frag.addAP(atmC, "classAtmC:5", new Point3d(1.0, 0.0, 0.0)); frag.addAP(atmC, "classAtmC:5", new Point3d(1.0, 1.0, 0.0)); frag.addAP(atmC, "otherClass:0", new Point3d(-1.0, 0.0, 0.0)); frag.addAP(atmH, "classAtmH:1", new Point3d(1.0, 2.0, 2.0)); frag.projectAPsToProperties(); DENOPTIMFragment frag2 = new DENOPTIMFragment(); IAtom atmO = new Atom("O"); atmO.setPoint3d(new Point3d(0.0, 0.0, 1.0)); IAtom atmH2 = new Atom("N"); atmH.setPoint3d(new Point3d(0.0, 1.0, 1.0)); frag2.addAtom(atmO); frag2.addAtom(atmH2); frag2.addAP(atmO, "apClassO:5", new Point3d(1.0, 0.0, 0.0)); frag2.addAP(atmO, "apClassO:6", new Point3d(1.0, 1.0, 0.0)); frag2.addAP(atmO, "apClassObis:0", new Point3d(-1.0, 0.0, 0.0)); frag2.addAP(atmH2, "classAtmH:1", new Point3d(1.0, 2.0, 2.0)); frag2.projectAPsToProperties(); ArrayList<DENOPTIMFragment> frags = new ArrayList<DENOPTIMFragment>(); frags.add(frag); frags.add(frag2); String tmpFile = DenoptimIO.getTempFolder() + System.getProperty("file.separator") + "frag.sdf"; DenoptimIO.writeFragmentSet(tmpFile, frags); Set<String> allAPC = DenoptimIO.readAllAPClasses(new File(tmpFile)); assertEquals(6,allAPC.size(),"Size did not match"); assertTrue(allAPC.contains("apClassObis:0"),"Contains failed (1)"); assertTrue(allAPC.contains("otherClass:0"),"Contains failed (2)"); }
public static Set<String> readAllAPClasses(File fragLib) { Set<String> allCLasses = new HashSet<String>(); try { for (IAtomContainer mol : DenoptimIO.readMoleculeData( fragLib.getAbsolutePath())) { DENOPTIMFragment frag = new DENOPTIMFragment(mol); for (DENOPTIMAttachmentPoint ap : frag.getAllAPs()) { allCLasses.add(ap.getAPClass()); } } } catch (DENOPTIMException e) { System.out.println("Could not read data from '" + fragLib +"'. " + "Cause: " + e.getMessage()); } return allCLasses; }
DenoptimIO { public static Set<String> readAllAPClasses(File fragLib) { Set<String> allCLasses = new HashSet<String>(); try { for (IAtomContainer mol : DenoptimIO.readMoleculeData( fragLib.getAbsolutePath())) { DENOPTIMFragment frag = new DENOPTIMFragment(mol); for (DENOPTIMAttachmentPoint ap : frag.getAllAPs()) { allCLasses.add(ap.getAPClass()); } } } catch (DENOPTIMException e) { System.out.println("Could not read data from '" + fragLib +"'. " + "Cause: " + e.getMessage()); } return allCLasses; } }
DenoptimIO { public static Set<String> readAllAPClasses(File fragLib) { Set<String> allCLasses = new HashSet<String>(); try { for (IAtomContainer mol : DenoptimIO.readMoleculeData( fragLib.getAbsolutePath())) { DENOPTIMFragment frag = new DENOPTIMFragment(mol); for (DENOPTIMAttachmentPoint ap : frag.getAllAPs()) { allCLasses.add(ap.getAPClass()); } } } catch (DENOPTIMException e) { System.out.println("Could not read data from '" + fragLib +"'. " + "Cause: " + e.getMessage()); } return allCLasses; }  }
DenoptimIO { public static Set<String> readAllAPClasses(File fragLib) { Set<String> allCLasses = new HashSet<String>(); try { for (IAtomContainer mol : DenoptimIO.readMoleculeData( fragLib.getAbsolutePath())) { DENOPTIMFragment frag = new DENOPTIMFragment(mol); for (DENOPTIMAttachmentPoint ap : frag.getAllAPs()) { allCLasses.add(ap.getAPClass()); } } } catch (DENOPTIMException e) { System.out.println("Could not read data from '" + fragLib +"'. " + "Cause: " + e.getMessage()); } return allCLasses; }  static ArrayList<IAtomContainer> readLinksToMols(String fileName); static ArrayList<IAtomContainer> readSDFFile(String fileName); static IAtomContainer readSingleSDFFile(String fileName); static void writeFragmentSet(String fileName,
            ArrayList<DENOPTIMFragment> mols); static void writeMoleculeSet(String fileName,
            ArrayList<IAtomContainer> mols); static void writeMolecule(String fileName, IAtomContainer mol,
            boolean append); static void writeMol2File(String fileName, IAtomContainer mol,
            boolean append); static void writeXYZFile(String fileName, IAtomContainer mol,
            boolean append); static void writeSmilesSet(String fileName, String[] smiles,
            boolean append); static void writeSmiles(String fileName, String smiles,
            boolean append); static void writeData(String fileName, String data, boolean append); static void serializeToFile(String fileName, Object obj, 
								 boolean append); static DENOPTIMGraph deserializeDENOPTIMGraph(File file); static void createZipFile(String zipOutputFileName,
            String[] filesToZip); static void deleteFile(String fileName); static void deleteFilesContaining(String path, String pattern); static boolean createDirectory(String fileName); static boolean checkExists(String fileName); static int countLinesInFile(String fileName); static ArrayList<BitSet> readFingerprintData(String fileName); static Object deepCopy(Object oldObj); static double[] readPopulationProps(File file); static ArrayList<String> readList(String fileName); static void writeXYZFile(String fileName, ArrayList<String> atom_symbols,
            ArrayList<Point3d> atom_coords); static String getChemDoodleString(IAtomContainer mol); static void writeMolecule2D(String fileName, IAtomContainer mol); static Set<String> readAllAPClasses(File fragLib); static void writeCompatibilityMatrix(String fileName,
            HashMap<String, ArrayList<String>> compReacMap,
            HashMap<String, Integer> reacBonds, HashMap<String, String> reacCap,
            Set<String> forbEnd); static void readCompatibilityMatrix(String fileName,
            HashMap<String, ArrayList<String>> compReacMap,
            HashMap<String, Integer> reacBonds, HashMap<String, String> reacCap,
            Set<String> forbEnd); static void readRCCompatibilityMatrix(String fileName,
            HashMap<String, ArrayList<String>> rcCompMap); static ArrayList<DENOPTIMMolecule> readDENOPTIMMolecules(File file, 
    		boolean useFragSpace); static ArrayList<IAtomContainer> readMoleculeData(String fileName); static ArrayList<IAtomContainer> readMoleculeData(String fileName, 
    		String format); static void moleculeToPNG(IAtomContainer mol, String fileName); static ArrayList<DENOPTIMGraphEdit> readDENOPTIMGraphEditFromFile(
                                                                String fileName); static ArrayList<DENOPTIMGraph> readDENOPTIMGraphsFromFile(
    		            String fileName, String format, boolean useFS); static ArrayList<DENOPTIMGraph> readDENOPTIMGraphsFromSerFile(
    		String fileName); static ArrayList<DENOPTIMGraph> readDENOPTIMGraphsFromSDFile(
								String fileName, boolean useFS); static ArrayList<DENOPTIMGraph> readDENOPTIMGraphsFromFile(
					String fileName, boolean useFS); static void writeGraphsToFile(String fileName, 
    		ArrayList<DENOPTIMGraph> graphs, boolean append); static void writeGraphToFile(String fileName, DENOPTIMGraph graph, 
    		boolean append); static String getTempFolder(); static boolean canWriteAndReadTo(String pathName); static ArrayList<IAtomContainer> readInLibraryOfFragments(
    		String fileName, String kindStr); }
DenoptimIO { public static Set<String> readAllAPClasses(File fragLib) { Set<String> allCLasses = new HashSet<String>(); try { for (IAtomContainer mol : DenoptimIO.readMoleculeData( fragLib.getAbsolutePath())) { DENOPTIMFragment frag = new DENOPTIMFragment(mol); for (DENOPTIMAttachmentPoint ap : frag.getAllAPs()) { allCLasses.add(ap.getAPClass()); } } } catch (DENOPTIMException e) { System.out.println("Could not read data from '" + fragLib +"'. " + "Cause: " + e.getMessage()); } return allCLasses; }  static ArrayList<IAtomContainer> readLinksToMols(String fileName); static ArrayList<IAtomContainer> readSDFFile(String fileName); static IAtomContainer readSingleSDFFile(String fileName); static void writeFragmentSet(String fileName,
            ArrayList<DENOPTIMFragment> mols); static void writeMoleculeSet(String fileName,
            ArrayList<IAtomContainer> mols); static void writeMolecule(String fileName, IAtomContainer mol,
            boolean append); static void writeMol2File(String fileName, IAtomContainer mol,
            boolean append); static void writeXYZFile(String fileName, IAtomContainer mol,
            boolean append); static void writeSmilesSet(String fileName, String[] smiles,
            boolean append); static void writeSmiles(String fileName, String smiles,
            boolean append); static void writeData(String fileName, String data, boolean append); static void serializeToFile(String fileName, Object obj, 
								 boolean append); static DENOPTIMGraph deserializeDENOPTIMGraph(File file); static void createZipFile(String zipOutputFileName,
            String[] filesToZip); static void deleteFile(String fileName); static void deleteFilesContaining(String path, String pattern); static boolean createDirectory(String fileName); static boolean checkExists(String fileName); static int countLinesInFile(String fileName); static ArrayList<BitSet> readFingerprintData(String fileName); static Object deepCopy(Object oldObj); static double[] readPopulationProps(File file); static ArrayList<String> readList(String fileName); static void writeXYZFile(String fileName, ArrayList<String> atom_symbols,
            ArrayList<Point3d> atom_coords); static String getChemDoodleString(IAtomContainer mol); static void writeMolecule2D(String fileName, IAtomContainer mol); static Set<String> readAllAPClasses(File fragLib); static void writeCompatibilityMatrix(String fileName,
            HashMap<String, ArrayList<String>> compReacMap,
            HashMap<String, Integer> reacBonds, HashMap<String, String> reacCap,
            Set<String> forbEnd); static void readCompatibilityMatrix(String fileName,
            HashMap<String, ArrayList<String>> compReacMap,
            HashMap<String, Integer> reacBonds, HashMap<String, String> reacCap,
            Set<String> forbEnd); static void readRCCompatibilityMatrix(String fileName,
            HashMap<String, ArrayList<String>> rcCompMap); static ArrayList<DENOPTIMMolecule> readDENOPTIMMolecules(File file, 
    		boolean useFragSpace); static ArrayList<IAtomContainer> readMoleculeData(String fileName); static ArrayList<IAtomContainer> readMoleculeData(String fileName, 
    		String format); static void moleculeToPNG(IAtomContainer mol, String fileName); static ArrayList<DENOPTIMGraphEdit> readDENOPTIMGraphEditFromFile(
                                                                String fileName); static ArrayList<DENOPTIMGraph> readDENOPTIMGraphsFromFile(
    		            String fileName, String format, boolean useFS); static ArrayList<DENOPTIMGraph> readDENOPTIMGraphsFromSerFile(
    		String fileName); static ArrayList<DENOPTIMGraph> readDENOPTIMGraphsFromSDFile(
								String fileName, boolean useFS); static ArrayList<DENOPTIMGraph> readDENOPTIMGraphsFromFile(
					String fileName, boolean useFS); static void writeGraphsToFile(String fileName, 
    		ArrayList<DENOPTIMGraph> graphs, boolean append); static void writeGraphToFile(String fileName, DENOPTIMGraph graph, 
    		boolean append); static String getTempFolder(); static boolean canWriteAndReadTo(String pathName); static ArrayList<IAtomContainer> readInLibraryOfFragments(
    		String fileName, String kindStr);  }