troutpy.pp.filter_urna

Contents

troutpy.pp.filter_urna#

troutpy.pp.filter_urna(sdata, min_counts=None, min_extracellular_proportion=None, control_probe=None, min_logfoldratio_over_noise=None, max_p_val_noise=0.05, min_morani=None, gene_key='feature_name', filter_cellular=False, copy=False, genes_in_segmented=False, table_key='table')#

Filter xRNA genes based on quality and significance thresholds, retaining only genes that pass all active criteria.

All threshold parameters are optional; only those explicitly set are applied (AND logic).

Parameters:
  • sdata (spatialdata.SpatialData) – SpatialData object containing xrna_metadata, transcripts, and optionally segmentation_free_table, source_score, and target_score layers.

  • min_counts (int or None, optional) – Minimum total transcript count per gene. Defaults to None (not applied).

  • min_extracellular_proportion (float or None, optional) – Minimum fraction of transcripts classified as extracellular. Defaults to None.

  • control_probe (bool or None, optional) – If False, exclude control probes. Defaults to None (not applied).

  • min_logfoldratio_over_noise (float or None, optional) – Minimum log fold-ratio over the noise baseline. Defaults to None.

  • max_p_val_noise (float or None, optional) – Maximum p-value against the Poisson noise model; genes with p_val_noise >= max_p_val_noise are removed. Defaults to 0.05.

  • min_morani (float or None, optional) – Minimum Moran’s I spatial autocorrelation score. Defaults to None.

  • gene_key (str, optional) – Column in the transcripts layer containing gene identifiers. Defaults to "feature_name".

  • filter_cellular (bool, optional) – If True, also subset the cellular "table" layer to selected genes. Defaults to False.

  • copy (bool, optional) – If True, operate on a copy of sdata and return it. Otherwise modify in place and return None. Defaults to False.

  • genes_in_segmented (bool, optional) – If True, further restrict to genes present in the segmented table layer. Defaults to False.

  • table_key (str, optional) – Key for the segmented cell-by-gene table used when genes_in_segmented=True. Defaults to "table".

Returns:

spatialdata.SpatialData or None Filtered SpatialData object if copy=True; otherwise None.