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 + "%");
 }
  private static void writeStrs(
      String outFileName, List<ShortTandemRepeat> strs, boolean writeAll) {
    BufferedWriter bw = null;
    File outFile = new File(outFileName);
    try {
      if (outFile.exists()) {
        outFile.delete();
      }
      bw = new BufferedWriter(new FileWriter(outFile));
      if (writeAll) {
        for (ShortTandemRepeat str : strs) {
          bw.write(str.toString());
          bw.newLine();
        }
      } else {
        for (ShortTandemRepeat str : strs) {
          bw.write(str.toSmallString());
          bw.newLine();
        }
      }

    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      if (bw != null) {
        try {
          bw.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
  }
  public static void writeCM124Answer(
      String refFileName, String outFileName, HashMap<String, LinkedList<ShortTandemRepeat>> ref) {
    BufferedReader br = null;
    String genomeName = null;
    try {
      br =
          new BufferedReader(
              new InputStreamReader(Utilities.class.getResourceAsStream(refFileName), "UTF-8"));
      genomeName = br.readLine();
      System.out.println("Formatting for genome: " + genomeName);
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (br != null) {
        try {
          br.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
    if (genomeName == null) {
      throw new Error(refFileName + " does not have a genome name.");
    }
    List<ShortTandemRepeat> strs = refToSortedList(ref);
    BufferedWriter bw = null;
    File outFile = new File(outFileName);
    try {
      if (outFile.exists()) {
        outFile.delete();
      }
      if (!outFile.createNewFile()) {
        throw new RuntimeException(outFileName + " already exists.");
      }
      bw = new BufferedWriter(new FileWriter(outFile));
      bw.write(genomeName);
      bw.newLine();
      bw.write(">STR");
      for (ShortTandemRepeat str : strs) {
        bw.newLine();
        bw.write(str.toString());
      }

    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      if (bw != null) {
        try {
          bw.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
  }
 public static void printRef(
     HashMap<String, LinkedList<ShortTandemRepeat>> ref, boolean printAll) {
   List<ShortTandemRepeat> strs = refToSortedList(ref);
   System.out.println("\n####Reference Results####");
   if (printAll) {
     for (ShortTandemRepeat str : strs) {
       System.out.println(str.toString());
     }
   } else {
     for (ShortTandemRepeat str : strs) {
       System.out.println(str.toSmallString());
     }
   }
 }
 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 printPriv(
     HashMap<ShortTandemRepeat, ShortTandemRepeat> priv, boolean printAll) {
   List<ShortTandemRepeat> strs = privToSortedList(priv);
   System.out.println("\n####Private results####");
   if (printAll) {
     for (ShortTandemRepeat str : strs) {
       System.out.println(str.toString());
     }
   } else {
     for (ShortTandemRepeat str : strs) {
       if (str.isLost()) {
         break;
       }
       System.out.println(str.toSmallString());
     }
   }
 }