loadData: Load data from an index file

Description Usage Arguments Details Value Author(s) Examples

View source: R/h5utils.R

Description

Load read pair data and chromosome names from a HDF5 index file.

Usage

1
2
loadChromos(file)
loadData(file, anchor1, anchor2)

Arguments

file

a character string containing a path to a index file

anchor1, anchor2

a character string, specifying the name of the chromosomes in a pair

Details

The purpose of these function is to allow users to perform custom analyses by extracting the data manually from each index file. This may be desirable, e.g., when preparing data for input into other tools. To extract all data, users are advised to run loadData iteratively on each pair of chromosomes as obtained with loadChromos.

Note that loadData will successfully operate even if the anchor1/anchor2 specification is permuted. In this case, it will return a warning to inform the user that the names should be switched.

Value

The loadChromos function will return a dataframe with character fields anchor1 and anchor2. Each row represents a pair of chromosomes, the names of which are stored in the fields. The presence of a row indicates that the data for the corresponding pair exists in the file.

The loadData function will return a dataframe where each row contains information for one read pair. Refer to preparePairs for more details on the type of fields that are included.

Author(s)

Aaron Lun

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
hic.file <- system.file("exdata", "hic_sort.bam", package="diffHic")
cuts <- readRDS(system.file("exdata", "cuts.rds", package="diffHic"))
param <- pairParam(cuts) 

tmpf <- tempfile(fileext=".h5")
preparePairs(hic.file, param, tmpf)

loadChromos(tmpf)
loadData(tmpf, "chrA", "chrA")
loadData(tmpf, "chrB", "chrA")
loadData(tmpf, "chrA", "chrB")
try(loadData(tmpf, "chrA2", "chrB2"))

diffHic documentation built on Nov. 8, 2020, 6:02 p.m.