def write_codes(fn, nmf, bam_names):
    """(internal) Writes codes to file.
    """
    with open(fn, 'wb') as wh:
        wh.write('\t'.join(bam_names) + '\n')
        for row in nmf:
            wh.write('\t'.join(map(str, list(row))) + '\n')
