scparadise.scnoah.oversample

Contents

scparadise.scnoah.oversample#

scparadise.scnoah.oversample(adata, dictionary=None, sample=None, celltype_l1=None, celltype_l2=None, celltype_l3=None, celltype_l4=None, celltype_l5=None, shrinkage=1)[source]#

Oversample some cell types in AnnData object. Returns adata_oversampled with updated matrix and adata_oversampled.obs with given celltypes levels and sample. If you give counts function returns counts. If you give normalized data function returns normalized data.

Parameters:
  • adata (AnnData) – Annotated data matrix. Function uses adata.X for oversample.

  • dictionary (dict, (default: None)) – Dictionary with cell type to be oversampled as key and number of cells you want to get as value. Dictionary should only include cell types from the most detailed level of annotation.

  • sample (str, (default: None)) – Samples names key in adata.obs dataframe.

  • celltype_l1 (str, (default: None)) – First level of cell annotation. Key in adata.obs dataframe.

  • celltype_l2 (str, (default: None)) – Second level of cell annotation. Key in adata.obs dataframe.

  • celltype_l3 (str, (default: None)) – Third level of cell annotation. Key in adata.obs dataframe.

  • celltype_l4 (str, (default: None)) – Forth level of cell annotation. Key in adata.obs dataframe.

  • celltype_l5 (str, (default: None)) – Fifth level of cell annotation. Key in adata.obs dataframe.

  • shrinkage (float, (default: 1.0)) – Parameter controlling the shrinkage applied to the covariance matrix when a smoothed bootstrap is generated.