GitHub
Back to all tutorials

Core analysis

scATAC-seq Analysis

This tutorial analyzes one 10x Genomics scATAC-seq dataset in CellPilot: preparing the Cell Ranger ATAC output folder, reading the clusters and their marker peaks, plotting gene activity and accessibility coverage, naming clusters, and changing analysis parameters. Every command is typed in the chat box of the AI Assistant panel; no code or API key is needed. The screenshots come from CellPilot 2.1.0 running this exact dataset.

Input data

The example is the 10x Genomics 10k Human PBMCs, ATAC v2, Chromium Controller dataset (GRCh38): 10,246 cells and 165,434 peaks. The commands below download the files CellPilot uses (about 3 GB, mostly the fragments file). You can also download them from the 10x Genomics dataset page.

mkdir -p 10k_pbmc_atac
cd 10k_pbmc_atac
BASE=https://cf.10xgenomics.com/samples/cell-atac/2.1.0/10k_pbmc_ATACv2_nextgem_Chromium_Controller
SAMPLE=10k_pbmc_ATACv2_nextgem_Chromium_Controller
curl -O ${BASE}/${SAMPLE}_filtered_peak_bc_matrix.tar.gz
curl -O ${BASE}/${SAMPLE}_fragments.tsv.gz
curl -O ${BASE}/${SAMPLE}_fragments.tsv.gz.tbi
curl -O ${BASE}/${SAMPLE}_peak_annotation.tsv
curl -O ${BASE}/${SAMPLE}_singlecell.csv
curl -O ${BASE}/${SAMPLE}_summary.csv
curl -O ${BASE}/${SAMPLE}_web_summary.html

1. Prepare the folder

Downloads from the 10x website carry the sample name in every file name. Unpack the matrix and remove that prefix, so the folder looks like a Cell Ranger ATAC outs folder (your own Cell Ranger ATAC output already has these names):

tar -xzf ${SAMPLE}_filtered_peak_bc_matrix.tar.gz
mv ${SAMPLE}_fragments.tsv.gz fragments.tsv.gz
mv ${SAMPLE}_fragments.tsv.gz.tbi fragments.tsv.gz.tbi
mv ${SAMPLE}_peak_annotation.tsv peak_annotation.tsv
mv ${SAMPLE}_singlecell.csv singlecell.csv
mv ${SAMPLE}_summary.csv summary.csv
mv ${SAMPLE}_web_summary.html web_summary.html

The folder now contains filtered_peak_bc_matrix/ (matrix.mtx, barcodes.tsv, peaks.bed), peak_annotation.tsv (links peaks to genes, for gene activity), summary.csv (the genome build), and fragments.tsv.gz with its .tbi index (for coverage plots). The .tar.gz file is no longer needed.

2. Load the dataset

  1. Open CellPilot.
  2. In the Data Loader & Model panel, set Data Type to scATAC-seq and Data to Single sample.
  3. Click Browse and select the prepared folder (not a single file inside it).
  4. Wait for the analysis to finish; the status messages in the chat show each step.

CellPilot runs a chromatin accessibility workflow on your computer: it keeps cells with more than 1,500 accessible peaks, normalizes with TF-IDF, selects the most accessible peaks, reduces them with LSI (latent semantic indexing), builds a UMAP and a nearest-neighbor graph from the LSI components, and finds clusters with the Louvain algorithm.

What you should see: 10,134 of 10,246 cells are kept, the UMAP shows 16 clusters (numbered from 0), and the data panel shows 10X ATAC with 10,134 cells and 165,434 peaks.
CellPilot after loading the 10k PBMC scATAC dataset
After loading: ATAC clusters on the UMAP (top left), the Peak View (top right; empty until you plot a gene), and the data panel (bottom right).

3. Explore clusters and marker peaks

Tell me about cluster 6
Find marker peaks for cluster 2
List 10 peaks
List cells

