model_bin: Obtain readcounts adjusted for several forms of technical and...

Description Usage Arguments Value Examples

Description

Parametrizes a negative binomial null model for the readcounts in a given distance bin. Covariates are the distance between an interaction's bait and prey fragments, their lengths, and transchromosomal bait activity. Randomized quantile residuals computed from this model are taken as noise-adjusted readcounts.

Usage

1
2
3
4
5
6
7
8
9
model_bin(
  bin,
  subsample_size = NA,
  gamlss_cycles = 200,
  gamlss_crit = 0.1,
  formula_add = NA,
  formula_replace = NA,
  log_file = NA
)

Arguments

bin

Data table containing putative interactions in the same distance bin.

subsample_size

Number of interactions based on which the null-model is parametrized. By default, all are used.

gamlss_cycles

GAMLSS maximum number of cycles for convergence (see gamlss::gamlss.control).

gamlss_crit

GAMLSS convergence criterion (see gamlss::gamlss.control).

formula_add

Additional covariates for the default model formula. To add covariates A and B when modelling counts, supply "A + B".

formula_replace

Replaces the default model formula entirely. Suppled in the form "N ~ A + B". Takes precedence over formula_add.

log_file

Path to a log file.

Value

List containing the fitted null model ($fit) and the adjusted readcounts ($residuals).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
base = system.file("extdata",package="peaky")

interactions_file = paste0(base,"/counts.tsv")
bins_dir = paste0(base,"/bins")
fragments_file = paste0(base,"/fragments.bed")

interactions = data.table::fread(interactions_file)
fragments = data.table::fread(fragments_file)

## Not run: 
BI = bin_interactions(interactions, fragments, bins=5)
BM = model_bin(BI$interactions[dist.bin==2,])

print(BM)
plot(BM$fit)

## End(Not run)

cqgd/pky documentation built on Dec. 13, 2020, 3:32 a.m.