Extract nucleosome positions from ATAC-seq data using NucleoATAC, ATACseqQC, and fragment analysis. Use when analyzing chromatin organization, identifying nucleosome-free regions at promoters, or characterizing nucleosome occupancy patterns from ATAC-seq fragment size distributions.
Before using code patterns, verify installed versions match. If versions differ:
Python: pip show <package> then help(module.function) to check signatures
R: packageVersion('<pkg>') then ?function_name to verify parameters
CLI: <tool> --version then <tool> --help to confirm flags
If code throws ImportError, AttributeError, or TypeError, introspect the installed
package and adapt the example to match the actual API rather than retrying.
Nucleosome Positioning
"Map nucleosome positions from ATAC-seq" → Separate nucleosome-free and mono-nucleosome fragments by size, then call nucleosome center positions and occupancy scores.
CLI: nucleoatac run --bed peaks.bed --bam atac.bam --fasta ref.fa
R: ATACseqQC::splitGAlignmentsByCut() for fragment separation
Extract nucleosome positions and occupancy from ATAC-seq fragment size patterns.
Background
ATAC-seq fragments reflect chromatin structure:
< 100 bp: Nucleosome-free regions (NFR)
180-247 bp: Mono-nucleosome
315-473 bp: Di-nucleosome
558-615 bp: Tri-nucleosome
ATACseqQC (R)
Installation
BiocManager::install('ATACseqQC')
Fragment Size Distribution
library(ATACseqQC)
library(Rsamtools)
# Read BAM
bamfile <- 'sample.bam'
# Fragment size distribution
fragSize <- fragSizeDist(bamfile, 'sample')
# Nucleosome-free and mono-nucleosome ratios
# Automatic QC metrics
Installs
0
Nucleosome Positioning
Goal: Map nucleosome positions around TSS using ATAC-seq fragment size classes.
Approach: Read BAM, apply Tn5 shift correction, split fragments into NFR and mono-nucleosome classes by size, then compute signal profiles around TSS.
library(ATACseqQC)
library(TxDb.Hsapiens.UCSC.hg38.knownGene)
library(BSgenome.Hsapiens.UCSC.hg38)
# Get TSS regions
txs <- transcripts(TxDb.Hsapiens.UCSC.hg38.knownGene)
tss <- promoters(txs, upstream=1000, downstream=1000)
# Read BAM
gal <- readBamFile(bamfile, asMates=TRUE, bigFile=TRUE)
# Shift reads (Tn5 offset correction)
gal_shifted <- shiftGAlignmentsList(gal)
# Split by nucleosome-free and nucleosomal
objs <- splitGAlignmentsByCut(gal_shifted, txs=txs,
genome=BSgenome.Hsapiens.UCSC.hg38)
# nucleosome-free fragments
nfr <- objs$NussomeFree
# Mono-nucleosome fragments
mono <- objs$mononucleosome
# Signal around TSS
sigs <- featureAlignedSignal(cvglist=objs,
feature.gr=tss,
upstream=1000,
downstream=1000)