troutpy.tl.create_urna_metadata#
- troutpy.tl.create_urna_metadata(sdata, layer='transcripts', gene_key='gene', copy=False)#
Create the
"xrna_metadata"table holding the unique genes found in a transcripts layer.- Parameters:
sdata (spatialdata.SpatialData) – The SpatialData object to modify.
layer (str, optional) – Layer in
sdata.pointsfrom which to extract gene names. Defaults to"transcripts".gene_key (str, optional) – Column in
sdata.points[layer]that contains the gene names. Defaults to"gene".copy (bool, optional) – If
True, return a copy of the modified SpatialData object. Defaults toFalse.
- Return type:
- Returns:
spatialdata.SpatialData or None A copy of the modified SpatialData object if
copy=True; otherwisesdatais modified in place (a new"xrna_metadata"table is added) andNoneis returned.- Raises:
ValueError – If
layeris not insdata.points, or ifgene_keyis not a column ofsdata.points[layer].