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_dict
has 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) ofsdata
used to select the cells via the _REGION_KEY insdata.tables[table_layer].obs
. Note that ifoutput_layer
is equal totable_layer
and 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_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.