Calculate the Fraction of Reads in Peak score from the read and peak file of an experiment.
Details
The FRiP score is calculated as follows: $$\text{FRiP} = \frac{(\text{number of reads in peaks})}{\text{(total number of reads)}}$$
Examples
read_file <- system.file("extdata", "CTCF_ChIP_alignment.bam",
package = "MotifPeeker")
read_file <- Rsamtools::BamFile(read_file)
data("CTCF_ChIP_peaks", package = "MotifPeeker")
calc_frip(read_file, CTCF_ChIP_peaks)
#> [1] 0.2473209