Data Preparation Functions

Load User Files

Validate meta DataFrame

cellphonedb.src.core.preprocessors.method_preprocessors.meta_preprocessor(meta_raw: DataFrame) DataFrame[source]

Re-formats meta_raw if need be to ensure correct columns and indexes are present

Parameters:

meta_raw (pd.DataFrame) – A DataFrame containing a mapping between cells and cell types.

Returns:

meta DataFrame containing columns and indexes as expected by the analysis methods

Return type:

pd.DataFrame

Validate counts DataFrame

cellphonedb.src.core.preprocessors.counts_preprocessors.counts_preprocessor(counts: DataFrame, meta: DataFrame) DataFrame[source]

Ensure that counts values are of type float32, and that all cells in meta exist in counts

Parameters:
  • counts (pd.DataFrame) – Counts data

  • meta (pd.DataFrame) – Meta data (a mapping between cells and cell types)

Returns:

counts DataFrame in which counts values are of type float32 and all cells in meta are present

Return type:

pd.DataFrame

Subsample the counts data