| 350 | } |
| 351 | |
| 352 | public static HashMap<String, Float> getLengthNormalizedReadCounts(String pafPath, Set<String> skipSet) throws IOException { |
| 353 | HashMap<String, Float> counts = new HashMap<>(); |
| 354 | |
| 355 | PafReader reader = new PafReader(pafPath); |
| 356 | String prevName = null; |
| 357 | ArrayList<Overlap> targets = new ArrayList<>(); |
| 358 | for (PafRecord r = new PafRecord(); reader.hasNext();) { |
| 359 | reader.next(r); |
| 360 | |
| 361 | if (!r.qName.equals(prevName)) { |
| 362 | updateNormalizedCounts(targets, counts); |
| 363 | targets = new ArrayList<>(); |
| 364 | prevName = r.qName; |
| 365 | } |
| 366 | |
| 367 | if (!skipSet.contains(r.tName)) { |
| 368 | targets.add(new Overlap(r)); |
| 369 | } |
| 370 | } |
| 371 | reader.close(); |
| 372 | |
| 373 | // process the last batch of records |
| 374 | updateNormalizedCounts(targets, counts); |
| 375 | |
| 376 | return counts; |
| 377 | } |
| 378 | |
| 379 | /** |
| 380 | * |