stlearn.Read10X¶
-
stlearn.Read10X(path: Union[str, pathlib.Path], genome: Optional[str] = None, count_file: str = 'filtered_feature_bc_matrix.h5', library_id: str = None, load_images: Optional[bool] = True, quality: Literal[fulres, hires, lowres] = 'hires') → anndata._core.anndata.AnnData[source]¶ Read Visium data from 10X (wrap read_visium from scanpy)
In addition to reading regular 10x output, this looks for the spatial folder and loads images, coordinates and scale factors. Based on the Space Ranger output docs.
- Parameters
path – Path to directory for visium datafiles.
genome – Filter expression to genes within this genome.
count_file – Which file in the passed directory to use as the count file. Typically would be one of: ‘filtered_feature_bc_matrix.h5’ or ‘raw_feature_bc_matrix.h5’.
library_id – Identifier for the visium library. Can be modified when concatenating multiple adata objects.
load_images – Load image or not.
quality – Set quality that convert to stlearn to use. Store in anndata.obs[‘imagecol’ & ‘imagerow’]
- Returns
Annotated data matrix, where observations/cells are named by their
barcode and variables/genes by gene name. Stores the following information
X– The data matrix is storedobs_names– Cell namesvar_names– Gene namesvar[‘gene_ids’] – Gene IDsvar[‘feature_types’] – Feature typesuns[‘spatial’] – Dict of spaceranger output files with ‘library_id’ as keyuns[‘spatial’][library_id][‘images’] – Dict of images (‘fulres’, ‘hires’ and ‘lowres’)uns[‘spatial’][library_id][‘scalefactors’] – Scale factors for the spotsuns[‘spatial’][library_id][‘metadata’] – Files metadata: ‘chemistry_description’, ‘software_version’obsm[‘spatial’] – Spatial spot coordinates, usable as basis byembedding().