bootstrap_dataset: Bootstraps interactions from given Hi-C dataset.

Description Usage Arguments Value Examples

Description

Dataset containing number of Hi-C contact maps is used to sample interactions with or without replacement.

Usage

1
2
3
4
5
6
7
8
9
bootstrap_dataset(
  path,
  ratio = list(c(0.5, 0.5)),
  with.replacement = FALSE,
  N = 3,
  mtx.names = "all",
  n.cores = 1,
  save.path = NULL
)

Arguments

path

character path to Hi-C dataset in npz format

ratio

list with vectors - ratios for bootstrap_sparse; if contains only one element (one ratio vector) then the same ratio vector is used for all contact maps in given Hi-C dataset; otherwise names of elements (ratio vectors) in list must match those in given Hi-C dataset

with.replacement

logical which type of sampling

N

numeric number of repetitions, i.e. number of bootstraps; each bootstrap will have number of maps equal to length of corresponding entry in ratio list

mtx.names

character vector with subset of Hi-C maps names to be selected for analysis, by default all matrices are used

n.cores

numeric number of cores to be used for parallel processing

Value

list containing bootstraps of corresponding matrices of Hi-C dataset

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# say we have 2 Hi-C datasets: IMR90-MboI-1 and MSC-HindIII-1 in 40kb
npz1 <- read_npz("IMR90-MboI-1_40kb-raw.npz")
npz2 <- read_npz("MSC-HindIII-1_40kb-raw.npz")
# we want to produce 2*4 bootstraps of IMR90:
# 4 with the same number of interactions as in IMR90-MboI-1 and
# 4 with the same number of interactions as in MSC-HindIII-1
# first calculate number of interactions in both datasets on all chromosomes
nm <- intersect(names(npz1), names(npz2))
ratio <- lapply(nm, function(x) c(sum(npz1[[x]]$val), sum(npz2[[x]]$val)))
names(ratio) <- nm
# now produce bootstraps - pairs of bootstrap maps such that the number of interactions corresponds to first and second datasets can be used to asses technical variability including different sequencing depth
bts <- bootstrap_dataset("IMR90-MboI-1_40kb-raw.npz", N = 4, with.replacement = TRUE, ratio = ratio, save.path = "~/bootstrapped")

rz6/CopulaHiC documentation built on Dec. 31, 2019, 9:19 a.m.