Manipulation#

Pseudobulk.set_obs_names

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

Pseudobulk.set_var_names

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

Pseudobulk.set_num_threads

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

Pseudobulk.filter_obs

Equivalent to df.filter() from polars, but applied to both obs and X for each cell type.

Pseudobulk.filter_var

Equivalent to df.filter() from polars, but applied to both var and X for each cell type.

Pseudobulk.select_obs

Equivalent to df.select() from polars, but applied to each cell type's obs.

Pseudobulk.select_var

Equivalent to df.select() from polars, but applied to each cell type's var.

Pseudobulk.select_cell_types

Create a new Pseudobulk dataset subset to the cell type(s) in cell_types and more_cell_types.

Pseudobulk.with_columns_obs

Equivalent to df.with_columns() from polars, but applied to each cell type's obs.

Pseudobulk.with_columns_var

Equivalent to df.with_columns() from polars, but applied to each cell type's var.

Pseudobulk.drop_obs

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

Pseudobulk.drop_var

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

Pseudobulk.drop_cell_types

Create a new Pseudobulk dataset with cell_types and more_cell_types removed.

Pseudobulk.rename_obs

Create a new Pseudobulk dataset with column(s) of obs renamed for each cell type.

Pseudobulk.rename_var

Create a new Pseudobulk dataset with column(s) of var renamed for each cell type.

Pseudobulk.rename_cell_types

Create a new Pseudobulk dataset with cell type(s) renamed.

Pseudobulk.cast_X

Cast each cell type's X to the specified data type.

Pseudobulk.cast_obs

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

Pseudobulk.cast_var

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

Pseudobulk.join_obs

Left-join each cell type's obs with another DataFrame, using the same logic as polars.DataFrame.join().

Pseudobulk.join_var

Left-join each cell type's obs with another DataFrame, using the same logic as polars.DataFrame.join().

Pseudobulk.subsample_obs

Subsample a specific number or fraction of samples.

Pseudobulk.subsample_var

Subsample a specific number or fraction of genes.

Pseudobulk.split_by_cell_type

Split this Pseudobulk dataset into a tuple of Pseudobulk datasets with one cell type each.

Pseudobulk.concat_obs

Concatenate one or more other Pseudobulk datasets with this one, sample-wise.

Pseudobulk.concat_var

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