Brick_add_ranges {HiCBricks} | R Documentation |
Brick_add_ranges
loads a GRanges object into the Brick store.
Brick_add_ranges(Brick, ranges, rangekey, remove.existing = TRUE)
Brick |
Required. A string specifying the path to the Brick store created with CreateBrick. |
ranges |
Required. An object of class ranges specifying the ranges to store in the Brick. |
rangekey |
Required. The name to use for the ranges within the Brick store. |
remove.existing |
Optional. TRUE Will remove an existing Ranges by the same name and introduce the new one. |
With this function it is possible to associate other ranges objects with the Brick store. If metadata columns are present, the are also loaded into the Brick store. Although not explicitly asked for, the metadata columns should not be of type list as this may create complications down the line. We ask for ranges objects, so if the same ranges object is later retrieved two additional columns will be present. These are the strand and width columns that are obtained when a ranges is converted into a data.frame. Users can ignore these columns.
Returns TRUE if completed successfully.
Bintable.path <- system.file("extdata", "Bintable_40kb.txt", package = "HiCBricks") Chromosomes <- "chr19" Path_to_cached_file <- CreateBrick(ChromNames = Chromosomes, BinTable = Bintable.path, bin.delim = " ", Output.Filename = file.path(tempdir(),"test.hdf"), exec = "cat", remove.existing = TRUE) Chrom <- c("chrS","chrS","chrS","chrS","chrS") Start <- c(10000,20000,40000,50000,60000) End <- c(10001,20001,40001,50001,60001) Test_ranges <- Brick_make_ranges(Chrom = Chrom, Start = Start, End = End) Brick_add_ranges(Brick = Path_to_cached_file, ranges = Test_ranges, rangekey = "test_ranges") ## Not run: Brick.file <- system.file("extdata", "test.hdf", package = "HiCBricks") Chrom <- c("chrS","chrS","chrS","chrS","chrS") Start <- c(10000,20000,40000,50000,60000) End <- c(10001,20001,40001,50001,60001) Test_ranges <- Brick_make_ranges(Chrom = Chrom, Start = Start, End = End) Brick_add_ranges(Brick = Brick.file, ranges = Test_ranges, rangekey = "test_ranges", remove.existing = TRUE) ## End(Not run)