hest.readers.VisiumReader
- class hest.readers.VisiumReader
10x Genomics Visium reader
Methods table
Methods
- VisiumReader.auto_read(path: str, **read_kwargs) HESTData
Automatically detect the file names and determine a reading strategy based on the detected files. For more control on the reading process, consider using read() instead
- Parameters:
path (st) – path to the directory containing all the necessary files
- Returns:
STObject that was read
- Return type:
- VisiumReader.read(img_path: str, filtered_bc_matrix_path: str = None, raw_bc_matrix_path: str = None, spatial_coord_path: str = None, alignment_file_path: str = None, mex_path: str = None, scanpy_h5_path: str = None, metric_file_path: str = None, custom_adata: sc.AnnData = None, autoalign: bool = 'auto', save_autoalign: bool = False) VisiumHESTData
read 10x visium with its associated image
requires a full resolution image and a gene expression file, only one of the gene expression files will be used in this order: - filtered_bc_matrix_path - raw_bc_matrix_path - mex_path - custom_adata - scanpy_h5_path
- Parameters:
img_path (str) – path to the full resolution image
filtered_bc_matrix_path (str, optional) – path to the filtered_feature_bc_matrix.h5. Defaults to None.
raw_bc_matrix_path (str, optional) – path to the raw_feature_bc_matrix.h5. Defaults to None.
spatial_coord_path (str, optional) – path to the spatial/ folder containing either a tissue_positions.csv or a tissue_position_list.csv (is such folder exists). Defaults to None.
alignment_file_path (str, optional) – path to an alignment file (if exists). Defaults to None.
mex_path (str, optional) – path to a folder containing three files ending with barcode.tsv(.gz), features.tsv(.gz), matrix.mtx(.gz). Defaults to None.
scanpy_h5_path (str, optional) – path to a scanpy formated .h5ad. Defaults to None.
metric_file_path (str, optional) – path to a metrics_summary.csv file. Defaults to None.
custom_adata (sc.AnnData, optional) – a scanpy spatial AnnData object. Defaults to None.
autoalign (str, optional) –
whenever to use an automated object detector to align the spots based on the fiducials in the full res image. Defaults to ‘auto’.
auto: use the autoaligner if no tissue_positions are detected in the spatial folder and if an alignment file is not passed
always: force autoalignment
never: do not use autalignment
save_autoalign (bool, optional) – whenever to save the autoalignment file and visualization plot in a spatial/ folder. Defaults to False.
- Raises:
ValueError – on invalid arguments
- Returns:
visium spatial data with spots aligned based on the provided arguments
- Return type:
VisiumHESTData