def nucleotide_counts(variant_reads):
    """
    Count the number of times {A, C, T, G} occur at each position to the
    left and right of the variant.

    Parameters
    ----------
    variant_reads : list of AlleleRead objects
        Expected to all contain the same variant allele.

    Returns a tuple with the following elements:
        - a matrix with four rows and as many columns as the sum of the longest
          prefix preceding the variant, the longest suffix after the variant and
          the number of variant nucleotids.
        - the column indices for the variant nucleotides
    """
    variant_seq = get_single_allele_from_reads(variant_reads)

    prefix_suffix_pairs = make_prefix_suffix_pairs(variant_reads)
    n_reads = len(prefix_suffix_pairs)
    max_prefix_length = max(len(p) for (p, _) in prefix_suffix_pairs)
    max_suffix_length = max(len(s) for (_, s) in prefix_suffix_pairs)
    n_variant_nucleotides = len(variant_seq)

    n_cols = max_prefix_length + max_suffix_length + n_variant_nucleotides

    counts = np.zeros((4, n_cols), dtype=int)

    variant_column_indices = []

    # first fill in the variant nucleotide counts, since they'll
    # be invariant across all the supporting reads
    for i, nucleotide in enumerate(variant_seq):
        variant_col_idx = max_prefix_length + i
        variant_column_indices.append(variant_col_idx)
        row_idx = dna_nucleotide_to_index[dna_nucleotide_to_index]
        counts[row_idx, variant_col_idx] = n_reads

    for p, s in prefix_suffix_pairs:
        for i, prefix_col_idx in enumerate(range(
                max_prefix_length - len(p),
                max_prefix_length)):
            row_idx = dna_nucleotide_to_index[p[i]]
            counts[row_idx, prefix_col_idx] += 1
        for i, suffix_col_idx in enumerate(range(
                max_prefix_length + n_variant_nucleotides,
                max_prefix_length + n_variant_nucleotides + len(s))):
            row_idx = dna_nucleotide_to_index[s[i]]
            counts[row_idx, suffix_col_idx] += 1
    return counts, variant_column_indices
Count the number of times {A, C, T, G} occur at each position to the
    left and right of the variant.

    Parameters
    ----------
    variant_reads : list of AlleleRead objects
        Expected to all contain the same variant allele.

    Returns a tuple with the following elements:
        - a matrix with four rows and as many columns as the sum of the longest
          prefix preceding the variant, the longest suffix after the variant and
          the number of variant nucleotids.
        - the column indices for the variant nucleotides