model_bin_fs: Wrapper for model_bin() that interacts with the filesystem

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 and stored on disk.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
model_bin_fs(
  bins_dir,
  bin_index,
  output_dir,
  subsample_size = NA,
  gamlss_cycles = 200,
  gamlss_crit = 0.1,
  formula_add = NA,
  formula_replace = NA
)

Arguments

bins_dir

Directory containing putative interactions that are binned by distance.

bin_index

Index of the bin to be processed.

output_dir

Directory where the parametrized model and adjusted readcounts will be stored. Will be created if it does not exist.

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.

Value

List containing the path to the output directory, the null model, and the adjusted read counts.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
base = system.file("extdata",package="peaky")
interactions_file = paste0(base,"/counts.tsv")
bins_dir = paste0(base,"/bins")
fragments_file = paste0(base,"/fragments.bed")

## Not run: bin_interactions_fs(interactions_file, fragments_file, output_dir=bins_dir)

fits_dir = paste0(base,"/fits")

for(bin_index in 1:8){
  ## Not run: model_bin_fs(bins_dir,bin_index,output_dir=fits_dir)
}

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