Calculate ArchR-compatible per-cell QC statistics
Arguments
- fragments
IterableFragments object
- genes
Gene coordinates given as GRanges, data.frame, or list. See
help("genomic-ranges-like")
for details on format and coordinate systems. Required attributes:chr
,start
,end
: genomic position
- blacklist
Blacklisted regions given as GRanges, data.frame, or list. See
help("genomic-ranges-like")
for details on format and coordinate systems. Required attributes:chr
,start
,end
: genomic position
Details
This implementation mimics ArchR's default parameters. For uses requiring more flexibility to tweak default parameters, the best option is to re-implement this function with required changes. Output columns of data.frame:
cellName
: cell name for each cellnFrags
: number of fragments per cellsubNucleosomal
,monoNucleosomal
,multiNucleosomal
: number of fragments of size 1-146bp, 147-254bp, and 255bp + respectively. equivalent to ArchR's nMonoFrags, nDiFrags, nMultiFrags respectivelyTSSEnrichment
:AvgInsertInTSS / max(AvgInsertFlankingTSS, 0.1)
, whereAvgInsertInTSS
isReadsInTSS / 101
(window size), andAvgInsertFlankingTSS
isReadsFlankingTSS / (100*2)
(window size). Themax(0.1)
ensures that very low-read cells do not get assigned spuriously high TSSEnrichment.ReadsInPromoter
: Number of reads from 2000bp upstream of TSS to 101bp downstream of TSSReadsInBlacklist
: Number of reads in the provided blacklist regionReadsInTSS
: Number of reads overlapping the 101bp centered around each TSSReadsFlankingTSS
: Number of reads overlapping 1901-2000bp +/- each TSS
Differences from ArchR: Note that ArchR by default uses a different set of annotations to derive TSS sites and promoter sites. This function uses just one annotation for gene start+end sites, so must be called twice to exactly re-calculate the ArchR QC stats.
ArchR's PromoterRatio
and BlacklistRatio
are not included in the output, as they can be easily calculated
from ReadsInPromoter / nFrags
and ReadsInBlacklist / nFrags
. Similarly, ArchR's NucleosomeRatio
can be calculated
as (monoNucleosomal + multiNucleosomal) / subNucleosomal
.
Examples
## Prep data
frags <- get_demo_frags()
reference_dir <- file.path(tempdir(), "references")
genes <- read_gencode_transcripts(
reference_dir,
release="42",
transcript_choice="MANE_Select",
annotation_set = "basic",
features="transcript"
)
blacklist <- read_encode_blacklist(reference_dir, genome = "hg38")
## Run qc
head(qc_scATAC(frags, genes, blacklist))
#> # A tibble: 6 × 10
#> cellName TSSEnrichment nFrags subNucleosomal monoNucleosomal multiNucleosomal
#> <chr> <dbl> <int> <int> <int> <int>
#> 1 TTTAGCAA… 25.8 1387 704 476 207
#> 2 AGCCGGTT… 24.5 2983 1430 1040 513
#> 3 TGATTAGT… 18.5 1093 542 367 184
#> 4 ATTGACTC… 23.0 1204 654 355 195
#> 5 CGTTAGGT… 21.5 1387 610 520 257
#> 6 AAACCGCG… 42.9 2650 1279 925 446
#> # ℹ 4 more variables: ReadsInTSS <dbl>, ReadsFlankingTSS <dbl>,
#> # ReadsInPromoter <dbl>, ReadsInBlacklist <dbl>