pegasus.read_input

pegasus.read_input(input_file, file_type=None, mode='r', genome=None, modality=None, black_list=None, select_data=None, select_genome=None, select_modality=None)[source]

Load data into memory. This function is used to load input data into memory. Inputs can be in ‘zarr’, ‘h5ad’, ‘loom’, ‘10x’, ‘mtx’, ‘csv’, ‘tsv’, ‘fcs’ (for flow/mass cytometry data) or ‘nanostring’ (Nanostring GeoMx spatial data) formats. :type input_file: str :param input_file: Input file name. :type input_file: str :type file_type: Optional[str] :param file_type: File type, choosing from ‘zarr’, ‘h5ad’, ‘loom’, ‘10x’, ‘mtx’, ‘csv’, ‘tsv’, ‘fcs’ (for flow/mass cytometry data), ‘nanostring’ or ‘visium’. If None, inferred from input_file. :type file_type: str, optional (default: None) :type mode: str :param mode: File open mode, options are ‘r’ or ‘a’. If mode == ‘a’, file_type must be zarr and ngene/select_singlets cannot be set. :type mode: str, optional (default: ‘r’) :type genome: Optional[str] :param genome: For formats like loom, mtx, dge, csv and tsv, genome is used to provide genome name. In this case if genome is None, except mtx format, “unknown” is used as the genome name instead. :type genome: str, optional (default: None) :type modality: Optional[str] :param modality: Default modality, choosing from ‘rna’, ‘atac’, ‘tcr’, ‘bcr’, ‘crispr’, ‘hashing’, ‘citeseq’, ‘cyto’ (flow cytometry / mass cytometry) or ‘nanostring’. If None, use ‘rna’ as default. :type modality: str, optional (default: None) :type black_list: Optional[Set[str]] :param black_list: Attributes in black list will be poped out. :type black_list: Set[str], optional (default: None) :type select_data: Optional[Set[str]] :param select_data: Only select data with keys in select_data. Select_data, select_genome and select_modality are mutually exclusive. :type select_data: Set[str], optional (default: None) :type select_genome: Optional[Set[str]] :param select_genome: Only select data with genomes in select_genome. Select_data, select_genome and select_modality are mutually exclusive. :type select_genome: Set[str], optional (default: None) :type select_modality: Optional[Set[str]] :param select_modality: Only select data with modalities in select_modality. Select_data, select_genome and select_modality are mutually exclusive. :type select_modality: Set[str], optional (default: None)

Return type

A MultimodalData object.

Examples

>>> data = io.read_input('example_10x.h5')
>>> data = io.read_input('example.h5ad')
>>> data = io.read_input('example_ADT.csv', genome = 'hashing_HTO', modality = 'hashing')