bin_interactions.Rd
Places putative interactions into equally-sized bins based on the distances they span.
bin_interactions( interactions, fragments, bins = 5, min_dist = 2500, max_dist = Inf, log_file = NA )
interactions | Data table containing putative interactions. Columns called baitID, preyID, N, storing the bait fragment ID, prey fragment ID and readcount, respectively. |
---|---|
fragments | Data table containing fragment information. Columns called chrom, chromStart, chromEnd, ID, storing the chromosome, starting coordinate, ending coordinate and ID of a fragment, respectively. |
bins | Number of bins to place the interactions into. |
min_dist | Minimum distance interactions must span to be included in the analysis. Distance is defined between fragment midpoints. |
max_dist | Maximum distance interactions can span to be included in the analysis. Distance is defined between fragment midpoints. |
log_file | Path to a log file. |
List containing the binned interactions ($interactions) and an overview of bins ($bins).
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) print(BI)#> function (mu.link = "logit") #> { #> mstats <- checklink("mu.link", "Binomial", substitute(mu.link), #> c("logit", "probit", "cloglog", "cauchit", "log", "own")) #> structure(list(family = c("BI", "Binomial"), parameters = list(mu = TRUE), #> nopar = 1, type = "Discrete", mu.link = as.character(substitute(mu.link)), #> mu.linkfun = mstats$linkfun, mu.linkinv = mstats$linkinv, #> mu.dr = mstats$mu.eta, dldm = function(y, mu, bd) (y - #> bd * mu)/(mu * (1 - mu)), d2ldm2 = function(mu, bd) -(bd/(mu * #> (1 - mu))), G.dev.incr = function(y, mu, bd, ...) -2 * #> dBI(y, bd, mu, log = TRUE), rqres = expression(rqres(pfun = "pBI", #> type = "Discrete", ymin = 0, y = y, mu = mu, bd = bd)), #> mu.initial = expression({ #> mu <- (y + 0.5)/(bd + 1) #> }), mu.valid = function(mu) all(mu > 0) && all(mu < 1), #> y.valid = function(y) all(y >= 0), mean = function(bd, #> mu) bd * mu, variance = function(bd, mu) bd * mu * #> (1 - mu)), class = c("gamlss.family", "family")) #> } #> <bytecode: 0x562087890c48> #> <environment: namespace:gamlss.dist>