Skip to content

Quickstart

Counts to clusters in one page. Everything here runs on a plain pip install piaso-tools.

Get the data

piaso.data keeps a registry of example datasets and caches downloads, so the same call works on a laptop and on a cluster.

import piaso
piaso.data.list_datasets()
adata = piaso.data.load_dataset("mouse_brain_10k_gemx")

That is a 10x Genomics mouse brain sample — 11,357 cells, 33,696 genes, about 65 MB. It is downloaded once and verified against a checksum, then reused.

To use your own Cell Ranger output instead:

adata = piaso.pp.read_10x("path/to/filtered_feature_bc_matrix.h5")
adata = piaso.pp.read_10x("path/to/filtered_feature_bc_matrix/") # MTX folder

.X holds raw UMI counts — that is what the next step expects.

The workflow

import cosg
piaso.pp.calculateCellMetrics(adata)
piaso.pp.filter_cells(adata, min_counts=500, min_features=250)
# INFOG normalization + feature selection, from raw counts
piaso.tl.infog(adata, n_top_genes=3000)
# Pass layer="infog" — runSVD defaults to .X, which would ignore the step above
piaso.tl.runSVD(adata, layer="infog", n_components=50, key_added="X_svd")
piaso.tl.neighbors(adata, use_rep="X_svd", n_neighbors=15)
piaso.tl.leiden(adata, resolution=1.0, key_added="leiden")
piaso.tl.umap(adata, use_rep="X_svd")
cosg.cosg(adata, groupby="leiden", key_added="cosg")
piaso.pl.embedding(adata, basis="X_umap", color="leiden")

Where to go next

This page is the shortest path from counts to a UMAP, and it skips the part that actually decides whether the UMAP means anything: quality control. The thresholds above (min_counts=500, min_features=250) are a starting point, not an answer, and there is no mitochondrial filter here at all — because the right one depends on the sample. Read one of the end-to-end tutorials next. They are the same workflow with the reasoning, the diagnostic plots, doublet removal, cell type annotation and marker genes:

Human PBMC scRNA-seq end to end (AnnData)Human blood. Median mitochondrial content 12.0%, so every QC threshold does something — and one whole cluster turns out to be mitochondrial reads, caught by its markers rather than by its statistics.
Human PBMC scRNA-seq end to end (cytome)The same analysis streamed from a file on disk.
Mouse brain scRNA-seq end to end (AnnData)Mouse brain nuclei — the dataset used above, taken all the way through. Median mitochondrial content 0.011%, so the same thresholds are inert and the highest-mitochondrial cluster is endothelium worth keeping.
Mouse brain scRNA-seq end to end (cytome)The same analysis streamed from a file on disk.

Pick the species that matches your data, and the AnnData version unless the matrix is too large to hold in memory. Reading both species is worth the twenty minutes: side by side they show that a QC threshold which is essential in one sample is inert in the other, which is the single most common way a first analysis goes wrong.

Then: