Please, help me. This is my current code:


def check(ref: str, query: str) -> None:
    """
    Check if the necessary directories and files exist.
    The current implementation expects specific directory
    structures for the --reference and --query species.

    Parameters
    ----------
    ref : str
        Reference species identifier.
    query : str
        Query species identifier.

    Returns
    -------
    NoReturn

    Example
    -------
    >>> check()

    Notes
    -----
    The current implementation expects the following directory structure:

    pisco/
    |-- assets (already checked at the beginning of the run.py)
        |-- {ref}.bed [available options: hg38.bed, mm10.bed, galGal6.bed]

    user/
    |-- /user/path/{ref} -> represented by Const.FILES
            |-- genome
                |- {ref}.fa
            |-- lastz
                |- vs_{query}
                    |- axtChain
                        |- *.chain.gz
            |-- TOGA
                |- vs_{query}
                    |- not empty
    """
    # logfile = open(Const.LOGFILE, "a").close()
    with open(Const.LOGFILE, "a") as logfile:
        logfile.write("\n")
        logfile.write("=" * 80)
        logfile.write("\n")
        logfile.write("\t\t\t\t\t\t\tP I S C O    P I P E L I N E")
        logfile.write("\n\n")
        logfile.write("\t\t\tResolving phylogenies using large INDELs and high-confidence orthologs\n\n")
        logfile.write("For any bug/report please contact: github/hillerlab/pisco\n")
        logfile.write("=" * 80)
        logfile.write("\n")
        logfile.write("\n")

    if not Const.ASSETS.joinpath(f"{ref}.bed").exists():
        raise FileNotFoundError(
            f"""
            {Const.ASSETS.joinpath(f'{ref}.bed')} does not exist. 
            Please clone the repository again or add your reference 
            .bed manually.
            """
        )
        sys.exit(1)

    if not Const.FILES.exists():
        raise FileNotFoundError(f"ERROR: {Const.FILES} does not exist.")
        sys.exit(1)
    elif not Const.FILES.joinpath(ref).exists():
        raise FileNotFoundError(f"ERROR: {Const.FILES.joinpath(ref)} does not exist.")
        sys.exit(1)

    # Ref fasta component checker block
    if not Const.FILES.joinpath(ref, "genome").exists():
        raise FileNotFoundError(
            f"ERROR: {Const.FILES.joinpath(ref, 'genome')} does not exist."
        )
        sys.exit(1)
    elif not Const.FILES.joinpath(ref, "genome", f"{ref}.2bit").exists():
        raise FileNotFoundError(
            f"ERROR: {Const.FILES.joinpath(ref, 'genome', f'{ref}.2bit')} does not exist. Please provide a fasta file."
        )
        sys.exit(1)

    for q in query.split(","):
        # Lastz component checker block
        if not Const.FILES.joinpath(ref, "lastz", f"vs_{q}", "axtChain").glob(
            "*.chain.gz"
        ):
            raise FileNotFoundError(
                f"ERROR: {Const.FILES.joinpath(ref, 'lastz', f'vs_{q}', 'axtChain')} does not contain any chain files."
            )
            sys.exit(1)

        # TOGA component checker block
        if not Const.FILES.joinpath(ref, "TOGA", f"vs_{q}").exists():
            raise FileNotFoundError(
                f"ERROR: {Const.FILES.joinpath(ref, 'TOGA', f'vs_{q}')} does not exist."
            )
            sys.exit(1)
        elif not list(Const.FILES.joinpath(ref, "TOGA", f"vs_{q}").glob("*")):
            raise FileNotFoundError(
                f"ERROR: {Const.FILES.joinpath(ref, 'TOGA', f'vs_{q}')} is empty."
            )
            sys.exit(1)

    log("INFO: All necessary directories and files exist. Continuing...", Const.LOGFILE)
    return None


