import pathlib


def check_star_idx_exists(star_idx_dir):
    """ checks to see if all files in star idx are present """

    staridx_files = [
        'chrLength.txt',
        'chrName.txt',
        'Genome',
        'SA',
        'chrNameLength.txt',
        'chrStart.txt',
        'genomeParameters.txt',
        'SAindex'
    ]

    # boolean array
    file_result = []

    for file in staridx_files:

        if pathlib.Path(star_idx_dir).joinpath(file).exists():

            file_result.append(True)

        else:
            file_result.append(False)

    if all(file_result):
        return True

    return False