import re


def replace_chrom_name_in_header(line, name_map):
    """
    Replaces the Chrom name from header.
    Returns new header.

    :param line: line from VCF
    :param name_map: name-mapping dict
    :return: new header line
    """


    old_name = re.split('=|,', line)[2]

    return line.replace(old_name, name_map[old_name])