BAITS.st.tl.kde_filter#
- BAITS.st.tl.kde_filter(adata_sample, score_name, threshold_method='percentile', custom_threshold=90, high_binSize=100, default_thread_num=36, clean_mask_size=(3, 3), plot=True, figsize=(16, 4), spot_size=50)#
Filter spatial transcriptomics (ST) data using Kernel Density Estimation (KDE).
- Parameters:
adata_tmp (AnnData object) – The input AnnData object containing spatial and score data.
score_name (str) – The name of the column in
adata_tmp.obsthat contains the scores to be used as weights.threshold_method (str) – Method for determining the density cutoff threshold. Available options: - ‘mean’: Use arithmetic mean of density values - ‘median’: Use median density value, robust to outliers - ‘percentile’: Use specified percentile of density distribution - ‘custom’: Use user-provided custom threshold value
custom_threshold (float, optional (default=None)) – Custom threshold value when
threshold_method='custom', or percentile value whenthreshold_method='percentile'. For percentile method, values should be between 0 and 100.high_binSize (int, optional (default: 100)) – The size of the bins used for spatial discretization.
default_thread_num (int, optional (default: 36)) – The maximum number of threads to use for parallel KDE scoring.
clean_mask_size (tuple of int, optional (default: (3, 3))) – The size of the structuring element used for binary opening during mask cleaning.
plot (bool, optional (default=True)) – If True, automatically generates visualization of filtered results.
figsize (tuple of float, optional (default=(16, 4))) – Figure dimensions (width, height) in inches for the generated visualization. Only applicable when
plot=True.spot_size (float (default=50)) – Size of the scatter point/shape
- Returns:
The annotated AnnData object.
- Return type:
AnnData