Low-level API
locaTE.get_MI — Functionget_MI(X::AbstractMatrix, coupling::AbstractSparseMatrix, genes_prev::Vector{Int}, genes_next::Vector{Int}; disc = nothing, kwargs...)Computes the TE score for all pairs of genes in genes_prev, genes_next from cell-by-gene expression matrix X under coupling. A precomputed discretization can be passed as disc, otherwise counts will be binned using a call to discretization with kwargs as named arguments. Returns a vector of TE scores with the same length as zip(genes_prev, genes_next).
locaTE.CLR — FunctionCLR(x)Compute CLR filtering of gene expression matrix x.
locaTE.wCLR — FunctionwCLR(x)Compute weighted CLR filtering of gene expression matrix x.
locaTE.apply_clr — Functionapply_clr(A, n_regulators, n_targets)Apply CLR to an array of flattened interaction matrices, i.e. of dimensions (n_cells, n_genes^2)
locaTE.apply_wclr — Functionapply_wclr(A, n_regulators, n_targets)Apply wCLR to an array of flattened interaction matrices, i.e. of dimensions (n_cells, n_genes^2)
locaTE.compute_coupling — Functioncompute_coupling(X::AbstractMatrix, i::Int, R::AbstractSparseMatrix)Compute undirected coupling for cell i with neighbourhood kernel R.
compute_coupling(X::AbstractMatrix, i::Int, P::AbstractSparseMatrix, R::AbstractSparseMatrix)Compute directed coupling for cell i with neighbourhood kernel R and forward transition matrix P.
compute_coupling(X::AbstractMatrix, i::Int, P::AbstractSparseMatrix, QT::AbstractSparseMatrix, R::AbstractSparseMatrix)Compute directed coupling for cell i with neighbourhood kernel R, forward transition matrix P and (transposed) backward transition matrix QT.
compute_coupling(X::AbstractMatrix, idx::BitVector, P::AbstractSparseMatrix, QT::AbstractSparseMatrix, R::AbstractSparseMatrix)Compute directed coupling for cell indices idx with neighbourhood kernel R, forward transition matrix P and (transposed) backward transition matrix QT.
locaTE.cdf_fit — Functioncdf_fit(x::AbstractVector)Fit Gamma CDF to x, using Normal as fallback.
locaTE.cdf_norm — Functioncdf_norm(x::AbstractArray, A::AbstractMatrix; fits_reg_all = nothing, fits_targ_all = nothing)Apply CDF normalisation to x, while fitting CDFs to entries of A. If provided, fits_reg_all and fits_targ_all are vectors of CDFs from cdf_fit.
locaTE.apply_cdf_norm — Functionapply_cdf_norm(x::AbstractArray, A::AbstractMatrix)Apply CDF normalisation treating each row of x as a flattened score matrix, while fitting CDFs to entries of A.
Low-level GPU implementation
locaTE.get_MI! — Functionget_MI!(mi_all, joint_cache, coupling_I, coupling_J, coupling_V, N_genes, ids; threads=(8,8,8), blocks=128, offset_x = nothing, N_x = nothing, offset_y = nothing, N_y = nothing)Calculate transfer entropy and write to mi_all using cache joint_cache, with sparse (i,j,v) representation of coupling (coupling_I, coupling_J, coupling_V) for N_genes. N_x, N_y and offset_x, offset_y are required for GPU compute blocks. See examples for usage.
get_MI!(mi_all, joint_cache, coupling, N_genes, ids0, ids1; threads=(8,8,8), blocks=128, offset_x = nothing, N_x = nothing, offset_y = nothing, N_y = nothing)Calculate transfer entropy and write to mi_all using cache joint_cache, with dense coupling for N_genes. N_x, N_y and offset_x, offset_y are required for GPU compute blocks. See examples for usage.
locaTE.get_joint_cache — Functionget_joint_cache(N_x, N_y, discret_max_size)Create joint distribution cache for N_x regulators and N_y targets.
locaTE.getcoupling_dense — Functiongetcoupling_dense(i, P, QT, R)Get dense coupling for cell i, forward transition matrix P, transposed backward transition matrix QT and neighbourhood kernel R.
locaTE.getcoupling_dense_trimmed — Functiongetcoupling_dense_trimmed(idx, P, QT, R)Get "trimmed" (i.e. removed zero rows and cols) dense coupling for cell indicator idx, forward transition matrix P, transposed backward transition matrix QT and neighbourhood kernel R. Returns the trimmed dense coupling, along with row_idxs and col_idxs.
locaTE.getcoupling_sparse — Functiongetcoupling_sparse(i, P, QT, R)Get sparse coupling for cell indicator idx, forward transition matrix P, transposed backward transition matrix QT and neighbourhood kernel R.