cooler_methods: Methods for manipulating cooler files

cooler_methodsR Documentation

Methods for manipulating cooler files

Description

These are a set of methods for working with data in cooler file format.

Usage

getChrIdx(chr.length, chr, step)
getChrCGFromCools(files, chr, step, index.gr, work.dir, exp.name,
                  coldata, norm.factor=NULL)
cg2bedgraph2(cg, out.dir, prefix)

Arguments

chr.length

The length of a chromosome.

step

The resolution of the data inside the cooler file.

files

A vector of cooler file names.

chr

The target chromosome to be read.

index.gr

A GRanges object, can be output from getChrIdx.

work.dir

Directory for saving temporary files.

exp.name

The name of the experiment, will be appended all output file names.

coldata

A data.frame or DataFrame of metadata for the ContactGroup object.

cg

A ContactGroup object.

out.dir

A directory in which individual bedgraph2 (BG2) files are to be written.

prefix

A prefix for all output files; e.g. "treatment_study_".

norm.factor

The normalization factor

Details

These methods allow for the normalization of cooler files. Users must create their own index, for which we provide getChrIdx, which is an input into getChrCGFromCools, which uses HiCBricks to access the cooler files, and returns a ContactGroup object. Users can then follow the standard pipeline, and save their data in bedgraph2 (BG2) format using cg2bedgraph2. cooler provides a tool to convert this format to cooler and users are encouraged to make use of this tool. Note that HiCBricks expects multiple resolutions in the cooler file.

Value

For getChrIdx a GRanges object with coordinates for each bin. For getChrCGFromCools, a ContactGroup object. There is nothing returned by cg2bedgraph2.

See Also

ContactGroup

Examples

## Not run: 
coolerDir <- system.file("cooler", package = "bnbc")
cools <- list.files(coolerDir, pattern="cool$", full.names=TRUE)

step <- 4e4

ixns <- bnbc:::getGenomeIdx(seqlengths(BSgenome.Hsapiens.UCSC.hg19)["chr22"], step)

data(cgEx)
cool.cg <- bnbc:::getChrCGFromCools(files = cools,
chr = "chr22",
step=step,
index.gr=ixns,
work.dir="tmp.dir",
exp.name="example_case",
colData = colData(cgEx)[1:2,])
all.equal(contacts(cgEx)[[1]], contacts(cool.cg)[[1]])

## End(Not run)

hansenlab/bnbc documentation built on Feb. 4, 2024, 7:20 a.m.