predict_pmol: predict picomoles of DNA from a fit and read counts...

View source: R/predict_pmol.R

predict_pmolR Documentation

predict picomoles of DNA from a fit and read counts (coverage)

Description

FIXME: this could be made MUCH faster by precomputing CpG/GC stats per bin

Usage

predict_pmol(
  fit,
  genomic_gr,
  bsgenome = NULL,
  ret = c("gr", "df"),
  slide = FALSE
)

Arguments

fit

result of model_glm_pmol

genomic_gr

the genomic data / new data

bsgenome

BSgenome name (if null, will guess from genomic_gr)

ret

return a data.frame ("df") or GRanges ("gr")? ("gr")

slide

compute a sliding window estimate for GCfrac (1/3 width)?

Details

Using GRanges as the return value is (perhaps counterintuitively) much faster than the data.frame, since the sequence of the bins gets converted from a BSgenome representation to characters in the latter (it is implied by the bin start, stop, and genome when left as a GRanges).

Value

object with read count, fraglen, GC%, CpG**(1/3), and concentration

Examples


data(spike_res)
data(genomic_res)
data(spike, package="spiky")
fit <- model_glm_pmol(covg_to_df(spike_res, spike=spike),spike=spike)
preddf <- predict_pmol(fit, genomic_res, ret="df")
pred <- predict_pmol(fit, genomic_res, ret="gr")
bin_pmol(pred)


trichelab/spiky documentation built on Sept. 17, 2022, 8:44 a.m.