Brick_fetch_range_index: Returns the position of the supplied ranges in the binning...

View source: R/Brick_functions.R

Brick_fetch_range_indexR Documentation

Returns the position of the supplied ranges in the binning table associated to the Hi-C experiment.

Description

Brick_fetch_range_index constructs a ranges object using Brick_make_ranges, creates an overlap operation using GenomicRanges::findOverlaps, where the constructed ranges is the subject and the Hi-C experiment associated binning table is the query. The return of this object is a list of ranges with their corresponding indices in the binning table.

Usage

Brick_fetch_range_index(
    Brick = NA,
    chr = NA,
    start = NA,
    end = NA,
    names = NA,
    resolution = NA,
    type = "any"
)

Arguments

Brick

Required. A string specifying the path to the Brick store created with Create_many_Brick.

chr

Required. A character vector of length N specifying the chromosomes to select from the ranges.

start

Required. A numeric vector of length N specifying the start positions in the chromosome

end

Required. A numeric vector of length N specifying the end positions in the chromosome

names

Optional. A character vector of length N specifying the names of the chromosomes. If absent, names will take the form chr:start:end.

resolution

Optional. Default NA When an object of class BrickContainer is provided, resolution defines the resolution on which the function is executed

type

Optional. Default any Type of overlap operation to do. It should be one of two, any or within. any considers any overlap (atleast 1 bp) between the provided ranges and the binning table.

Value

Returns a GenomicRanges object of same length as the chr, start, end vectors provided. The object is returned with an additional column, Indexes. Indexes is a column of class IRanges::IntegerList, which is part of the larger IRanges::AtomicList superset. This "Indexes" column can be accessed like a normal GRanges column with the additional list accessor [[]] in place of the normal vector accessor [].

Examples


Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
package = "HiCBricks")

out_dir <- file.path(tempdir(), "fetch_range_index_test")
dir.create(out_dir)

My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
  bin_delim = " ", output_directory = out_dir, file_prefix = "Test",
  experiment_name = "Vignette Test", resolution = 100000,
  remove_existing = TRUE)

Chrom <- c("chr2L","chr2L")
Start <- c(1,40000)
End <- c(1000000,2000000)

Test_Run <- Brick_fetch_range_index(Brick = My_BrickContainer, 
chr = Chrom, start = Start, end = End, resolution = 100000)
Test_Run$Indexes[[1]]


koustav-pal/HiCBlocks documentation built on Oct. 29, 2022, 8:17 a.m.