API
import paste3
PASTE Alignment
|
Returns a mapping \(( \Pi = [\pi_{ij}] )\) between spots in one slice and spots in another slice while preserving gene expression and spatial distances of mapped spots, where \(\pi_{ij}\) describes the probability that a spot i in the first slice is aligned to a spot j in the second slice. |
|
Infers a "center" slice consisting of a low rank expression matrix \(X = WH\) and a collection of \(\pi\) of mappings from the spots of the center slice to the spots of each input slice. |
Visualization
|
Align spatial coordinates of sequential pairwise slices. |
Align spatial coordinates of a list of slices to a center_slice. |
|
|
Plots slice spatial coordinates. |
Model Selection
|
Converts spatial coordinates into graph using networkx library. |
Creates and returns the graph and dictionary {node: cluster_label} |
|
|
|
|
GLMPCA
|
U is NxL array of cell factors V is JxL array of loadings onto genes X is NxKo array of cell specific covariates A is JxKo array of coefficients of X Z is JxKf array of gene specific covariates G is NxKf array of coefficients of Z assume the data Y is of dimension JxN imputed expression: E[Y] = g^{-1}(R) where R = VU'+AX'+ZG' |
|
binomial deviance for two arrays X,P are JxN arrays n is vector of length N (same as cols of X,P) |
|
create the glmpca_family object and initialize the A array (regression coefficients of X) Y is the data (JxN array) fam is the likelihood sz optional vector of size factors, default: sz=colMeans(Y) or colSums(Y) sz is ignored unless fam is 'poi' or 'nb' |
|
given count data y and predicted means mu>0, and a neg binom theta "th" use Newton's Method to update theta based on the negative binomial likelihood note this uses observed rather than expected information regularization: let u=log(theta). |
|
GLM-PCA This function implements the GLM-PCA dimensionality reduction method for high-dimensional count data. The basic model is R = AX'+ZG'+VU', where E[Y]=M=linkinv(R). Regression coefficients are A and G, latent factors are U, and loadings are V. The objective function being optimized is the deviance between Y and M, plus an L2 (ridge) penalty on U and V. Note that glmpca uses a random initialization, so for fully reproducible results one should set the random seed. :type Y: :param Y: columns. :type Y: array_like of count data with features as rows and observations as :type L: :param L: :type L: the desired number of latent dimensions (integer). :type fam: :param fam: :type fam: string describing the likelihood to use for the data. Possible values include: :param - poi: :type - poi: Poisson :param - nb: :type - nb: negative binomial :param - mult: :type - mult: binomial approximation to multinomial :param - bern: :type - bern: Bernoulli :type ctl: |
Miscellaneous
Matches spatial coordinates between two datasets using either optimal transport or bipartite matching based on spatial proximity. |