def write_selection(grs, log):
    """Write the selected SNPs to disk."""
    if len(grs) == 0:
        log.logger.warning(
            'No variant satisfied the provided thresholds (could not generate a GRS).'
            )
        return
    log.logger.info('Writing the file containing the selected {} variants.'
        .format(len(grs)))
    output_filename = log.parameters['OUTPUT_PREFIX'] + '.grs'
    with open(output_filename, 'w') as f:
        grs[0].write_header(f)
        for row in grs:
            row.write(f)
