split_baits.Rd
Merges bin-wise data, calculates the p-values for putative interactions under the negative binomial model. Regroups putative interactions by bait rather than by distance bin.
split_baits(bins, residuals, log_file = NA)
bins | List of data tables containing putative interactions that are binned by distance. |
---|---|
residuals | List containing residuals (adjusted read counts) for each bin (matching the interaction order). |
log_file | Path to a log file. |
Data table with p-values, residuals and putative interaction attributes that can be sorted or split by bait ID.
base = system.file("extdata",package="peaky") interactions_file = paste0(base,"/counts.tsv") 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) models = by(BI$interactions, BI$interactions$dist.bin, model_bin, subsample_size=1000) residuals = lapply(models, "[[", "residuals") bins = split(BI$interactions, BI$interactions$dist.bin) split_baits(bins, residuals) }