module util

Global Variables

  • TYPE_CHECKING
  • GPU_MEMORY_LIMIT
  • GPU_MEMORY_USAGE

function filter_cells

filter_cells(adata, qc_var, min_count, max_count)

Cell filtering according to min and max gene counts.

Note:

filter_cells in rsc doesn't support filter out cells by min and max counts at the same time. a modification is made here for dealing with both together.


function svd_flip

svd_flip(pcs)

Flip the signs of loading according to sign(max(abs(loadings))).

Note: this function is used to match up scanpy's results of PCA.

Args:

  • pcs (:obj:np.ndarray|cp.ndarray): PC loadings.

Returns:

  • pcs_adjusted (:obj:np.ndarray|cp.ndarray): Flipped loadings.

function check_dtype

check_dtype(adata)

Convert dtype to float32 or float64.

Note:

rapids-singlecell doesn't support sparse matrix under float16.


function gc

gc()

Release CPU and GPU RAM


function get_mean_var

get_mean_var(X, axis=0)

Calculating mean and variance of a given matrix based on customized kernels.

Note:

No such methods implemented yet for csr_matrix.


function check_nonnegative_integers

check_nonnegative_integers(X)

Check if X is a nonnegative integer matrix.

Note:

Check values of data to ensure it is count data.


function harmony

harmony(
    adata,
    key,
    basis='X_pca',
    adjusted_basis='X_pca_harmony',
    init_seeds=None,
    n_init=1,
    dtype=<class 'numpy.float32'>,
    max_iter_harmony=10,
    random_state=0,
    **kwargs
)

Harmony GPU version.


function correct_leiden

correct_leiden(adata)

function find_indices

find_indices(A, indptr, out_rows)

function csr_indptr_to_coo_rows

csr_indptr_to_coo_rows(nnz, Bp)

function csr_row_index

csr_row_index(Ax, Aj, Ap, rows)

Populate indices and data arrays from the given row index.

Args:

  • Ax (cupy.ndarray): data array from input sparse matrix
  • Aj (cupy.ndarray): indices array from input sparse matrix
  • Ap (cupy.ndarray): indptr array from input sparse matrix
  • rows (cupy.ndarray): index array of rows to populate

Returns:

  • Bx (cupy.ndarray): data array of output sparse matrix
  • Bj (cupy.ndarray): indices array of output sparse matrix
  • Bp (cupy.ndarray): indptr array for output sparse matrix

function csr_col_index

csr_col_index(Ax, Aj, Ai, cols, shape)

function write_to_disk

write_to_disk(adata, output_dir, data_name, batch_name=None)

class AnnDataBatchReader

Chunked dataloader for extremely large single-cell dataset. Return a data chunk each time for further processing.

method __init__

__init__(
    data_dir,
    preload_on_cpu=True,
    preload_on_gpu=False,
    gpus=None,
    max_cell_batch=100000,
    max_gpu_memory_usage=48.0,
    return_anndata=True
)

property shape


method batch_to_CPU

batch_to_CPU()

method batch_to_GPU

batch_to_GPU()

method batchify

batchify(axis='cell')

Return a data generator if preload_on_cpu is set as True.


method clear

clear()

method get_merged_adata_with_X

get_merged_adata_with_X()

method gpu_wrapper

gpu_wrapper(generator)

method read

read(fname)

method set_cells_filter

set_cells_filter(filter, update=True)

Update cells filter and applied on data chunks if update set to True, otherwise, update filter only.


method set_genes_filter

set_genes_filter(filter, update=True)

Update genes filter and applied on data chunks if update set to True, otherwise, update filter only.

Note:

Genes filter can be set sequentially, a new filter should be always compatible with the previous filtered data.


method update_by_cells_filter

update_by_cells_filter(filter)

method update_by_genes_filter

update_by_genes_filter(filter)

This file was automatically generated via lazydocs.