def build_database_sortmerna(fasta_path,
                             max_pos=None,
                             output_dir=None,
                             temp_dir=tempfile.gettempdir(),
                             HALT_EXEC=False):
    if fasta_path is None:
        raise ValueError("Error: path to fasta reference "
                         "sequences must exist.")
    fasta_dir, fasta_filename = split(fasta_path)
    if not output_dir:
        output_dir = fasta_dir or '.'
        fasta_path = fasta_filename
    index_basename = splitext(fasta_filename)[0]
    db_name = join(output_dir, index_basename)
    sdb = IndexDB(WorkingDir=output_dir, HALT_EXEC=HALT_EXEC)
    sdb.Parameters['--ref'].on("%s,%s" % (fasta_path, db_name))
    sdb.Parameters['--tmpdir'].on(temp_dir)
    if max_pos is not None:
        sdb.Parameters['--max_pos'].on(max_pos)
    app_result = sdb()
    db_filepaths = [v.name for k, v in app_result.items()
                    if k not in {'StdErr', 'StdOut'} and hasattr(v, 'name')]
    return db_name, db_filepaths