Brick_export_to_sparse: Export an entire resolution from a given BrickContainer as a...

Description Usage Arguments Value Examples

View source: R/Brick_functions.R

Description

Brick_export_to_sparse will accept as input an object of class BrickContainer, a string of length 1 as resolution and a path specifying the output file to write. It writes the content of the all loaded Brick objects as a upper triangle sparse matrix (col > row) containing non-zero values.

Usage

1
2
3
4
5
6
7
Brick_export_to_sparse(
    Brick,
    out_file,
    remove_file = FALSE,
    resolution,
    sep = " "
)

Arguments

Brick

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

out_file

Path to the output file to write.

remove_file

Default FALSE. If a file by the same name is present that file will be removed.

resolution

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

sep

column delimiter in output file. Default single space.

Value

Returns a data.frame corresponding to the head of the output file

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
package = "HiCBricks")

out_dir <- file.path(tempdir(), "write_file")
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)

Matrix_file <- system.file(file.path("extdata", 
"Sexton2012_yaffetanay_CisTrans_100000_corrected_chr2L.txt.gz"), 
package = "HiCBricks")

Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr2L", 
chr2 = "chr2L", matrix_file = Matrix_file, delim = " ", 
remove_prior = TRUE, resolution = 100000)

Brick_export_to_sparse(Brick = My_BrickContainer, 
out_file = file.path(out_dir, "example_out.txt"), 
resolution = 100000)

HiCBricks documentation built on Nov. 8, 2020, 7:45 p.m.