Learn R Programming

diffHic (version 1.4.2)

totalCounts: Get the total counts

Description

Get the total number of read pairs in a set of Hi-C libraries.

Usage

totalCounts(files, param)

Arguments

files
a character vector containing paths to the index files generated from each Hi-C library
param
a pairParam object containing read extraction parameters

Value

An integer vector is returned containing the total number of read pairs in each library.

Details

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.

See Also

preparePairs, cutGenome, pairParam, squareCounts

Examples

Run this code
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 <- "output.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


Run the code above in your browser using DataLab