add support for layers in AnnData objects
jkanche opened this issue · 14 comments
Currently the app uses the X
slot of the AnnData object for extracting expression values. It would be great to supports the layers
slot and enable exploration of any assay (or matrix) from the AnnData object
You can join to h5ad files using launch by separating multiple paths by a comma, or in serve by supplying multiple datasets to prepare_data. I prefer this approach because both dimensions of arrays in layers must match X, which is not the case for multimodal data.
the release notes of anndata mentions they are unifying the layers and X in the upcoming release - https://anndata.readthedocs.io/en/latest/release-notes.html
I am not sure what this entails, but something to keep track of...
@jkanche Is your use case to support multi-modal data?
Its not, i can imagine a dataset containing many layers - counts, logcounts, normalized counts and so on... it would be nice to choose which layer to use for coloring especially when i color the umap/tsne by expression of a gene. right now, its pretty much whatever X is and the user has less/no control on this.
Do you want to be able to view multiple layers simultaneously for easy comparison? Thanks.
@joshua-gould Hi, thanks for this great app! yes, would it be possible to chose which layer to use in anndata object? i.e if someone can chose raw_data or X as well switch between different layers stored in the anndata object?
Thanks
@MubasherMohammed Do you want to be able to view multiple layers simultaneously or would switching between which layer is shown be sufficient? Thanks.
@joshua-gould thanks for swift reply! switching between layers could be sufficient. alternatively, some single-cell data objects contain layers of spliced/unspliced reads. it will be great to consider this info to the app in the future.
thanks..
Version 1.1.34 provides support for layers. Please let me know what you think. Thanks.
@joshua-gould thanks for the update! i was unable to install 1.1.34 using pip install git+https://github.com/klarman-cell-observatory/cirrocumulus.git@1.1.34
as well pip install git+https://github.com/klarman-cell-observatory/cirrocumulus.git@layers-support
is there any alternative i can use to install supported layers version? thanks
Please run the following command to update to the latest version:
pip install --upgrade cirrocumulus
Thanks, it has now successfully updated. Looking at the difference between "Cell Metadata" and "Metadata Categories" it seems they are belonging to <adata.obs> or at least its how my Anndata structure look like:
AnnData object with n_obs × n_vars = 4080 × 1313 obs: 'n_genes', 'umi_counts', 'louvain_1.0', 'louvain_0.6', 'louvain_0.4', 'louvain_1.4', 'clusters', 'S_score', 'G2M_score', 'phase', 'male_signature', 'female_signature', 'cell_class', 'annotation', 'initial_size_spliced', 'initial_size_unspliced', 'initial_size', 'n_counts', 'velocity_self_transition', 'velocity_length', 'velocity_confidence', 'velocity_confidence_transition', 'root_cells', 'end_points', 'velocity_pseudotime', 'latent_time', 'terminal_states', 'terminal_states_probs', 'clusters_gradients', 'initial_states', 'initial_states_probs', 'dpt_pseudotime', 'velocity_pseudotime_categorical' var: 'gene_ids', 'feature_types', 'genome', 'mt', 'ribo', 'hb', 'n_cells', 'highly_variable', 'means', 'dispersions', 'dispersions_norm', 'mean', 'std', 'Accession', 'Chromosome', 'End', 'Start', 'Strand', 'velocity_gamma', 'velocity_qreg_ratio', 'velocity_r2', 'velocity_genes', 'spearmans_score', 'velocity_score', 'fit_alpha', 'fit_beta', 'fit_gamma', 'fit_t_', 'fit_scaling', 'fit_std_u', 'fit_std_s', 'fit_likelihood', 'fit_u0', 'fit_s0', 'fit_pval_steady', 'fit_steady_u', 'fit_steady_s', 'fit_variance', 'fit_alignment_scaling', 'fit_r2', 'fit_diff_kinetics', 'fit_pval_kinetics', 'to C1 corr', 'to C1 qval', 'to C5 corr', 'to C5 qval' uns: 'cell class_colors', 'cell_class_colors', 'clusters_colors', 'dendrogram_cell_class', 'dendrogram_clusters', 'hvg', 'louvain', 'louvain_0.4_colors', 'louvain_0.6_colors', 'louvain_1.0_colors', 'louvain_1.4_colors', 'neighbors', 'pca', 'phase_colors', 'tsne', 'umap', 'wilcoxon', 'annotation_colors', 'velocity_params', 'velocity_graph', 'velocity_graph_neg', 'rank_velocity_genes', 'paga', 'cell_class_sizes', 'recover_dynamics', 'rank_dynamical_genes', 'T_fwd_params', 'eig_fwd', 'terminal_states_colors', 'terminal_states_names', 'clusters_gradients_colors', 'to_terminal_states_names', 'to_terminal_states_colors', 'T_bwd_params', 'eig_bwd', 'initial_states_colors', 'initial_states_names', 'iroot', 'diffmap_evals', 'velocity_pseudotime_categorical_colors' obsm: 'X_pca', 'X_tsne', 'X_umap', 'velocity_pca', 'velocity_umap', 'macrostates_fwd', 'to_terminal_states', 'macrostates_bwd', 'X_diffmap' varm: 'PCs', 'loss', 'fit_pvals_kinetics' layers: 'ambiguous', 'matrix', 'spliced', 'unspliced', 'Ms', 'Mu', 'velocity', 'variance_velocity', 'fit_t', 'fit_tau', 'fit_tau_', 'velocity_u' obsp: 'connectivities', 'distances', 'T_fwd', 'T_bwd'
i have tried to visualize i.e one gene spliced VS unspliced reads in UMAP but i think it will only shows the spliced reads (Expression). could this because of the layers should be 'layers: 'ambiguous', 'matrix', 'spliced', 'unspliced', 'Ms', 'Mu', 'velocity', 'variance_velocity', 'fit_t', 'fit_tau', 'fit_tau_', 'velocity_u''
You can obtain an example h5ad with layers from scvelo using the code:
import scvelo as scv
adata = scv.datasets.pancreas()
adata.write('pancreas.h5ad')
Note-the version 1.1.35 of cirrocumulus fixes an error when more than one layer is selected.
I have updated to V1.1.35 and the support for layers works nicely. possible to visualize the spliced vs unspliced reads for a gene.
Excellent!