def contig_to_heat_coord(contig_name, contig_coord, contigs, contigs_index):
    """
    Convert from a contig:position coordinate to a single position.

    Arguments:
    contig_name: name of contig
    contig_coord: position on this contig
    contigs: DataFrame containing all the contigs
    contigs_index: dict mapping contig name to index in DataFrame
    """
    # figure out if this contig is in the index; if it isn't, return None.
    index = contigs_index.get(contig_name)
    if index is None:
        return None

    contig_row = contigs.loc[index]
    if contig_row["orientation"] == "+":
        return contig_row["start"] + contig_coord
    return contig_row["start"] + contig_row["size"] - contig_coord