(String path,
int numThreads,
boolean existingKmersOnly)
| 1246 | } |
| 1247 | |
| 1248 | public long populateGraphPairedKmersHelper(String path, |
| 1249 | int numThreads, |
| 1250 | boolean existingKmersOnly) throws IOException, InterruptedException { |
| 1251 | Timer timer = new Timer(); |
| 1252 | timer.start(); |
| 1253 | System.out.println("Parsing `" + path + "`..."); |
| 1254 | long numReads = 0; |
| 1255 | |
| 1256 | if (FastaReader.isCorrectFormat(path)) { |
| 1257 | Thread[] threads = new Thread[numThreads]; |
| 1258 | |
| 1259 | FastaReader fr = new FastaReader(path); |
| 1260 | FastaPairedKmersToGraphWorker[] workers = new FastaPairedKmersToGraphWorker[numThreads]; |
| 1261 | |
| 1262 | for (int i=0; i<numThreads; ++i) { |
| 1263 | FastaPairedKmersToGraphWorker worker = new FastaPairedKmersToGraphWorker(fr, existingKmersOnly); |
| 1264 | workers[i] = worker; |
| 1265 | threads[i] = new Thread(worker); |
| 1266 | threads[i].start(); |
| 1267 | } |
| 1268 | |
| 1269 | //System.out.println("Initialized " + numThreads + " worker(s)."); |
| 1270 | |
| 1271 | for (Thread t : threads) { |
| 1272 | t.join(); |
| 1273 | } |
| 1274 | |
| 1275 | fr.close(); |
| 1276 | |
| 1277 | for (FastaPairedKmersToGraphWorker w : workers) { |
| 1278 | numReads += w.getReadCount(); |
| 1279 | } |
| 1280 | } |
| 1281 | else { |
| 1282 | throw new RuntimeException("Unsupported file format detected in input file `" + path + "`. Only FASTA format is supported."); |
| 1283 | } |
| 1284 | |
| 1285 | System.out.println("Parsed " + NumberFormat.getInstance().format(numReads) + " sequences in " + timer.elapsedDHMS()); |
| 1286 | |
| 1287 | return numReads; |
| 1288 | } |
| 1289 | |
| 1290 | public void populateGraph2(Collection<String> forwardReadPaths, |
| 1291 | Collection<String> reverseReadPaths, |
no test coverage detected