MalignantClassifier#

class MalignantClassifier(adata, sample_key='sample', cell_type_key='cell_type', cell_of_origin=None, sample_type_key='sample_type', outdir=None)#

Bases: object

Malignant cell classifier.

Parameters:
  • adata (anndata.AnnData) – Anndata object used as input for SwiftCNV

  • sample_key (str, default 'sample') – Column in adata.obs defining sample identifiers.

  • cell_type_key (str, default 'cell_type') – Key of the obs layer where cell annotations are stored.

  • cell_of_origin (str or list, default None) – Cell type(s) of origin of the tumor cells.

  • sample_type_key (str, default 'sample_type') – Column in adata.obs where sample type is defined (either “normal” or “tumor”).

  • outdir (str, default None) – Path where the output files will be stored.

run_classification(n_jobs=2, embedding_key='X_umap', report=True, verbose=True)#

Wrapper function to run malignant classification.

Parameters:
  • n_jobs (int, default=2) – Number of parallel jobs/threads to use.

  • embedding_key (str, default='X_umap') – Key in adata.obsm representing the lower-dimensional embedding space used for KNN classification.

  • report (bool, default=True) – Whether to generate and save PDF visual reports, including chromosome arm CNV plots and sample-level heatmaps.

  • verbose (bool, default=True) – If True, sets the logger output level to logging.INFO. If False, sets it to logging.WARNING.

Returns:

The updated AnnData object (self.adata) containing classification results.

Return type:

anndata.AnnData