makeBSseq: Make an in-memory bsseq object from a biscuit BED

Description Usage Arguments Value Examples

View source: R/makeBSseq.R

Description

Beware that any reasonably large BED files may not fit into memory!

Usage

1
makeBSseq(tbl, params, simplify = FALSE, verbose = FALSE)

Arguments

tbl

A tibble (from read_tsv) or a data.table (from fread)

params

Parameters from checkBiscuitBED

simplify

Simplify sample names by dropping .foo.bar.hg19? (or similar) (DEFAULT: FALSE)

verbose

Print extra statements? (DEFAULT: FALSE)

Value

1
     An in-memory bsseq object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
  library(data.table)
  library(R.utils)

  orig_bed <- system.file("extdata", "MCF7_Cunha_chr11p15.bed.gz",
                          package="biscuiteer")
  orig_vcf <- system.file("extdata", "MCF7_Cunha_header_only.vcf.gz",
                          package="biscuiteer")
  params <- checkBiscuitBED(BEDfile = orig_bed, VCFfile = orig_vcf,
                            merged = FALSE, how = "data.table")

  select <- grep("\\.context", params$colNames, invert=TRUE)
  tbl <- fread(gunzip(params$tbx$path, remove = FALSE), sep="\t", sep2=",",
               fill=TRUE, na.strings=".", select=select)
  unzippedName <- sub("\\.gz$", "", params$tbx$path)
  if (file.exists(unzippedName)) {
    file.remove(unzippedName)
  }
  if (params$hasHeader == FALSE) names(tbl) <- params$colNames[select]
  names(tbl) <- sub("^#", "", names(tbl))
  
  tbl <- tbl[rowSums(is.na(tbl)) == 0, ]
  bsseq <- makeBSseq(tbl = tbl, params = params)

biscuiteer documentation built on Nov. 8, 2020, 8:28 p.m.