API

Contents

API#

Preprocessing#

pp.xenium_converter(sdata[, copy, ...])

Convert a 10x Xenium SpatialData object's transcripts and table to the troutpy-expected format.

pp.cosmx_converter(sdata[, copy_data])

Convert a CosMx multi-FOV SpatialData object into a unified single-coordinate-system object.

pp.create_grid_squares(sdata[, layer, ...])

Generate a grid of square polygons covering the transcript space.

pp.aggregate_urna(sdata[, layer, gene_key, ...])

Aggregate urna transcript counts into a grid of squares.

pp.compute_extracellular_counts(data_extracell)

Compute observed and expected transcript counts, log fold-ratio over baseline, and codeword category per gene for extracellular transcripts.

pp.define_urna(sdata[, layer, method, ...])

Identify extracellular RNA (uRNA) transcripts by classifying each transcript based on the specified segmentation method.

pp.define_urna_probability(sdata[, ...])

Classify transcripts as extracellular (uRNA) via a Bayesian probability from grid-interpolated KDEs.

pp.define_urna_probability_stainings(sdata)

Classify transcripts as extracellular (uRNA) from image-staining intensity similarity.

pp.get_transcript_categories(sdata[, layer, ...])

Classify transcripts into a hierarchy of intracellular/extracellular categories.

pp.filter_urna(sdata[, min_counts, ...])

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

pp.segmentation_free_sainsc(sdata[, ...])

Assign a per-bin cell type and uRNA probability via SAiNSC segmentation-free analysis.

pp.find_optimal_segmentation_free_bin_size(sdata)

Find the optimal bin size for transcript aggregation by maximizing separability between intracellular and extracellular gene signatures.

pp.add_morphological_metrics(sdata[, ...])

Extract cell morphology metrics from a labels layer and add them to sdata.table.obs.

pp.format_adata(input_path, outpath_dummy, ...)

Processes and formats AnnData and transcripts by loading data, merging cell information,applying spatial filters, and saving the processed data to a dummy output directory.