def write_rep_radius(rep_radius, genomes, out_file):
    """Write out ANI radius for each representative genomes."""
    fout = open(out_file, 'w')
    fout.write(
        """Representative	GTDB species	NCBI species	ANI	AF	Closest species	Closest representative
"""
        )
    for gid in rep_radius:
        ani, af, neighbour_gid = rep_radius[gid]
        if not af:
            af = 0
        if not neighbour_gid or neighbour_gid == 'N/A':
            neighbour_gid = 'N/A'
            neighbour_sp = 'N/A'
        else:
            neighbour_sp = genomes[neighbour_gid].gtdb_taxa.species
        fout.write('%s\t%s\t%s\t%.2f\t%.2f\t%s\t%s\n' % (gid, genomes[gid].
            gtdb_taxa.species, genomes[gid].ncbi_taxa.species, ani, af,
            neighbour_sp, neighbour_gid))
    fout.close()
