(String path,
int numThreads,
boolean reverseComplement,
boolean addCountsOnly,
boolean storeReadKmerPairs)
| 1176 | } |
| 1177 | |
| 1178 | private long populateGraphHelper(String path, |
| 1179 | int numThreads, |
| 1180 | boolean reverseComplement, |
| 1181 | boolean addCountsOnly, |
| 1182 | boolean storeReadKmerPairs) throws IOException, InterruptedException { |
| 1183 | Timer timer = new Timer(); |
| 1184 | timer.start(); |
| 1185 | System.out.println("Parsing `" + path + "`..."); |
| 1186 | long numReads = 0; |
| 1187 | |
| 1188 | if (FastaReader.isCorrectFormat(path)) { |
| 1189 | Thread[] threads = new Thread[numThreads]; |
| 1190 | |
| 1191 | FastaReader fr = new FastaReader(path); |
| 1192 | FastaToGraphWorker[] workers = new FastaToGraphWorker[numThreads]; |
| 1193 | |
| 1194 | for (int i=0; i<numThreads; ++i) { |
| 1195 | FastaToGraphWorker worker = new FastaToGraphWorker(fr, reverseComplement, addCountsOnly, storeReadKmerPairs); |
| 1196 | workers[i] = worker; |
| 1197 | threads[i] = new Thread(worker); |
| 1198 | threads[i].start(); |
| 1199 | } |
| 1200 | |
| 1201 | //System.out.println("Initialized " + numThreads + " worker(s)."); |
| 1202 | |
| 1203 | for (Thread t : threads) { |
| 1204 | t.join(); |
| 1205 | } |
| 1206 | |
| 1207 | fr.close(); |
| 1208 | |
| 1209 | for (FastaToGraphWorker w : workers) { |
| 1210 | numReads += w.getReadCount(); |
| 1211 | } |
| 1212 | } |
| 1213 | else if (FastqReader.isCorrectFormat(path)) { |
| 1214 | Thread[] threads = new Thread[numThreads]; |
| 1215 | |
| 1216 | FastqReader fr = minAvgBaseQual > 0 ? new FastqFilteredReader(path, minAvgBaseQual) : new FastqReader(path); |
| 1217 | |
| 1218 | FastqToGraphWorker[] workers = new FastqToGraphWorker[numThreads]; |
| 1219 | |
| 1220 | for (int i=0; i<numThreads; ++i) { |
| 1221 | FastqToGraphWorker worker = new FastqToGraphWorker(fr, reverseComplement, addCountsOnly, storeReadKmerPairs); |
| 1222 | workers[i] = worker; |
| 1223 | threads[i] = new Thread(worker); |
| 1224 | threads[i].start(); |
| 1225 | } |
| 1226 | |
| 1227 | //System.out.println("Initialized " + numThreads + " worker(s)."); |
| 1228 | |
| 1229 | for (Thread t : threads) { |
| 1230 | t.join(); |
| 1231 | } |
| 1232 | |
| 1233 | fr.close(); |
| 1234 | |
| 1235 | for (FastqToGraphWorker w : workers) { |
no test coverage detected