| name | archr |
| domain | compbio |
| description | R package for single-cell ATAC-seq analysis. Use for chromatin accessibility analysis, peak calling, motif enrichment, and integration with gene expression. |
| license | MIT license |
| metadata | {"skill-author":"Eric Yiru"} |
ArchR: Single-Cell ATAC-Seq Analysis
Overview
ArchR is a powerful R package for analyzing single-cell ATAC-seq (Assay for Transposase-Accessible Chromatin sequencing) data. It provides a complete workflow from raw reads to interpretation, including dimensionality reduction, clustering, peak calling, motif analysis, and integration with gene expression data.
When to Use This Skill
This skill should be used when:
- Analyzing single-cell ATAC-seq data
- Performing chromatin accessibility analysis
- Identifying cell types based on chromatin state
- Finding regulatory elements and TF motifs
- Integrating scATAC-seq with scRNA-seq
- Creating pseudo-bulk accessibility tracks
Quick Start
Installation
install.packages("ArchR")
devtools::install_github("GreenleafLab/ArchR", ref="master")
install.packages("BSgenome.Hsapiens.UCSC.hg38")
Basic Setup
library(ArchR)
library(ggplot2)
library(dplyr)
addArchRGenome("hg38")
Creating ArchR Project
From Fragments
inputFiles <- c(
"sample1" = "path/to/sample1.fragments.tsv.gz",
"sample2" = "path/to/sample2.fragments.tsv.gz"
)
ArrowFiles <- createArrowFiles(
inputFiles = inputFiles,
sampleNames = names(inputFiles),
filterTSS = 4,
filterFrags = 1000,
addTileMat = TRUE,
addGeneScoreMat = TRUE
)
proj <- ArchRProject(
ArrowFiles = ArrowFiles,
outputDirectory = "ArchR_Project"
)
Analysis Workflow
Dimensionality Reduction
proj <- addIterativeLSA(
ArchRProj = proj,
useMatrix = "TileMatrix",
name = "IterativeLSI",
clusterParams = list(
resolution = c(0.2, 0.4, 0.8),
sampleCells = 10000,
n.start = 10
)
)
Clustering
proj <- addClusters(
input = proj,
reducedDims = "IterativeLSI",
method = "Seurat",
name = "Clusters",
resolution = 0.8
)
UMAP
proj <- addUMAP(
ArchRProj = proj,
reducedDims = "IterativeLSI",
name = "UMAP",
minDist = 0.3,
metric = "cosine"
)
p1 <- plotEmbedding(ArchRProj = proj, colorBy = "cellColData", name = "Clusters")
Marker Peaks
markersPeaks <- getMarkerFeatures(
ArchRProj = proj,
useMatrix = "PeakMatrix",
groupBy = "Clusters",
bias = c("TSSEnrichment", "log10(nFrags)"),
testMethod = "wilcoxon"
)
markerList <- getMarkers(markersPeaks, returnGRanges = TRUE)
Gene Scores
p2 <- plotEmbedding(
proj,
colorBy = "GeneScoreMatrix",
name = c("CD4", "CD8A"),
embedding = "UMAP"
)
Peak Analysis
Peak Calling
proj <- addPeaks(
proj,
groupBy = "Clusters",
cutOff = 0.05,
extend = -500
)
proj <- addPeaks(
proj,
groupBy = "Clusters",
method = "macs2",
macs2Path = "path/to/macs2"
)
Peak Annotation
proj <- addPeakAnnotations(
proj,
resources = ArchRResources,
names = "Motifs",
analysis = "motifEnrichment"
)
Integration
With scRNA-seq
proj <- addGeneIntegrationMatrix(
ArchRProj = proj,
useMatrix = "GeneScoreMatrix",
nameX = "predictedRNA",
nameY = "RNA",
reduceDims = "IterativeLSI"
)
Cross-modality
library(Seurat)
atac <- ArchRtoSeurat(proj)
atac <- RunPCA(atac)
atac <- RunUMAP(atac, dims = 1:30)
atac <- FindNeighbors(atac)
atac <- FindClusters(atac)
Visualization
Browser Tracks
exportToBrowser(
ArchRProj = proj,
exportAs = "bedGraph",
peaks = TRUE,
folder = "Browser"
)
Heatmaps
heatmapPeaks <- markerHeatmap(
markersPeaks,
cutOff = 5,
nLabel = 10
)
Key Parameters
createArrowFiles
filterTSS: Minimum TSS enrichment (default: 4)
filterFrags: Minimum fragment count (default: 1000)
addTileMat: Add tile matrix (default: TRUE)
addGeneScoreMat: Add gene score matrix (default: TRUE)
Best Practices
- Quality control: Check TSS enrichment and fragment counts
- Filter properly: Adjust thresholds based on data quality
- Peak calling: Use sufficient cell numbers per group
- Motif analysis: Requires appropriate genome
Additional Resources