troutpy.tl.extracellular_enrichment#
- troutpy.tl.extracellular_enrichment(sdata, gene_key='gene', copy=False, layer='transcripts')#
Compute the proportion of extracellular vs. intracellular transcripts per gene.
For each gene, calculates the proportion of transcripts classified as extracellular and intracellular, the fold ratio between the two, and its log fold change. Results are stored as new columns in
sdata["xrna_metadata"].var.- Parameters:
sdata (
SpatialData) – SpatialData object.sdata.points[layer]must contain a gene identifier column (gene_key) and a booleanextracellularcolumn.gene_key (
str(default:'gene')) – Column insdata.points[layer]containing gene identifiers.copy (
bool(default:False)) – IfTrue, return a modified copy ofsdata. Otherwise modify in place.layer (
str(default:'transcripts')) – Key of the points element insdatacontaining the transcripts.
- Return type:
- Returns:
If
copy=True, a modified copy ofsdata. OtherwiseNone, modifyingsdatain place.
Notes
If
sdata["xrna_metadata"]does not exist, it is created viacreate_urna_metadata().