stereo.core.StereoExpData¶
- class stereo.core.StereoExpData(file_path=None, file_format=None, bin_type=None, bin_size=100, exp_matrix=None, genes=None, cells=None, position=None, position_z=None, output=None, partitions=1, offset_x=None, offset_y=None, attr=None, merged=False)[source]¶
- __init__(file_path=None, file_format=None, bin_type=None, bin_size=100, exp_matrix=None, genes=None, cells=None, position=None, position_z=None, output=None, partitions=1, offset_x=None, offset_y=None, attr=None, merged=False)[source]¶
The core data object is designed for expression matrix of spatial omics, which can be set corresponding properties directly to initialize the data.
- Parameters:
file_path (
Optional[str]) – the path to input file of expression matrix.file_format (
Optional[str]) – the format of input file.bin_type (
Optional[str]) – the type of bin, if the file format is Stereo-seq file including'bins'or'cell_bins'.bin_size (
Optional[int]) – the size of the bin to merge, whenbin_typeis'bins'.exp_matrix (
Union[ndarray,spmatrix,None]) – the expression matrix.genes (
Union[ndarray,Gene,None]) – the gene object which contains information of gene level.cells (
Union[ndarray,Cell,None]) – the cell object which contains information of cell level.position (
Optional[ndarray]) – spatial location information.output (
Optional[str]) – the path to output file.partitions (
Optional[int]) – the number of multi-process cores, used when processing files in parallel.offset_x (
Optional[str]) – the x value of the offset .offset_y (
Optional[str]) – the y value of the offset .attr (
Optional[dict]) – attribute information from GEF file.
Methods
__init__([file_path, file_format, bin_type, ...])The core data object is designed for expression matrix of spatial omics, which can be set corresponding properties directly to initialize the data.
array2sparse()Transform expression matrix to sparse matrix if it is ndarray.
bin_type_check(bin_type)Check whether the bin type is from specific options.
check()Check whether the parameters meet the requirement.
file_check(file)Check whether the file exists.
format_check(f_format)Check whether the file format is in specific range.
get_index(data, names)get_sn_from_path(file_path)Get the SN information of input file.
issparse()Check whether the matrix is sparse matrix type.
output_check(path)Check whether the output directory exists.
reset_position()sparse2array()Transform expression matrix to array if it is parse matrix.
sub_by_index([cell_index, gene_index])Get data subset by indexl list of cells or genes.
sub_by_name([cell_name, gene_name])Get data subset by name list of cells or genes.
sub_exp_matrix_by_name([cell_name, ...])- rtype:
Union[ndarray,spmatrix]
to_ann_based()to_df()Transform StereoExpData object to pd.DataFrame.
write(filename[, to_anndata])Attributes
attrGet the attribute information.
bin_sizeGet the bin size.
bin_typeGet the bin type.
cell_bordersGet the cell borders.
cell_namesGet the cell names.
cellsGet the cell object.
cells_matrixGet the cells matrix.
cells_pairwiseGet the cells pairwise.
exp_matrixGet the expression matrix.
fileGet the file property.
file_formatGet the file format.
gene_namesGet the gene names.
genesGet the gene object.
genes_matrixGet the genes matrix.
genes_pairwiseGet the genes pairwise.
mergedGet the flag whether merged.
offset_xGet the x value of the offset.
offset_yGet the y value of the offset.
outputGet the path to ouput file.
partitionsGet the partitions property.
pltCall the visualization module.
positionGet the information of spatial location.
position_minposition_offsetGet the offset of position in gef.
position_zrawraw_positionresolutionshapeGet the shape of expression matrix.
snGet the sample name.
tlcall StPipeline method.