def remove_artifacts_from_biom_table(table_filename,
                                     fasta_filename,
                                     ref_fp,
                                     biom_table_dir,
                                     ref_db_fp,
                                     threads=1,
                                     verbose=False,
                                     sim_thresh=None,
                                     coverage_thresh=None):
    logger = logging.getLogger(__name__)
    logger.info('getting 16s sequences from the biom table')
    clean_fp, num_seqs_left, tmp_files = remove_artifacts_seqs(fasta_filename, ref_fp,
                                                               working_dir=biom_table_dir,
                                                               ref_db_fp=ref_db_fp,
                                                               negate=False, threads=threads,
                                                               verbose=verbose,
                                                               sim_thresh=sim_thresh,
                                                               coverage_thresh=coverage_thresh)
    if clean_fp is None:
        logger.warn("No clean sequences in %s" % fasta_filename)
        return tmp_files
    logger.debug('removed artifacts from sequences input %s'
                 ' to output %s' % (fasta_filename, clean_fp))
    good_seqs = {s for _, s in sequence_generator(clean_fp)}
    logger.debug('loaded %d sequences from cleaned biom table'
                 ' fasta file' % len(good_seqs))
    logger.debug('loading biom table %s' % table_filename)
    table = load_table(table_filename)
    artifact_table = table.filter(list(good_seqs),
                                  axis='observation', inplace=False,
                                  invert=True)
    filter_minreads_samples_from_table(artifact_table)
    output_nomatch_fp = join(biom_table_dir, 'reference-non-hit.biom')
    write_biom_table(artifact_table, output_nomatch_fp)
    logger.info('wrote artifact only filtered biom table to %s'
                % output_nomatch_fp)
    output_nomatch_fasta_fp = join(biom_table_dir, 'reference-non-hit.seqs.fa')
    fasta_from_biom(artifact_table, output_nomatch_fasta_fp)
    table.filter(list(good_seqs), axis='observation')
    filter_minreads_samples_from_table(table)
    output_fp = join(biom_table_dir, 'reference-hit.biom')
    write_biom_table(table, output_fp)
    logger.info('wrote 16s filtered biom table to %s' % output_fp)
    output_match_fasta_fp = join(biom_table_dir, 'reference-hit.seqs.fa')
    fasta_from_biom(table, output_match_fasta_fp)
    tmp_files.append(clean_fp)
    return tmp_files