crested.pp.filter_regions_on_specificity#
- crested.pp.filter_regions_on_specificity(adata, gini_std_threshold=1.0, model_name=None, inplace=True)#
Filter bed regions & targets/predictions based on high Gini score.
This function filters regions based on their specificity using Gini scores. The regions with high Gini scores are retained. If model_name is provided, will look for the corresponding predictions in the adata.layers[model_name] layer. Else, it will use the values in adata.X to decide which regions to keep. To get an idea for the impact of different possible
gini_std_thresholdvalues, seefilter_cutoff().- Parameters:
adata (
AnnData) – The AnnData object containing the matrix (celltypes, regions) to be filtered.gini_std_threshold (
float(default:1.0)) – The number of standard deviations above the mean Gini score used to determine the threshold for high variability.model_name (
str|None(default:None)) – The name of the model to look for in adata.layers[model_name] for predictions. If None or ‘truth’/’groundtruth’/’X’, will use the values in adata.X to select specific regions.inplace (
bool(default:True)) – Perform computation and modifyadatain-place or return a resulting copy of theadatainstead.
- Return type:
- Returns:
If
inplace=True(default), returns nothing and modifies the AnnData in-place with the filtered matrix and updated variable names. Ifinplace=False, returns a modified copy of the AnnData object instead.
See also
Example
>>> crested.pp.filter_regions_on_specificity( ... adata, ... gini_std_threshold=1.0, ... )