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 str or Path is 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 str or Path is 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_csv if str or Path is given to count_df.

coordinate_df_kwargsdict, default {}

Keyword arguments pass to pandas.read_csv if str or Path is given to coordinate_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

AI

A Series for AI value.

Di

A DataFrame for local Di value.

coordinate_df

Coordinate information.

count_df

Expression matrix.

genes

An Index for genes' names.

hotspot_df

Hotspot matrix.

n_genes

Number of total genes.

n_spots

Number of total spots.

spot_type

A pd.DataFrame for spot type.

spots

An Index for spots' names.

svg_cluster

SVG cluster result.

weight

Weight used by svgbit.

weight_type

What kind of weight is used.