Get list of PDB codes stored in a folder (FileSystem folder hierarchy expected within data_dir).

    If no folder is specified, use the database_dir defined in settings.json.

    Parameters
    ----------
    data_dir: str
        Filepath to a folder containing the PDB folder hierarchy (eg data_dir/eb/2ebo)

    Returns
    -------
    pdb_code_list : list(str)
        PDB codes present in data_dir.

def local_pdb_codes(data_dir=None):
    """ Get list of PDB codes stored in a folder (FileSystem folder hierarchy expected within data_dir).

    If no folder is specified, use the database_dir defined in settings.json.

    Parameters
    ----------
    data_dir: str
        Filepath to a folder containing the PDB folder hierarchy (eg data_dir/eb/2ebo)

    Returns
    -------
    pdb_code_list : list(str)
        PDB codes present in data_dir.

    """
    if not data_dir:
        data_dir = global_settings["structural_database"]["path"]
    p = Path(data_dir)
    pdb_parent_dirs = [x for x in p.iterdir() if x.is_dir() and len(x.parts[-1]) == 2]
    pdb_folders = [x for test in pdb_parent_dirs for x in test.iterdir() if x.is_dir()]
    pdb_code_list = [x.parts[-1] for x in pdb_folders if len(x.parts[-1]) == 4]
    return pdb_code_list