public static void buildDefault(File censusFile, int[] sunIds) { try { int maxThreads = Runtime.getRuntime().availableProcessors() - 1; ScopDescriptionCensus census = new ScopDescriptionCensus(maxThreads, sunIds); census.setOutputWriter(censusFile); AtomCache cache = new AtomCache(); cache.setFetchFileEvenIfObsolete(true); census.setCache(cache); census.run(); System.out.println(census); } catch (RuntimeException e) { logger.fatal(e.getMessage(), e); } }
public void testFetchObsolete() throws IOException, StructureException { cache.setUseMmCif(false); // TODO Remove after implementing obsolete mmcif fetching cache.setAutoFetch(true); cache.setFetchCurrent(false); cache.setFetchFileEvenIfObsolete(true); Structure s; // OBSOLETE PDB; should throw an exception s = cache.getStructure("1CMW"); assertEquals("Failed to get OBSOLETE file 1CMW.", "1CMW", s.getPDBCode()); s = cache.getStructure("1HHB"); assertEquals("Failed to get OBSOLETE file 1HHB.", "1HHB", s.getPDBCode()); System.err.println( "Please ignore the previous four errors. They are expected for this ancient PDB."); }
public void testFetchCurrent() throws IOException, StructureException { cache.setUseMmCif(false); // TODO Remove after implementing obsolete mmcif fetching cache.setAutoFetch(true); cache.setFetchCurrent(true); cache.setFetchFileEvenIfObsolete(false); Structure s; try { // OBSOLETE PDB; should throw an exception s = cache.getStructure("1CMW"); fail("1CMW has no current structure. Should have thrown an error"); } catch (IOException e) { // expected System.err.println("Please ignore previous exceptions. They are expected."); } catch (StructureException e) { // expected System.err.println("Please ignore previous exceptions. They are expected."); } s = cache.getStructure("1HHB"); assertEquals("Failed to get the current ID for 1HHB.", "4HHB", s.getPDBCode()); }