sparrow.tb.correct_marker_genes#
- sparrow.tb.correct_marker_genes(sdata, labels_layer, table_layer, output_layer, celltype_correction_dict, overwrite=False)#
Correct celltype expression in
sdata.tables[table_layer]usingcelltype_correction_dict.Corrects celltypes that are higher expessed by dividing them by a value if they exceed a certain threshold. The
celltype_correction_dicthas as keys the celltypes that should be corrected and as values the threshold and the divider.- Parameters:
sdata (
SpatialData) – The SpatialData object.labels_layer (
list[str]) – The labels layer(s) ofsdataused to select the cells via the _REGION_KEY insdata.tables[table_layer].obs. Note that ifoutput_layeris equal totable_layerand overwrite is True, cells insdata.tables[table_layer]linked to otherlabels_layer(via the _REGION_KEY), will be removed fromsdata.tables[table_layer](also from the backing zarr store if it is backed).table_layer (
str) – The table layer insdata.output_layer (
str) – The output table layer insdata.celltype_correction_dict (
dict[str,tuple[float,float]]) – Thecelltype_correction_dicthas as keys the celltypes that should be corrected and as values the threshold and the divider.
- Return type:
SpatialData- Returns:
: The updated SpatialData object.