API References

Import CAME:

import came

Example data

load_example_data()

Load example data, for a quick start with CAME.

Pipeline came.pipeline.*

main_for_aligned(adatas, vars_feat[, ...])

Run the main process of CAME (model training), for integrating 2 datasets of aligned features.

main_for_unaligned(adatas, vars_feat, ...[, ...])

Run the main process of CAME (model training), for integrating 2 datasets of unaligned features.

preprocess_aligned(adatas, key_class[, ...])

Packed function for process adatas with aligned features (i.e., one-to-one correspondence).

preprocess_unaligned(adatas, key_class[, ...])

Packed function for process adatas with un-aligned features.

gather_came_results(dpair, trainer, classes, ...)

Packed function for pipeline as follows:

Preprocessing came.pp.*

align_adata_vars(adata1, adata2[, ...])

Align the vaiables of two sc.AnnData objects

normalize_default(adata[, target_sum, copy, ...])

Normalizing datasets with default settings (total-counts normalization followed by log(x+1) transform).

quick_preprocess(adata[, hvgs, ...])

Quick preprocess of the raw data.

quick_pre_vis(adata[, hvgs, normalize_data, ...])

Go through the default pipeline and have a overall visualization of the data.

group_mean(X, labels[, binary, classes, ...])

compute the group averaged features

group_mean_adata(adata, groupby[, features, ...])

Compute averaged feature-values for each group

wrapper_scale(adata[, zero_center, ...])

Wrapper function for centering and scaling data matrix X in sc.AnnData, extended for within-batch processing.

make_bipartite_adj(df_map[, nodes1, nodes2, ...])

Make a bipartite adjacent (sparse) matrix from a pd.DataFrame with two mapping columns.

take_1v1_matches(df[, cols])

Take the one-to-one matches of the given two columns of a pd.DataFrame

subset_matches(df_match, left, right[, ...])

Take a subset of token matches (e.g., gene homologies)

get_homologies(df_match, vals[, cols, ...])

Get the homologous gene of input ones based on the homology-mappings

take_adata_groups(adata, key, group_names[, ...])

Take given groups from an AnnData object

remove_adata_groups(adata, key, group_names)

Remove given groups from an AnnData object

merge_adata_groups(adata, key, group_lists)

Merge the given groups into one single group which is named as '_'.join(groups[i]) by default.

split_adata(adata, key)

Split an AnnData object into a dict of multiple objects

DataPair and AlignedDataPair

make_features(adatas, vars1, vars2, df_varmap)

Decide and make a pair of aligned feature matrices for CAME input.

aligned_datapair_from_adatas(adatas, vars_feat)

Build AlignedDataPair object from a pair of adatas.

datapair_from_adatas(adatas, vars_feat, ...)

Build DataPair object from a pair of adatas.

AlignedDataPair(features, ov_adjs[, ...])

Paired datasets with the aligned features (e.g.

DataPair(features, ov_adjs, vv_adj[, ...])

Paired datasets with the un-aligned features (e.g., cross-speceis)

Graph Neural Network Model

CGGCNet(g_or_canonical_etypes, in_dim_dict)

Cell-Gene-Gene-Cell graph neural network.

CGCNet(**kwargs)

Cell-Gene-Cell graph neural network (used when features are 1-to-1 aligned)

I/O Functions

load_dpair_and_model(dirname[, ...])

Load the output results of CAME.

load_hidden_states(path)

Load hidden states from .h5 file the data structure should be like [ 'layer0/cell', 'layer0/gene', 'layer1/cell', 'layer1/gene', 'layer2/cell', 'layer2/gene' ]

save_hidden_states(data_list, path)

Save hidden states into .h5 file

save_pickle(obj, fpath)

save the object into a .pickle file

load_pickle(fp)

load the object from a .pickle file

Analysis came.ana.*

weight_linked_vars(X, adj[, names, metric, ...])

Computes the similarity of each linked (homologous) pair of variables.

weight_linked_vars_by_expr(dpair, ...)

Compute the weights between homologies by their average expressions across (cell) groups.

make_abstracted_graph(obs_labels1, ...[, ...])

Compute and make the abstracted graph from expression matrices and the linkage weights between homologous genes

compare_modules(mod_labels1, mod_labels2, ...)

Compute common and private genes (cross-species) in each gene module.

compute_common_private(genes1, genes2, gmap)

compute common and private genes based on a given gene mapping

Plotting Functions came.pl.*

plot_stacked_bar(df[, norm, figsize, ...])

helper function for visualizing the group compositions (e.g., in each stage or condition).

heatmap_probas(df_data, lbs[, name_label, ...])

Heatmap of the prediction probabilities

wrapper_heatmap_scores(df_score, obs[, ...])

sort columns and rows, plot heatmap of cell-type scores

plot_confus_mat(y_true, y_pred[, ...])

function for plotting the contingency matrix by default, the values will be normalized by row (true classes)

plot_contingency_mat(y_true, y_pred[, ...])

function for plotting the contingency matrix

embed_with_values(xy, values[, do_zscore, ...])

Visualize the given x-y coordinates, colored by the given (dict of) values

adata_embed_with_values(adata, values[, ...])

This function can also be used to visualize the average expressions of some cell types on gene embedding, in which case, each observation in adata represents a genes.

umap_with_annotates(adt, text_ids[, color, ...])

Plot the UMAP embeddings and annotate the names of the given points

plot_multipartite_graph(g[, subset_key, ...])

display the abstracted multipartite graph (cellType - geneModules - geneModules - cellTypes)