maxfuse.utils

General utility functions

Functions

cca_embedding

Filter bad matched pairs, align arr1 and arr2 using init_matching, fit CCA, and get CCA embeddings of arr1 and arr2.

cdist_correlation

Calculate pair-wise 1 - Pearson correlation between X and Y.

center_scale

Column-wise center and scale by standard deviation.

dict_to_list

Convert dict_ into a list.

drop_zero_variability_columns

Drop columns for which its standard deviation is zero in any one of the arrays in arr_list.

filter_bad_matches

Filter bad matches according to the distances of matched pairs.

get_centroids

Compute the centroids (cluster mean) of arr.

graph_smoothing

For each row of arr, shrink it towards the average of its neighborhood by taking wt*raw_data + (1-wt)*nhbd_avg

list_to_dict

Convert list_ to a dict.

pearson_correlation

Calculate the vector of pearson correlations between each row of arr1 and arr2.

process_count_data

Process count data according to scanpy pipeline.

recode

Recode the cluster labels to 0, 1, ..., num_clusters-1

robust_svd

Do deterministic or randomized SVD on arr.

shrink_towards_centroids

For each row of arr, shrink it towards its cluster centroid by taking wt*raw_data + (1-wt)*centroid

sort_dict

Return a copy of dict_ with both keys and values sorted.

summarize_clustering

Compute the majority cell type for each cluster.

svd_denoise

Compute best rank-n_components approximation of arr by SVD.

svd_embedding

Compute rank-n_components SVD embeddings of arr.