mosaicmpi.dataset.Dataset.from_df

mosaicmpi.dataset.Dataset.from_df#

classmethod Dataset.from_df(data: DataFrame, is_normalized: bool, sparsify: bool = False, obs: DataFrame | None = None, var: DataFrame | None = None, patient_id_col: str | None = None)#

Creates a Dataset object from a pandas DataFrame.

Parameters:
  • data (pd.DataFrame) – An observations × features data

  • is_normalized (bool) – Specify if data is already normalized or whether not. Raw data will be TPM normalized prior to HVF selection, whereas already normalized data will not.

  • sparsify (bool, optional) – Store data as a sparse matrix. [Note that this feature is experimental], defaults to False

  • obs (pd.DataFrame, optional) – An observations × metadata matrix, defaults to None

  • var (pd.DataFrame, optional) – A features × metadata matrix, defaults to None

  • patient_id_col (str, optional) – Name of metadata layer with patient ID information, defaults to None

Returns:

Object with expression and metadata

Return type:

Dataset