harpy.tb.correct_marker_genes

harpy.tb.correct_marker_genes#

harpy.tb.correct_marker_genes(sdata, labels_name, table_name, output_table_name, celltype_correction_dict, overwrite=False)#

Correct celltype expression in sdata.tables[table_name] using celltype_correction_dict.

Corrects celltype scores (found in .obs attribute of the AnnData table) that are higher expessed by dividing them by a value if they exceed a certain threshold. The celltype_correction_dict has as keys the celltypes that should be corrected and as values the threshold and the divider.

Deprecated since version 0.3.0: harpy.tb.correct_marker_genes is deprecated and may be removed in a future release.

Parameters:
  • sdata (SpatialData) – The SpatialData object.

  • labels_name (list[str]) – The labels element(s) of sdata used to select the cells via the region key in sdata.tables[table_name].obs. Note that if output_table_name is equal to table_name and overwrite is True, cells in sdata.tables[table_name] linked to other labels_name (via the region key), will be removed from sdata.tables[table_name] (also from the backing Zarr store if it is backed).

  • table_name (str) – The table element in sdata.

  • output_table_name (str) – The output table element in sdata.

  • celltype_correction_dict (dict[str, tuple[float, float]]) – The celltype_correction_dict has as keys the celltypes that should be corrected and as values the threshold and the divider.

Return type:

SpatialData

Returns:

: The updated SpatialData object.

See also

harpy.tb.score_genes

score genes using score_genes().