Skip to contents

Calculate fraction of transcripts in cells from spatial transcriptomic data.

Usage

getCellTxFraction(
  seu_obj = NULL,
  features = NULL,
  tx_file = "path_to_tx",
  platform = NULL
)

Arguments

seu_obj

A Seurat object containing spatial transcriptomics data, expected to include metadata fields for path and platform to facilitate reading transcript metadata with readTxMeta.

features

An optional vector of gene identifiers for which to calculate the transcript fraction. If NULL, the calculation is performed using all available features in the dataset.

tx_file

Path to transcription file.

platform

The platform from which the data originates. Valid options are 'Xenium', 'CosMx', and 'Merscope'.

path

path

Value

A data frame containing the calculated fraction of transcripts in cells, along with sample_id and platform for context. This output provides insight into the efficiency of transcript capture and assignment within the given dataset.

A data frame with probe type (Gene or Control), the mean expression values, and the associated sample and platform identifiers.

Details

The function works by reading transcript metadata for the given sample and platform, then filtering for the specified features (if any). For each platform, it identifies transcripts that are not assigned to any cell ('UNASSIGNED' for Xenium, 'None' for CosMx, etc.) and calculates the fraction of transcripts that are assigned to cells. This metric is an important indicator of the quality of spatial transcriptomics data, reflecting the efficiency of transcript capture and cell assignment.