def confirm(ref: str, query: str) -> bool:
    """
    Confirm that the necessary directories and files have been
    created after the first pre-processing step.

    Parameters
    ----------
    query : str
        Query species identifier.

    Returns
    -------
    bool
        Returns True if the necessary directories and files exist.

    Example
    -------
    >>> confirm('GRCg6a')

    Notes
    -----
    The current implementation expects the following directory structure:

    pisco/
    |-- work
        |-- {query/ref}
            |-- {query}.chain_ids
            |-- {query}.chain.bin
            |-- {query}.chrom.sizes
            |-- chromseqs
                    |-- *.fa
    """
    species = query.split(",") + [ref]

    for s in species:
        if not Const.SPECIES.joinpath(s).exists():
            raise FileNotFoundError(
                f"ERROR: {Const.SPECIES.joinpath(s)} does not exist."
            )
            return False
        elif not Const.SPECIES.joinpath(s, "chromseqs").exists():
            raise FileNotFoundError(
                f"ERROR: {Const.SPECIES.joinpath(s, 'chromseqs')} does not exist."
            )
            return False
        elif not list(Const.SPECIES.joinpath(s, "chromseqs").glob("*.fa")):
            raise FileNotFoundError(
                f"ERROR: {Const.SPECIES.joinpath(s, 'chromseqs')} does not contain any fasta files."
            )
            return False

        if s != ref:
            if not Const.SPECIES.joinpath(s, f"{s}.chain_ids").exists():
                raise FileNotFoundError(
                    f"ERROR: {Const.SPECIES.joinpath(s, f'{s}.chain_ids')} does not exist."
                )
                return False
            elif not Const.SPECIES.joinpath(s, f"{s}.chain.bin").exists():
                raise FileNotFoundError(
                    f"ERROR: {Const.SPECIES.joinpath(s, f'{s}.chain.bin')} does not exist."
                )
                return False

        if not Const.SPECIES.joinpath(s, f"{s}.chrom.sizes").exists():
            raise FileNotFoundError(
                f"ERROR: {Const.SPECIES.joinpath(s, f'{s}.chrom.sizes')} does not exist."
            )
            return False

    if (
        not Const.FILES.joinpath(ref, "genome", f"{ref}.fa").exists()
        and not Const.FILES.joinpath(ref, "genome", f"{ref}.fa.gz").exists()
        and not Const.FILES.joinpath(ref, "genome", f"{ref}.fasta").exists()
    ):
        raise FileNotFoundError(
            f"ERROR: {Const.FILES.joinpath(ref, 'fasta', f'{ref}.fa/fa.gz/fasta')} does not exist. Please provide a fasta file."
        )
        sys.exit(1)


    log(
        "INFO: All necessary post-processed directories and files exist. Continuing...",
        Const.LOGFILE,
    )
    return True

My goal is to make this a class call PiscoChecker with each of this functions as methods. This methods will just need to be called as PiscoChecker.check() or something. Also please help me reformatting the code, maybe that does not look elegant or efficient. Do no add more dependencies, just make it fast, efficient and elegant. Here is an example of what I am thinking could be considered better looking:

    @staticmethod
    def check_completeness(toga_cls):
        """Check if all modules are presented."""
        files_must_be = [
            toga_cls.CONFIGURE_SCRIPT,
            toga_cls.CHAIN_BDB_INDEX,
            toga_cls.BED_BDB_INDEX,
            toga_cls.SPLIT_CHAIN_JOBS,
            toga_cls.MERGE_CHAINS_OUTPUT,
            toga_cls.CLASSIFY_CHAINS,
            toga_cls.SPLIT_EXON_REALIGN_JOBS,
            toga_cls.MERGE_CESAR_OUTPUT,
            toga_cls.GENE_LOSS_SUMMARY,
            toga_cls.ORTHOLOGY_TYPE_MAP,
        ]
        for _file in files_must_be:
            if os.path.isfile(_file):
                continue
            toga_cls.die(f"Error! File {_file} not found!")

Provide the complete implementation