troutpy.tl.create_urna_metadata

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.points from 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 to False.

Return type:

SpatialData | None

Returns:

spatialdata.SpatialData or None A copy of the modified SpatialData object if copy=True; otherwise sdata is modified in place (a new "xrna_metadata" table is added) and None is returned.

Raises:

ValueError – If layer is not in sdata.points, or if gene_key is not a column of sdata.points[layer].