def parent_counts(experiment_proto):
  """Return a map from all counts to counts from their input round.

  Args:
    experiment_proto: selection_pb2.Experiment describing the experiment.

  Returns:
    Dict[str, str] mapping SequencingReads names to the read name for positive
    results from the previous. Reads without a parent count are omitted.
  """
  input_counts = {}
  for round_name, round_proto in experiment_proto.rounds.items():
    if round_proto.input:
      parent_round = experiment_proto.rounds[round_proto.input]
      input_counts[round_name] = parent_round.positive_reads.name
    else:
      input_counts[round_name] = None

  dependencies = {}
  for round_name, round_proto in experiment_proto.rounds.items():
    for reads in [round_proto.positive_reads, round_proto.negative_reads]:
      field = reads.name
      if field:
        parent_count = input_counts[round_name]
        if parent_count:
          dependencies[field] = parent_count
  return dependencies