# Path: scib/utils.py
# def check_adata(adata):
#     if type(adata) is not anndata.AnnData:
#         raise TypeError('Input is not a valid AnnData object')
# 
# def check_batch(batch, obs, verbose=False):
#     if batch not in obs:
#         raise ValueError(f'column {batch} is not in obs')
#     elif verbose:
#         print(f'Object contains {obs[batch].nunique()} batches.')


import itertools
import logging
import multiprocessing as mp
import os
import pathlib
import subprocess
import tempfile
import anndata2ri
import numpy as np
import pandas as pd
import rpy2.rinterface_lib.callbacks
import rpy2.robjects as ro
import scanpy as sc
import scipy.sparse
from scipy.io import mmwrite
from ..utils import check_adata, check_batch
        batch_key,
        label_key,
        k0=90,
        type_=None,
        subsample=None,
        scale=True,
        multiprocessing=None,
        nodes=None,
        verbose=False
):
    """
    Compute cLISI score adapted from Harmony paper (Korsunsky et al, Nat Meth, 2019)

    :params adata: adata object to calculate on
    :param batch_key: batch column name in adata.obs
    :param label_key: label column name in adata.obs
    :param k0: number of nearest neighbors to compute lisi score
        Please note that the initial neighborhood size that is
        used to compute shortest paths is 15.
    :param type_: type of data integration, either knn, full or embed
    :param subsample: Percentage of observations (integer between 0 and 100)
        to which lisi scoring should be subsampled
    :param scale: scale output values between 0 and 1 (True/False)
    :param multiprocessing: parallel computation of LISI scores, if None, no parallisation
        via multiprocessing is performed
    :param nodes: number of nodes (i.e. CPUs to use for multiprocessing); ignored, if
        multiprocessing is set to None
    :return: Median of cLISI score
    """


# Path: scib/utils.py
# def check_adata(adata):
#     if type(adata) is not anndata.AnnData:
#         raise TypeError('Input is not a valid AnnData object')
# 
# def check_batch(batch, obs, verbose=False):
#     if batch not in obs:
#         raise ValueError(f'column {batch} is not in obs')
#     elif verbose:
#         print(f'Object contains {obs[batch].nunique()} batches.')


# Path: scib/metrics/lisi.py
import itertools
import logging
import multiprocessing as mp
import os
import pathlib
import subprocess
import tempfile
import anndata2ri
import numpy as np
import pandas as pd
import rpy2.rinterface_lib.callbacks
import rpy2.robjects as ro
import scanpy as sc
import scipy.sparse
from scipy.io import mmwrite
from ..utils import check_adata, check_batch

        batch_key,
        label_key,
        k0=90,
        type_=None,
        subsample=None,
        scale=True,
        multiprocessing=None,
        nodes=None,
        verbose=False
):
    """
    Compute cLISI score adapted from Harmony paper (Korsunsky et al, Nat Meth, 2019)

    :params adata: adata object to calculate on
    :param batch_key: batch column name in adata.obs
    :param label_key: label column name in adata.obs
    :param k0: number of nearest neighbors to compute lisi score
        Please note that the initial neighborhood size that is
        used to compute shortest paths is 15.
    :param type_: type of data integration, either knn, full or embed
    :param subsample: Percentage of observations (integer between 0 and 100)
        to which lisi scoring should be subsampled
    :param scale: scale output values between 0 and 1 (True/False)
    :param multiprocessing: parallel computation of LISI scores, if None, no parallisation
        via multiprocessing is performed
    :param nodes: number of nodes (i.e. CPUs to use for multiprocessing); ignored, if
        multiprocessing is set to None
    :return: Median of cLISI score
    """


    check_adata(adata)