code: def _titancna_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["subclones"]) as in_handle:
              header = in_handle.readline().strip().split()
              for line in in_handle:
                  val = dict(zip(header, line.strip().split()))
                  start = int(val["Start_Position.bp."])
                  end = int(val["End_Position.bp."])
                  for region, cur_coords in coords.items():
                      if val["Chromosome"] == cur_coords[0] and are_overlapping((start, end), cur_coords[1:]):
                          cur_calls[region][_check_copy_number_changes(svtype, _to_cn(val["Copy_Number"]),
                                                                       _to_cn(val["MinorCN"]), 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().split("\t"), in_handle.readline().strip().split("\t")))
      out["purity"] = vals["purity"]
      out["ploidy"] = vals["ploidy"]
      return out
docs: Summarize purity, ploidy and LOH for TitanCNA.