totalCounts {diffHic} | R Documentation |
Get the total number of read pairs in a set of Hi-C libraries.
totalCounts(files, param)
files |
a character vector containing paths to the index files generated from each Hi-C library |
param |
a |
As the name suggests, this function counts the total number of read pairs in each index file prepared by preparePairs
.
Use of param$fragments
ensures that the chromosome names in each index file are consistent with those in the desired genome (e.g., from cutGenome
).
Counting will also consider the values of restrict
, discard
and cap
in param
.
An integer vector is returned containing the total number of read pairs in each library.
Aaron Lun
preparePairs
,
cutGenome
,
pairParam
,
squareCounts
hic.file <- system.file("exdata", "hic_sort.bam", package="diffHic") cuts <- readRDS(system.file("exdata", "cuts.rds", package="diffHic")) param <- pairParam(cuts) # Setting up the parameters fout <- tempfile(fileext=".h5") invisible(preparePairs(hic.file, param, file=fout)) # Counting totals, and comparing them. totalCounts(fout, param) squareCounts(fout, param, width=10)$totals new.param <- reform(param, restrict="chrA") totalCounts(fout, new.param) squareCounts(fout, new.param, width=10)$totals new.param <- reform(param, discard=GRanges("chrA", IRanges(1, 50))) totalCounts(fout, new.param) squareCounts(fout, new.param, width=10)$totals new.param <- reform(param, cap=1) totalCounts(fout, new.param) squareCounts(fout, new.param, width=10)$totals