code: def _purecn_summary(call, data):
      
      out = {}
      for svtype, coords in get_coords(data):
          cur_calls = {k: collections.defaultdict(int) for k in coords.keys()}
          with open(call["loh"]) as in_handle:
              in_handle.readline()  # header
              for line in in_handle:
                  _, chrom, start, end, _, cn, minor_cn = line.split(",")[:7]
                  start = int(start)
                  end = int(end)
                  for region, cur_coords in coords.items():
                      if chrom == cur_coords[0] and are_overlapping((start, end), cur_coords[1:]):
                          cur_calls[region][_check_copy_number_changes(svtype, _to_cn(cn), _to_cn(minor_cn), data)] += 1
          out[svtype] = {r: _merge_cn_calls(c, svtype) for r, c in cur_calls.items()}
      with open(call["hetsummary"]) as in_handle:
          vals = dict(zip(in_handle.readline().strip().replace('"', '').split(","),
                          in_handle.readline().strip().split(",")))
      out["purity"] = vals["Purity"]
      out["ploidy"] = vals["Ploidy"]
      return out
docs: Summarize purity, ploidy and LOH for PureCN.