Open Loom and 10x Cell Ranger files#
Audience: anyone with a .loom file or a Cell Ranger output
Time: 5 minutes
What you’ll learn: how to open a Loom file, a 10x Cell Ranger .h5 and a
Cell Ranger outs/ folder directly, what Cellucid reads from each, and what to
do with a count matrix that has no embedding
Prerequisites: none
Cellucid opens these files as they are: there is no conversion step. Each is
read in place, like an .h5ad: opening reads the file’s structure and the
values the first view needs, and a gene or an embedding is read when you show
it (File format expectations).
Loom (.loom)#
Open… › File…, drop the file on the viewer, or paste a link to it
(Open from a link). Loom 2.0.1 and 3.0.0 files open, whichever tool
wrote them: loompy (loompy.create, adata.write_loom), velocyto, SCENIC and
SCope, LoomExperiment, loomR and SeuratDisk.
In the Loom file |
In Cellucid |
|---|---|
|
the expression matrix |
|
the layers, listed under Data mapping › Genes › Expression |
a cell attribute with one value per cell ( |
an obs field; an integer one named as a clustering ( |
a cell attribute with one row per cell ( |
an embedding |
coordinate columns: |
one embedding each: |
SCope’s compound |
|
|
the cell names |
|
the gene names, made unique as for any file |
|
a neighbour graph |
|
|
Loom 2.0.1 stores text as ASCII with character references (é for
é); Cellucid shows the text it stands for. A file written with the matrix
as cells × genes (loomR’s order) is recognised by the length of its
attributes and read without transposing.
A Loom file opened from this computer, with Details open. It is read in
place, as an .h5ad is: no Read once line and nothing kept. Its title
attribute names the dataset, and its X_umap cell attribute is the embedding.#
A Loom file with no embedding is refused: Cellucid draws cells at embedding coordinates, and a velocyto output, for example, has only counts. The message gives the lines that compute one; with scanpy:
import scanpy as sc
adata = sc.read_loom("cells.loom")
sc.pp.normalize_total(adata)
sc.pp.log1p(adata)
sc.pp.pca(adata)
sc.pp.neighbors(adata)
sc.tl.umap(adata)
adata.write_h5ad("cells.h5ad")
10x Cell Ranger: filtered_feature_bc_matrix.h5 and outs/#
A Cell Ranger count matrix holds counts and nothing to draw them with. Cell
Ranger computes a UMAP, a t-SNE, a PCA and clusterings beside it, in the
analysis/ folder of outs/, and opening the outs/ folder shows them:
In the Session panel, under Open data, click Open…, then Folder… (or drag the folder onto the viewer).
Choose the
outs/folder itself (the one holdingfiltered_feature_bc_matrix.h5andanalysis/).The dataset opens on Cell Ranger’s UMAP (
X_umap, written by Cell Ranger 3.1 and later), else its t-SNE (X_tsne); the PCA (X_pca) is listed under Data mapping, and each clustering (graphclust,kmeans_<k>_clusters) is a categorical field.
A Cell Ranger outs/ folder opened with Open… › Folder…: the Dataset box
reads Cell Ranger outs/ folder · this computer, the view is Cell Ranger’s
UMAP, and it is coloured by Cell Ranger’s own clustering,
gene_expression_clusters, chosen under Categorical obs.#
In |
In Cellucid |
|---|---|
|
the expression matrix, read in place |
|
|
|
|
|
|
|
the field |
barcodes |
the cell names |
feature names, ids, types and genome |
the gene names; |
Projections and clusterings are matched to the matrix by barcode. A cell a projection does not list cannot be drawn in it (the embedding is refused with the cell named); a cell a clustering does not list has no category. The CSVs are streamed into typed columns, so their length is bounded by memory alone: a 10-million-cell folder’s analysis (560 MB of CSV) is read in its bytes and a few bytes a cell.
A matrix of several feature types (Gene Expression with Antibody Capture from CITE-seq, CRISPR Guide Capture, Multiplexing Capture) opens on Gene Expression and shows a Modality select under Data mapping › Genes, one modality per feature type (Multimodal data: MuData and the Modality select). A Cell Ranger 2 file of several genomes has one modality per genome.
The .h5 alone (Open… › File…, a drop or a link) is refused with this
message, because it has no embedding:
filtered_feature_bc_matrix.h5 is a 10x Cell Ranger count matrix that has no
cell embedding, and Cellucid draws cells at embedding coordinates. Cell Ranger
writes UMAP and t-SNE projections beside it: open the whole outs/ folder
(Open… › Folder…), which holds this file and analysis/. Or compute one and open
the result: …
Opened from a link (Google Drive, OneDrive, a web address), the advice is what
a link allows: a link opens one file, never a folder, and no provider shares a
folder Cellucid could read, so the message says to download the whole outs/
folder and open it from this computer (Open… › Folder…), or to compute an
embedding.
To compute an embedding of your own instead, in Python:
import scanpy as sc
adata = sc.read_10x_h5("filtered_feature_bc_matrix.h5")
adata.var_names_make_unique()
sc.pp.normalize_total(adata)
sc.pp.log1p(adata)
sc.pp.pca(adata)
sc.pp.neighbors(adata)
sc.tl.umap(adata)
adata.write_h5ad("pbmc.h5ad")
or in R, with Seurat, then cellucid::cellucid_prepare("pbmc.zarr", data = seu)
after RunUMAP().
molecule_info.h5 is a table of molecules, not a count matrix: it is refused,
naming the matrix to open. The 10x download site does not let other websites
read its files, so a link to a file there is refused; download it, then open
the file or folder.
Where to go next#
Multimodal data: MuData and the Modality select: the Modality select.
Data mapping: which embedding, graph and genes a view shows.
Troubleshooting (data loading): every refusal and what to do.