xenium_to_domain#
- xenium_to_domain(path_to_xenium_data=None, domain_name='Default_xenium_domain', cells_from_selection_csv=None, load_transcripts=False, selected_transcripts=None, load_nuclei=False, load_cells_as_shapes=True, exclude_no_nuclei_cells=True, add_transcript_counts_to_cell=True, print_summary=True)#
The function will take a xenium dataset and produce a muspan domain loaded with cell and transcript objects from an xenium output. Each data will be linked using string cell ID from Xenium and given as a label on the object. The function will also load only the cells selected in the cells_from_selection_csv file which is obtained via annotation using Xenium explorer.
- Parameters:
- path_to_xenium_datastr, optional
String providing the path to the directory to the Xenium data folder, defaults to None.
- domain_namestr, optional
Name given to created domain, defaults to ‘Default_xenium_domain’.
- cells_from_selection_csvstr, optional
Path to a region csv exported from Xenium Explorer using the ‘download cell states as csv’ functionality, defaults to None.
- load_transcriptsbool, optional
Option to load transcripts into the domain, defaults to False.
- selected_transcriptslist of str, optional
A list of transcript names to be loaded into the domain. If None, all transcripts will be loaded, defaults to None.
- load_nucleibool, optional
Option to load cell nuclei as shape objects into the domain, defaults to False.
- load_cells_as_shapesbool, optional
Option to load cells as shapes. If False, cells will be loaded as point objects, defaults to True.
- exclude_no_nuclei_cellsbool, optional
Option to exclude any cell object that does not contain a nucleus following segmentation, defaults to True.
- add_transcript_counts_to_cellbool, optional
If True, each cell object is annotated with a label showing the transcript count for every gene in the panel. Labels follow the format ‘Transcript Counts: XYZ’, where XYZ is a transcript in the panel. Default is True
- print_summarybool, optional
If True, print a summary of the resulting domain, by default True.
- Returns:
- muspan.domain
A muspan domain object.
Notes
Important
To import data from a Xenium experiment, we require the following files present the Xenium data folder (path_to_xenium_data).
Xenium data folder: ├── cells.parquet ├── nucleus_boundaries.parquet ├── cell_boundaries.parquet ├── transcripts.parquet ├── cell_feature_matrix.h5 └── gene_panel.json
These files are all generated as part of the standard Xenium output following processing and segmentation. For more information, see Xenium documentation
Additional information
Transcript names are loaded as labels on the transcript objects with the label name ‘Transcript ID’.
Cell IDs are loaded as labels on the cell objects with the label name ‘Cell ID’.
Cell annotations (labels) are loaded as labels on the cell objects with the label name ‘Cluster ID’ and are only imported using the ‘cells_from_selection_csv’ file. If missing, no cell labels will be added.