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_type
is'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_df
()Transform StereoExpData object to pd.DataFrame.
Attributes
attr
Get the attribute information.
bin_size
bin_type
Get the bin type.
cell_borders
Get the cell borders.
cell_names
Get the cell names.
cells
Get the cell object.
cells_matrix
Get the cells matrix.
cells_pairwise
Get the cells pairwise.
exp_matrix
Get the expression matrix.
file
Get the file property.
file_format
Get the file format.
gene_names
Get the gene names.
genes
Get the gene object.
genes_matrix
Get the genes matrix.
genes_pairwise
Get the genes pairwise.
merged
Get the flag whether merged.
offset_x
Get the x value of the offset.
offset_y
Get the y value of the offset.
output
Get the path to ouput file.
partitions
Get the partitions property.
plt
Call the visualization module.
position
Get the information of spatial location.
position_min
position_offset
Get the offset of position in gef.
position_z
raw
raw_position
resolution
shape
Get the shape of expression matrix.
sn
Get the sample name.
tl
call StPipeline method.