model_bin.Rd
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.
model_bin( bin, subsample_size = NA, gamlss_cycles = 200, gamlss_crit = 0.1, formula_add = NA, formula_replace = NA, log_file = NA )
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. |
List containing the fitted null model ($fit) and the adjusted readcounts ($residuals).
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) if (FALSE) { BI = bin_interactions(interactions, fragments, bins=5) BM = model_bin(BI$interactions[dist.bin==2,]) print(BM) plot(BM$fit) }