Skip to main content

SCOIT

SCOIT is an implementation of a probabilistic tensor decomposition framework for single-cell multiomic data integration. SCOIT accepts the input of datasets from multiple omics, with missing values allowed.

image

Getting started

Prerequisite

  • numpy
  • scipy 1.6.0
  • sklearn
  • communities
  • igraph
  • leidenalg
  • pytorch 1.9.0

Install

pip install SCOIT

Examples

We put the complete scripts for the analysis described in the manuscript under examples/ directory for detailed usage examples and reproduction. The example data can be downloaded from Google Drive.

This is an example of multiple datasets when features have corresponding information.

from scoit import sc_multi_omics

data = np.array([expression_data, methylation_data])
sc_model = sc_multi_omics()
predict_data = sc_model.fit(data) # the imputed data
np.savetxt("global_cell_embeddings.csv", sc_model.C, delimiter = ',') # global cell embeddings
np.savetxt("global_gene_embeddings.csv", sc_model.G, delimiter = ',') # global gene embeddings
np.savetxt("local_cell_embeddings.csv", sc_model.C, delimiter = ',') # omics-specific cell embeddings
np.savetxt("local_gene_embeddings.csv", sc_model.G, delimiter = ',') # omics-specific gene embeddings

# imputation
imputed_expression_data = predict_data[0]
imputed_methylation_data = predict_data[1]

When the features of different omics do not have corresponding information, please use the fit_list function, which accepts the input as a list of matrices.

from scoit import sc_multi_omics

data = [expression_data, protein_data]
sc_model = sc_multi_omics()
predict_data = sc_model.fit_list(data)

If the input does not contain missing values ("NA"), we provide fit_complete and fit_list_complete functions to accelerate the optimization since they take advantage of matrix operations.

from scoit import sc_multi_omics

data = np.array([expression_data, methylation_data])
sc_model = sc_multi_omics()
predict_data = sc_model.fit_complete(data) # the imputed data
from scoit import sc_multi_omics

data = [expression_data, protein_data]
sc_model = sc_multi_omics()
predict_data = sc_model.fit_list_complete(data)

Parameters

sc_multi_omics

  • K1: The local element-wise product parameter, see the manuscript for details (default=30).
  • K2: The local element-wise product parameter (default=30).
  • K3: The local element-wise product parameter (default=30).
  • random_seed: The random seed used in optimization (default=123).

fit

  • normalization: Whether to applied min-max normalization (default=True).
  • pre_impute: Whether to applied KNNImputer for pre-processing (default=False).
  • opt: The optimization algorithm for gradient descent, including SGD, Adam, Adadelta, Adagrad, AdamW, SparseAdam, Adamax, ASGD, LBFGS (default="Adam").
  • dist:The distribution used for modeling, including gaussian, poisson, negative_bionomial (default="gaussian").
  • lr: The learning rate for gradient descent (default=1e-2).
  • n_epochs: The number of optimization epochs (default=1000).
  • lambda_C_regularizer: The coefficient for the penalty term of global cell embeddings (default=0, indicating automatically adjust.).
  • lambda_G_regularizer: The coefficient for the penalty term of global gene embeddings (default=0).
  • lambda_O_regularizer: The coefficient list for the penalty term of global omics embeddings; the length of the list should be the same with the number of omics (default=[0, 0]).
  • lambda_OC_regularizer: The coefficient list for the penalty term of omics-specific cell embeddings; the length of the list should be the same with the number of omics, not avaiable for complete functions (default=[0, 0]).
  • lambda_OG_regularizer: The coefficient list for the penalty term of omics-specific gene embeddings, the length of the list should be the same with the number of omics, not avaiable for list functions (default=[0, 0]).
  • batch_size: The batch size used for gradient descent, not avaiable for complete functions (default=256).
  • device: CPU or GPU (default='cuda' if torch.cuda.is_available() else 'cpu').
  • verbose: Whether to print loss for each epoch (default=True).

cell_analysis

knn_adj_matrix

Construct KNN graph with the cell embeddings.

  • k: The number of neighbos used to construct KNN graph (default=20).

snn_adj_matrix

Construct SNN graph with the cell embeddings.

  • k: The number of neighbos used to construct SNN graph (default=20).

jsnn_adj_matrix

Construct jSNN graph with the cell embeddings.

  • k: The number of neighbos used to construct jaccard SNN graph (default=20).
  • prune: Set the score below the value to zero (default=1/15).

RunLouvain

Run Louvain algorithm for the graph.

  • k: Terminate the search once this number of communities is detected (default=None).

RunSpectral

Run Spectral clustering algorithm for the graph.

  • k: Number of clusters (default=5).

RunLeiden

Run Leiden algorithm for the graph.

gene_analysis

pearson_correlation

Calculate the correlation between the features.

feature_projection

Project the feature embedding to cell embeddings and visualize with UMAP.

  • umap_epochs: The number of UMAP epochs for visualization (default=100).
  • dimension: The dimension of the embeddings to use (default=30).
  • figure_name: The saved figure name (default="feature_projections.png").

Version history

  • v0.1.2: Adjust correlation calculation.
  • v0.1.1: Automatically adjusts the coefficients; Add downstream analyses; Extend to unpaired data.
  • v0.0.1: Initial version.

Maintainer

WANG Ruohan ruohawang2-c@my.cityu.edu.hk

Release files for SCOIT 0.1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SCOIT 0.1.2.1
File Size Uploaded
SCOIT-0.1.2.1.tar.gz 14.3 kB Details

Release files / SCOIT-0.1.2.1.tar.gz

Download URL SCOIT-0.1.2.1.tar.gz
Size 14.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a614dbffb34333c027f283b82581958f4fff9c77c3ddf617c14d5ee8da388bdb
BLAKE2b-256 checksum
How to use checksums
81b303acf815b803d965a1e07e5b005194378b704545285ad2e2e4a6658c1c8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.3

Release history Release notifications | RSS feed

This release

0.1.2.1 This release

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page