socube package¶
Subpackages¶
Submodules¶
socube.cube module¶
-
class
socube.cube.
SoCube
(data_path: str, home_path: Optional[str] = None, metric: str = 'correlation', dtype: str = 'float32', verbose: int = 1, **kwargs)¶ Bases:
object
Abstract class of SoCube.
- Parameters
data_path (str) – Path of original scRNA-seq data file
home_path (str, optional) – Path of output home directory. If not specified, it will be set to the same directory as data_path.
metric (str, optional) – Metric to use for distance calculation. supported: ‘correlation’, ‘cosine’, ‘euclidean’, ‘manhattan’, etc. default is ‘correlation’.
dtype (str, optional) – Data type of output data. isupported: ‘float32’, ‘float64’, etc. default is ‘float32’.
verbose (int, optional) – Verbose level. default is 1.
-
static
available
() → dict¶ Return available map types
-
batchTransform
(samples: pandas.core.frame.DataFrame, data_dir: Optional[str] = None, use_index: bool = False, **kwargs) → numpy.ndarray¶ The sample data batch is subjected to feature transformation by socube to obtain the feature 3d matrix in the form of NCHW
- Parameters
samples (pd.DataFrame) – The sample data to be transformed, row as samples, columns as features
data_dir (str) – Path to save samples. If given, it will save samples
use_index (bool) – If True, it will save samples with using numerical index as filename. such as 0.npy otherwise, sample name used instead.
- Returns
- Return type
The generated embedding feature matrix and gene matching
-
abstract
fit
(**kwargs)¶ all subclass must implement it
-
property
grid
¶ Return the grid data
-
static
instance
(map_type: str, data_path: str, home_path: Optional[str] = None, metric: str = 'correlation', dtype: str = 'float32', verbose: int = 1, **kwargs) → SoCubeType¶ SoCube is designed using the factory pattern, and this method is used to create SoCube instance objects
- Parameters
map_type (str) – Type of map to use. supported: ‘pca’
data_path (str) – Path of original scRNA-seq data file
home_path (str, optional) – Path of output home directory. If not specified, it will be set to the same directory as data_path.
metric (str, optional) – Metric to use for distance calculation. supported: ‘correlation’, ‘cosine’, ‘euclidean’, ‘manhattan’, etc. default is ‘correlation’.
dtype (str, optional) – Data type of output data. isupported: ‘float32’, ‘float64’, etc. default is ‘float32’.
verbose (int, optional) – Verbose level. default is 1.
- Returns
- Return type
SoCube instance object
-
abstract
load
(cube_path: str) → bool¶ Load pretrained Socube
-
property
scatter
¶ Return the scatter data
-
property
shape
¶ Return the socube 2d grid’s shape
-
abstract
transform
(sample: pandas.core.series.Series, **kwargs) → numpy.ndarray¶ Transform a droplet sample vector to its embedding form. for batch transform, see batchTransform api.
- Parameters
sample (pd.Series) – a droplet sample vector
- Returns
- Return type
embedding form
Module contents¶
-
socube.
main
(*args: str)¶ Entrypoint function of socube commandline interface. For parameter details, just run it without any args to print help info. See also at https://docs.idrblab.cn/socube.
Examples
>>> from socube import main >>> main() # print hellp info