Internal engine shared by runMethylTFR and
runMethylTFRFromRnBeads. It validates the motif set,
allocates the on-disk sinks, iterates over samples, computes per-motif
deviations in chunks and assembles the resulting
methylTFRdeviations object.
The only difference between the two public entry points is where the
per-sample methylation calls come from. That difference is isolated in
the msites_fun argument, so both entry points share identical
numerical behaviour.
Arguments
- sample_ids
A character vector of sample identifiers. Used for the column names of the resulting object and to size the sinks.
- msites_fun
A function of a single integer
ireturning the methylation sites of sampleias aGRangeswith the metadata columnsscoreandcoverage.- samples
A
data.frameof sample annotation with one row per entry ofsample_ids, used ascolData.- tf_bindsites
A
GRangesListnamed by motif. Each element is aGRangesof the occurrences of that motif. The names must include every name innames(gcfreqs). Get it withgetTFbindsites(motifSet = "jaspar2020")from the methylTFRAnnotationHg38 (or methylTFRAnnotationMm10) package, or build a custom set with methylTFRAnnotationBuilder.- gcfreqs
A named
listwith one element per motif, named as intf_bindsites. Each element is a numeric matrix with the five GC bins in rows and the positions across the binding-site window in columns. Get it withgetGCfreq(motifSet = ...)from the annotation package.- gc_dist
A
GRangesobject of 30-bp genomic windows with an integer metadata columnGC_bin(1 to 5). Get it withgetGenomeGC()from the annotation package.- chunkSize
Number of motifs processed together in one block. Default 20.
- threads
Number of workers used to process the motifs of a chunk in parallel. Default 1 (serial).
- enhancer
An optional
GRangesobject of regions, for example distal regulatory elements. Binding sites outside these regions are dropped. Any region set imported asGRangesworks, for example the ENCODE candidate cis-regulatory elements (SCREEN) read withrtracklayer::import(). DefaultNULLuses all binding sites.- ignoreStrand
Logical. If
TRUE(default), strand is ignored when overlapping methylation sites with annotations.- tempDir
Directory for the temporary HDF5 files written during a run. Default is a folder under
tempdir(). The files are deleted when the run finishes.
