snapatac2-atac-preprocessing

Preprocess scATAC-seq fragment files into embeddings, peak matrices, and gene-activity scores with SnapATAC2.

1|Updated Nov 20, 2025
One-click install
npx skills add https://github.com/tony-zhelonkin/scio --skill snapatac2-atac-preprocessing-tony-zhelonkin
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: snapatac2-atac-preprocessing
Source: https://github.com/tony-zhelonkin/scio/tree/main/skills/snapatac2-atac-preprocessing
Command: npx skills add https://github.com/tony-zhelonkin/scio --skill snapatac2-atac-preprocessing-tony-zhelonkin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires snapatac2, episcanpy, macs2, muon, scikit-learn, pandas, numpy.

What problem does it solve? Single-cell ATAC-seq data arrives as raw fragment files that must be quality-filtered, dimensionality-reduced, and converted into peak or gene-activity matrices before any clustering or multiomic analysis can begin. This Skill provides the complete SnapATAC2 preprocessing workflow so you can go from a 10x fragments.tsv.gz file to an analysis-ready AnnData object without re-deriving each step. ## Core Features & Use Cases - Fragment import and QC: Import fragments.tsv.gz directly into AnnData, compute TSS enrichment and fragment-size distributions, and filter cells by counts and TSS score. - Peak calling and matrices: Call peaks de novo with MACS2 or quantify against an existing BED peak set, producing a disk-backed peaks.h5ad file. - Embeddings and gene activity: Run spectral embedding (or TF-IDF + LSI with depth-correlation checks), UMAP, Leiden clustering, and gene-activity scoring against hg38 or mm10 annotations. - Use Case: You receive Cell Ranger ARC output from a multiome experiment and need the ATAC modality embedded and clustered so it can be integrated with RNA data in a MuData object for joint analysis. ## Quick Start Use SnapATAC2 to import my atac_fragments.tsv.gz file, run TSS enrichment QC, build a spectral embedding, and call peaks into a peaks.h5ad file.

Frequently Asked Questions about snapatac2-atac-preprocessing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I preprocess scATAC-seq data with SnapATAC2?▼

Import the fragments.tsv.gz file with snap.pp.import_data, compute TSS enrichment with snap.metrics.tsse, filter cells by counts and TSS score, then run feature selection and spectral embedding. The result is an AnnData object ready for UMAP, Leiden clustering, and peak calling.

How do I call peaks from scATAC-seq fragment files?▼

Use snap.pp.make_peak_matrix with peak_file=None to call peaks de novo via MACS2, grouping cells by spectral embedding. Alternatively pass an existing BED file of peaks or ENCODE cCREs to quantify a fixed peak set into a peaks.h5ad file.

Should I use spectral embedding or TF-IDF with LSI for ATAC data?▼

Spectral embedding via snap.pp.spectral is the SnapATAC2 default and is robust to sequencing depth. Use TF-IDF plus truncated SVD (LSI) when you need compatibility with downstream Harmony or Seurat workflows, but check whether LSI component 1 correlates with depth and drop it if |r| > 0.5.

Why does my first LSI component correlate with sequencing depth?▼

LSI component 1 frequently captures library size rather than biology in sparse binary ATAC matrices. Compute the correlation between X_lsi[:, 0] and per-cell counts; if |r| > 0.5, exclude component 1 and use X_lsi[:, 1:] for all downstream steps.

When should I not use SnapATAC2 for ATAC analysis?▼

Do not use it for R-based Signac workflows, which are handled by signac-chromatin-analysis, or for cisTopic topic modelling, which belongs to pycistopic-atac-topic-modeling. It also does not cover scRNA-seq QC, normalization, or RNA velocity.

What input files does SnapATAC2 preprocessing require?▼

It requires a fragments.tsv.gz file from Cell Ranger ARC, Cell Ranger ATAC, or manual processing, plus a reference genome such as snap.genome.hg38 or mm10 for TSS enrichment and gene-activity scoring. MACS2 must be on PATH for de novo peak calling.