def filter_assembly(assembly_file, minimum_coverage, coverage_info, output_file
    ):
    """Generates a filtered assembly file.

    This function generates a filtered assembly file based on an original
    assembly and a minimum coverage threshold.

    Parameters
    ----------
    assembly_file : str
        Path to original assembly file.
    minimum_coverage : int or float
        Minimum coverage required for a contig to pass the filter.
    coverage_info : OrderedDict or dict
        Dictionary containing the coverage information for each contig.
    output_file : str
        Path where the filtered assembly file will be generated.

    """
    write_flag = False
    with open(assembly_file) as fh, open(output_file, 'w') as out_fh:
        for line in fh:
            if line.startswith('>'):
                write_flag = False
                header = line.strip()[1:]
                contig_cov = coverage_info[header]['cov']
                if contig_cov >= minimum_coverage:
                    write_flag = True
                    out_fh.write(line)
            elif write_flag:
                out_fh.write(line)
