svgbit.STDataset#
- class svgbit.STDataset(count_df: Union[pandas.core.frame.DataFrame, numpy.ndarray, pathlib.Path, str], coordinate_df: Union[pandas.core.frame.DataFrame, numpy.ndarray, pathlib.Path, str], count_transpose: bool = False, coordinate_transpose: bool = False, count_df_kwargs: dict = {}, coordinate_df_kwargs: dict = {}, make_sparse: bool = True, check_duplicate_genes: bool = True, sort_spots: bool = True)[source]#
STDataset: A meta class for discribing Spatial Transcriptomics data.
- Parameters
- count_dfnp.ndarray, pd.DataFrame, str or Path
Expression matrix for Spatial Transcriptomics Data. If
strorPathis given, svgbit will try to read file with given path with pandas.Default shape: (spot * gene)
- coordinate_dfnp.ndarray, pd.DataFrame, str or Path
Coordinates for Spatial Transcriptomics Data. If
strorPathis given, svgbit will try to read file with given path with pandas.Default shape: (spot * 2)
- count_transposebool, default False
Whether to transpose count matrix.
- coordinate_transposebool, default False
Whether to transpose coordinate dataframe.
- count_df_kwargsdict, default {}
Keyword arguments pass to
pandas.read_csvifstrorPathis given tocount_df.- coordinate_df_kwargsdict, default {}
Keyword arguments pass to
pandas.read_csvifstrorPathis given tocoordinate_df.- make_sparsebool, default True
Whether to use sparse DataFrame in order to save memory.
- check_duplicate_genesbool, default True
Whether to check duplicated gene names.
- sort_spotsbool, default True
Whether to sort spots with spots’ name.
Methods
__init__(count_df, coordinate_df[, ...])acquire_density([cores])Acquire local Di and global AI value.
acquire_hotspot(**kwargs)Acquire hotspot matrix.
acquire_weight([k])Acquire weight for analysis.
find_clusters([n_svgs, n_svg_clusters, ...])Find SVG clusters.
to_dense()Convert count_df with sparse values to dense.
to_sparse()Convert count_df with dense values to sparse.
Attributes
A Series for AI value.
A DataFrame for local Di value.
Coordinate information.
Expression matrix.
An Index for genes' names.
Hotspot matrix.
Number of total genes.
Number of total spots.
A pd.DataFrame for spot type.
An Index for spots' names.
SVG cluster result.
Weight used by svgbit.
What kind of weight is used.