/** * Creates an instance of an AtomCache that is pointed to the a particular path in the file * system. * * @param pdbFilePath a directory in the file system to use as a location to cache files. * @param cachePath */ public AtomCache(String pdbFilePath, String cachePath) { logger.debug( "Initialising AtomCache with pdbFilePath={}, cachePath={}", pdbFilePath, cachePath); if (!pdbFilePath.endsWith(FILE_SEPARATOR)) { pdbFilePath += FILE_SEPARATOR; } // we are caching the binary files that contain the PDBs gzipped // that is the most memory efficient way of caching... // set the input stream provider to caching mode System.setProperty(InputStreamProvider.CACHE_PROPERTY, "true"); setPath(pdbFilePath); this.cachePath = cachePath; fetchBehavior = FetchBehavior.DEFAULT; obsoleteBehavior = ObsoleteBehavior.DEFAULT; currentlyLoading.clear(); params = new FileParsingParameters(); setUseMmCif(true); }
public static void main(String[] args) throws IOException { String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime()); String uri = args[0] + "_" + timeStamp + ".seq"; Set<String> pdbIds = getAll(); StructureIO.setAtomCache(cache); cache.setPath("/Users/Chris/Documents/RCSB/Data/Protein_chains/cache/"); long start = System.nanoTime(); toSequenceFile(uri, pdbIds, true); long end = System.nanoTime(); System.out.println("Time: " + (end - start) / 1E9 + " sec."); }