makePWMEmpiricalBackground: Make an empirical P-value background

Description Usage Arguments Details Examples

View source: R/background.R

Description

Make a background appropriate for empirical P-value calculation. The provided set of background sequences is contcatenated into a single long sequence which is then scanned with the motifs and raw scores are saved. This object can be very large.

Usage

1
2
3
4
5
6
7
8
makePWMEmpiricalBackground(
  bg.seq,
  motifs,
  bg.pseudo.count = 1,
  bg.source = "",
  verbose = TRUE,
  ...
)

Arguments

bg.seq

a set of background sequences, either a list of DNAString object or DNAStringSet object

motifs

a set of motifs, either a list of frequency matrices, or a list of PWM objects. If frequency matrices are given, the background distribution is fitted from bg.seq.

bg.pseudo.count

the pseudo count which is shared between nucleotides when frequency matrices are given

bg.source

a free-form textual description of how the background was generated

verbose

if to produce verbose output

...

currently unused (this is for convenience for makeBackground function)

Details

For reliable P-value calculation the size of the background set needs to be at least seq.len / min.P.value. For instance, to get P-values at a resolution of 0.001 for a single sequence of 500bp, we would need a background of at least 500/0.001 = 50kb. This ensures that we can make 1000 independent 500bp samples from this background to properly estimate the P-value. For a group of sequences, we would take seq.len to be the total length of all sequences in a group.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
if(requireNamespace("PWMEnrich.Dmelanogaster.background")){
   data(MotifDb.Dmel.PFM, package = "PWMEnrich.Dmelanogaster.background")

   # make empirical background by saving raw scores for each bp in the sequence. This can be 
   # very large in memory!
	  if(requireNamespace("BSgenome.Dmelanogaster.UCSC.dm3")) 
     makePWMEmpiricalBackground(Dmelanogaster$upstream2000[1:100], MotifDb.Dmel.PFM)
}

## End(Not run)

PWMEnrich documentation built on Nov. 8, 2020, 7:45 p.m.