make_scc_dt: make_scc_dt

View source: R/functions_make.R

make_scc_dtR Documentation

make_scc_dt

Description

Calculate Strand Cross Correlation (SCC) for several bam files defined in query_dt at regions defined by query_gr and return tidy data.table.

Usage

make_scc_dt(
  query_dt,
  query_gr,
  frag_sizes = seq(50, 350, 10),
  fetch_size = 3 * max(frag_sizes),
  bfc = new_cache(),
  name_var = "name_split",
  n_cores = getOption("mc.cores", 1L),
  ...
)

Arguments

query_dt

data.table with query information. Only really needs file as first column.

query_gr

GRanges of regions to calculate SCC for

frag_sizes

optional numeric. Fragment sizes to calculate correlation at. The higher the resolution the longer calculation will take. The default is to count by 10 from 50 to 350.

fetch_size

optional numeric. Size in bp centered around each interval in query_gr to retrieve. Should be greater than max frag_size. The default is 3*max(frag_sizes).

bfc

BiocFileCache object to use.

name_var

Character. Variable where name information is stored.

n_cores

Number of cores to use. Defaults to mc.cores if set or 1.

...

passed to Rsamtools::ScanBamParam()

Value

list fo tidy data.table of SCC data for every bam file in query_dt

Examples

peak_file = dir(system.file("extdata", package = "seqqc"),
  pattern = "test_peaks.bed$", full.names = TRUE)
bam_file = dir(system.file("extdata", package = "seqqc"),
  pattern = "test_peaks.bam$", full.names = TRUE)

query_gr = seqsetvis::easyLoad_bed(peak_file)[[1]]
query_dt = data.table(file = rep(bam_file, 2))
#attributes added here will be carried forward to the final data.tables
query_dt$name = c("A", "B")
query_dt$value = c(.3, .7)

scc_res = make_scc_dt(query_dt, query_gr)

#making the data.table can be skipped for conveinence
#also run at higher resolution if a more precise estimate of fragment size is required
scc_res = make_scc_dt(bam_file, query_gr, frag_sizes = seq(150, 210, 1))

FrietzeLabUVM/ssvQC documentation built on March 25, 2024, 12:24 a.m.