public static void printCounts(HashMap<ShortTandemRepeat, ShortTandemRepeat> res) { int total = 0; int found = 0; int lost = 0; int mismatches = 0; double accuracy = 0; int repeatCount = 0; Set<ShortTandemRepeat> ref = res.keySet(); Iterator<ShortTandemRepeat> refIter = ref.iterator(); while (refIter.hasNext()) { ShortTandemRepeat refStr = refIter.next(); ShortTandemRepeat readStr = res.get(refStr); if (refStr.isLost()) { lost += readStr.getRepeats(); } else { total += refStr.getRepeats(); found += readStr.getRepeats(); mismatches += Math.abs(refStr.getRepeats() - readStr.getRepeats()); accuracy += (double) (total - mismatches) / total; repeatCount++; } } if (repeatCount != 0) { accuracy = accuracy / repeatCount * 100; } System.out.println("\n####Aggregate Counts####"); System.out.println("Reference count: " + total); System.out.println("Private identified count: " + found); System.out.println("Private unidentified count: " + lost); System.out.println("Private mismatch count: " + mismatches); System.out.println("Average STR accuracy: " + accuracy + "%"); }
public static void printIdentified( HashMap<String, LinkedList<ShortTandemRepeat>> ref, HashMap<ShortTandemRepeat, ShortTandemRepeat> priv) { int total; int found = 0; int lost = 0; int zero = 0; List<ShortTandemRepeat> refs = refToSortedList(ref); total = refs.size(); Iterator<ShortTandemRepeat> refIter = refs.iterator(); while (refIter.hasNext()) { ShortTandemRepeat r = refIter.next(); if (priv.containsKey(r)) { ShortTandemRepeat p = priv.get(r); if (p.getRepeats() == 0) { zero++; lost++; } else { found++; } } else { lost++; } } double accuracy = 0; if (total != 0) { accuracy = (double) found / total * 100; } System.out.println("\n####Identification####"); System.out.println("Reference total STRs: " + total); System.out.println("Private identified STRs: " + found); System.out.println("Private identified STRs with 0 count: " + zero); System.out.println("Private unidentified STRs (including 0 counts): " + lost); System.out.println("Identification accuracy: " + accuracy + "%"); }