Manipulation#

set_obs_names

Sets a column as the new first column of obs, i.e. the obs_names.

set_var_names

Sets a column as the new first column of var, i.e. the var_names.

set_num_threads

Return a new SingleCell dataset with a different default number of threads.

make_obs_names_unique

Make obs_names unique.

make_var_names_unique

Make var_names unique.

filter_obs

Equivalent to df.filter() from polars, but applied to both obs/obsm and X.

filter_var

Equivalent to df.filter() from polars, but applied to both var/varm and X.

select_obs

Equivalent to df.select() from polars, but applied to obs.

select_var

Equivalent to df.select() from polars, but applied to var.

select_obsm

Subsets obsm to the specified key(s).

select_varm

Subsets varm to the specified key(s).

select_obsp

Subsets obsp to the specified key(s).

select_varp

Subsets varp to the specified key(s).

select_uns

Subsets uns to the specified key(s).

with_columns_obs

Equivalent to df.with_columns() from polars, but applied to obs.

with_columns_var

Equivalent to df.with_columns() from polars, but applied to var.

with_obsm

Adds one or more keys to obsm, overwriting existing keys with the same names if present.

with_varm

Adds one or more keys to varm, overwriting existing keys with the same names if present.

with_obsp

Adds one or more keys to obsp, overwriting existing keys with the same names if present.

with_varp

Adds one or more keys to varp, overwriting existing keys with the same names if present.

with_uns

Adds one or more keys to uns, overwriting existing keys with the same names if present.

drop_X

Create a new SingleCell dataset with X removed, to reduce memory use.

drop_obs

Create a new SingleCell dataset with columns and more_columns removed from obs.

drop_var

Create a new SingleCell dataset with columns and more_columns removed from var.

drop_obsm

Create a new SingleCell dataset with keys and more_keys removed from obsm.

drop_varm

Create a new SingleCell dataset with keys and more_keys removed from varm.

drop_obsp

Create a new SingleCell dataset with keys and more_keys removed from obsp.

drop_varp

Create a new SingleCell dataset with keys and more_keys removed from varp.

drop_uns

Create a new SingleCell dataset with keys and more_keys removed from uns.

rename_obs

Create a new SingleCell dataset with column(s) of obs renamed.

rename_var

Create a new SingleCell dataset with column(s) of var renamed.

rename_obsm

Create a new SingleCell dataset with key(s) of obsm renamed.

rename_varm

Create a new SingleCell dataset with key(s) of varm renamed.

rename_obsp

Create a new SingleCell dataset with key(s) of obsp renamed.

rename_varp

Create a new SingleCell dataset with key(s) of varp renamed.

rename_uns

Create a new SingleCell dataset with key(s) of uns renamed.

cast_X

Cast X to the specified data type.

cast_obs

Cast column(s) of obs to the specified data type(s).

cast_var

Cast column(s) of var to the specified data type(s).

join_obs

Left-join obs with another DataFrame.

join_var

Left-join var with another DataFrame.

subsample_obs

Subsample a specific number or fraction of cells.

subsample_var

Subsample a specific number or fraction of genes.

tocsr

Make a copy of this SingleCell dataset, converting X to a csr_array.

tocsc

Make a copy of this SingleCell dataset, converting X to a csc_array.

copy

Make a copy of this SingleCell dataset.

concat_obs

Concatenate one or more other SingleCell datasets with this one, cell-wise.

concat_var

Concatenate one or more other SingleCell datasets with this one, gene-wise.

split_by_obs

The opposite of concat_obs(): splits a SingleCell dataset into a dictionary of SingleCell datasets, one per unique value of a column of obs.

split_by_var

The opposite of concat_var(): splits a SingleCell dataset into a dictionary of SingleCell datasets, one per unique value of a column of var.

pipe

Apply a function to a SingleCell dataset.

pipe_X

Apply a function to a SingleCell dataset's X.

pipe_obs

Apply a function to a SingleCell dataset's obs.

pipe_var

Apply a function to a SingleCell dataset's var.

pipe_obsm

Apply a function to a SingleCell dataset's obsm.

pipe_obsm_key

Apply a function to a specific key in a SingleCell dataset's obsm.

pipe_varm

Apply a function to a SingleCell dataset's varm.

pipe_varm_key

Apply a function to a specific key in a SingleCell dataset's varm.

pipe_obsp

Apply a function to a SingleCell dataset's obsp.

pipe_obsp_key

Apply a function to a specific key in a SingleCell dataset's obsp.

pipe_varp

Apply a function to a SingleCell dataset's varp.

pipe_varp_key

Apply a function to a specific key in a SingleCell dataset's varp.

pipe_uns

Apply a function to a SingleCell dataset's uns.

pipe_uns_key

Apply a function to a specific key in a SingleCell dataset's uns.