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

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

    # split on whitespace THEN ':',
    # bc not all VCF will have the source_file:Chrom_Name structure
    old_name = line.split()[0].split(':')[-1]
    fields_not_first = line.split()[1:]
    new_name = name_map[old_name]
    new_line = "%s\t%s\n" % (new_name, '\t'.join(fields_not_first))

    return new_line