Tell me about cluster 6 answers in the chat with the cluster size and its top marker peaks. Find marker peaks for cluster 2 opens the marker table: peaks (written as chromosome-start-end) that are more accessible in the cluster than in all other cells, tested with a Wilcoxon rank-sum test on depth-normalized accessibility. pct.1 and pct.2 are the fractions of cells with a fragment in the peak inside and outside the cluster. List 10 peaks and List cells show the first peaks and cell barcodes of the dataset.

Cluster 6 has 564 cells (5.6% of all cells). Cluster 2 has 557 cells; it is the B-cell cluster (see step 4).
Marker peak table of cluster 2
Marker peaks of cluster 2.

4. Plot gene activity

scATAC data has no gene expression. CellPilot estimates each gene's activity from the accessibility of the peaks linked to it in peak_annotation.tsv (its promoter and nearby regions), and plots it like expression:

Plot gene activity for MS4A1
Violin plot gene activity for MS4A1
Dotplot MS4A1 CD3D CD14 NKG7
Change color to green black red

MS4A1 (CD20) marks B cells, CD3D T cells, CD14 classical monocytes and NKG7 NK cells. The dot plot compares them across clusters (dot size: fraction of cells with activity; color: mean activity). Change color recolors the last activity or dot plot.

UMAP colored by MS4A1 gene activity, with the Peak View
Plot gene activity for MS4A1: highest in cluster 2 (B cells). The Peak View notes the 9 peaks linked to MS4A1 and how to show their coverage.
Violin plot of MS4A1 gene activity
Violin plot gene activity for MS4A1.
Dot plot of four lineage genes
Dotplot MS4A1 CD3D CD14 NKG7.
Dot plot with a green-black-red color scale
Change color to green black red.

5. View accessibility coverage

With fragments.tsv.gz and its index in the folder, CellPilot reads the fragments around a gene and draws the accessibility track of each cluster in the Peak View, with the peaks and the gene above:

Coverage plot CD14
CD14 coverage tracks by cluster
Coverage plot CD14: gene activity on the UMAP and the CD14 coverage of each cluster in the Peak View; the monocyte clusters have the strongest signal.

A plain Plot gene activity command only colors the UMAP; the Peak View then reminds you to ask coverage plot GENE for the tracks. Without the fragments file, gene activity, violin and dot plots still work, but coverage plots are not available.

6. Name clusters

CellPilot names cell types automatically (Annotate all clusters) only from gene expression, so for scATAC data it explains that this is accessibility data. Use the gene activity of known markers instead (step 4) and rename the clusters yourself:

Rename cluster 2 to B cells
Find marker peaks for B cells
The UMAP, plots and marker searches now use the name; the B-cell marker table covers the 557 cells of cluster 2.
UMAP with cluster 2 renamed to B cells and its marker peaks
Left: cluster 2 now labelled B cells on the UMAP. Right: Find marker peaks for B cells (557 cells).

7. Adjust analysis parameters

List parameters
Rerun ATAC UMAP with min dist = 0.4
Recluster the cells using resolution = 2.0
CommandWhat happens
List parametersShows the settings of each step: cell filtering, TF-IDF, the peaks used (157,339 peaks above the 5th percentile of total counts), LSI (50 components; components 2–30 are used because component 1 follows sequencing depth), neighbors / UMAP, and Louvain clustering at resolution 0.8.
Rerun ATAC UMAP with min dist = 0.4Recomputes only the UMAP layout (larger values spread the points more); clusters stay the same.
Recluster the cells using resolution = 2.0Recomputes the clusters: higher resolution gives more, smaller clusters (25 clusters here), lower gives fewer.

Reclustering creates new clusters, so cluster names you gave earlier are cleared.

scATAC pipeline parameters in the chat
List parameters.
UMAP after reclustering at resolution 2.0
After Recluster the cells using resolution = 2.0: 25 clusters.

8. Save and revisit results

CellPilot saves the analysis (UMAP, clusters, and cluster names) as cellpilot_results.json in the data folder. When you load the same folder again, CellPilot asks whether to load the previous results, so you can continue where you left off without rerunning the analysis.