troutpy.tl.extracellular_enrichment#
- troutpy.tl.extracellular_enrichment(sdata, gene_key='gene', copy=False, layer='transcripts')#
Computes the proportion of transcripts classified as extracellular or intracellular for each gene and calculates additional metrics, including log fold change of extracellular to intracellular proportions. The results are integrated into the
sdataobject under the ‘xrna_metadata’ layer.- Parameters:
sdata (
SpatialData) – An spatialData object containing spatial transcriptomics data. Thepointsattribute should include a ‘transcripts’ DataFrame with columns for gene IDs (specified bygene_key) and a boolean ‘extracellular’ column indicating whether each transcript is classified as extracellular.gene_key (
str(default:'gene')) – The name of the column in the ‘transcripts’ DataFrame containing gene identifiers. Defaults to ‘gene’.copy (
bool(default:False)) – Whether to return a modified copy of the inputsdataobject. IfFalse, the input object is modified in place. Defaults toFalse.
- Returns:
If
copy=True, returns a modified copy of the inputsdataobject with updated metadata. Otherwise, modifiessdatain place and returnsNone.
Notes
The function assumes that the
sdataobject has a ‘points’ layer containing a ‘transcripts’ DataFrame.If the ‘xrna_metadata’ attribute does not exist in
sdata, it will be created using thecreate_urna_metadatafunction.