troutpy.tl.create_urna_metadata

troutpy.tl.create_urna_metadata#

troutpy.tl.create_urna_metadata(sdata, layer='transcripts', gene_key='gene', copy=False)#

Creates a new table within the SpatialData object that contains a ‘gene’ column with the unique gene names extracted from the specified points layer.

Parameters:
  • sdata (spatialdata.SpatialData) – The SpatialData object to modify.

  • layer (str) – The name of the layer in sdata.points from which to extract gene names. Default is ‘transcripts’.

  • gene_key (str) – The key in the layer dataframe that contains the gene names.Default is ‘gene’.

  • copy (bool (default: False)) – If True, returns a copy of the spatialdata.SpatialData object with the new table added.

Return type:

SpatialData | None

Returns:

SpatialData | None If copy is True, returns a copy of the modified spatialdata.SpatialData object. Otherwise, returns None.