| Title: | Quantification of DNA Methylation Signatures in TFBS |
|---|---|
| Description: | methylTFR is an extensive R package designed specifically for analyzing DNA methylation signatures within transcription factor binding sites (TFBS) across diverse genomic annotations. It enhances methylation analysis by calculating a bias-corrected 'deviation' in methylation levels, leveraging GC bias distribution and frequency data. This package offers a variety of functions that facilitate the motif activity exhibiting diverse methylation patterns across distinct samples or cells. |
| Authors: | Irem B. Gündüz [aut, cre] (ORCID: <https://orcid.org/0000-0003-2641-0916>), Sarath Kumar Murugan [aut] (ORCID: <https://orcid.org/0000-0001-7378-7869>), Fabian Mueller [aut] (ORCID: <https://orcid.org/0000-0001-5809-2321>), ERA-NET Transcan-Neu III - EPILUNAR [fnd] (Grant 01KT2409), Saarland University [fnd] (NanoBioMed Young Investigator Grant) |
| Maintainer: | Irem B. Gündüz <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.99.9 |
| Built: | 2026-09-29 16:13:34 UTC |
| Source: | https://github.com/BiocStaging/methylTFR |
This function is used to add GC bin to the methylation sites and calculate the average methylation for each bin.
addGCBintoMethylome(msites, gcdist, ignoreStrand = TRUE)addGCBintoMethylome(msites, gcdist, ignoreStrand = TRUE)
msites |
Imported methylation sites using
|
gcdist |
a |
ignoreStrand |
|
a matrix object with GC bin with
corresponding avg methylation
Irem Gunduz
library(methylTFR) # Load the data load(system.file("extdata", "gcdist_subset.rda", package = "methylTFR" )) load(system.file("extdata", "example_data.rda", package = "methylTFR" )) # Add GC bin bin_meth <- addGCBintoMethylome(msites, gcdist)library(methylTFR) # Load the data load(system.file("extdata", "gcdist_subset.rda", package = "methylTFR" )) load(system.file("extdata", "example_data.rda", package = "methylTFR" )) # Add GC bin bin_meth <- addGCBintoMethylome(msites, gcdist)
Combine methylTFRdeviations objects by column.
## S4 method for signature 'methylTFRdeviations' cbind(..., deparse.level = 1)## S4 method for signature 'methylTFRdeviations' cbind(..., deparse.level = 1)
... |
methylTFRdeviations objects. |
deparse.level |
passed to the underlying method. |
Defined explicitly rather than left to inheritance. Although
methylTFRdeviations extends SummarizedExperiment,
whether that class's cbind method is found for a subclass
defined in another package depends on the search path and on the
Bioconductor version: dispatch can fall through to the
S4Vectors method, which then fails with "unable to find an
inherited method for function 'bindCOLS'".
The objects are therefore coerced to SummarizedExperiment
explicitly, combined there, and re-wrapped. This is defined with
setMethod on the existing generic rather than
setGeneric, so it does not shadow the base function and any
number of objects can be combined.
A methylTFRdeviations object.
load(system.file("extdata", "tc_mem.rda", package = "methylTFR")) load(system.file("extdata", "tc_naive.rda", package = "methylTFR")) devs <- cbind(tc_mem, tc_naive)load(system.file("extdata", "tc_mem.rda", package = "methylTFR")) load(system.file("extdata", "tc_naive.rda", package = "methylTFR")) devs <- cbind(tc_mem, tc_naive)
computeDeviation is a function to calculate the deviation in transcription factor binding sites for a given motif
computeDeviation( motif, msites, tf_bindsites, gcfreqs, enhancer = NULL, ignoreStrand = TRUE, binMsites )computeDeviation( motif, msites, tf_bindsites, gcfreqs, enhancer = NULL, ignoreStrand = TRUE, binMsites )
motif |
A character vector containing motif name |
msites |
imported methylation sites |
tf_bindsites |
a |
gcfreqs |
a |
enhancer |
a |
ignoreStrand |
if TRUE, it ignores strand info from annotation |
binMsites |
A matrix object with GC bin with corresponding avg methylation |
a numeric deviation score for a given motif
library(methylTFR) # Load the data load(system.file("extdata", "BATF_tf_bindsites.rda", package = "methylTFR" )) load(system.file("extdata", "example_data.rda", package = "methylTFR" )) load(system.file("extdata", "BATF_gcfreqs.rda", package = "methylTFR" )) load(system.file("extdata", "gcdist_subset.rda", package = "methylTFR" )) # Compute binMsites bin_meth <- addGCBintoMethylome(msites, gcdist, TRUE) # Compute the deviation devs <- computeDeviation("BATF", msites, tf_bindsites, gcfreqs, enhancer = NULL, ignoreStrand = TRUE, binMsites = bin_meth )library(methylTFR) # Load the data load(system.file("extdata", "BATF_tf_bindsites.rda", package = "methylTFR" )) load(system.file("extdata", "example_data.rda", package = "methylTFR" )) load(system.file("extdata", "BATF_gcfreqs.rda", package = "methylTFR" )) load(system.file("extdata", "gcdist_subset.rda", package = "methylTFR" )) # Compute binMsites bin_meth <- addGCBintoMethylome(msites, gcdist, TRUE) # Compute the deviation devs <- computeDeviation("BATF", msites, tf_bindsites, gcfreqs, enhancer = NULL, ignoreStrand = TRUE, binMsites = bin_meth )
Identify transcription factor motifs whose methylTFR activity varies across samples more than expected by chance.
computeZScoreVariability( object, method = c("robust", "gaussian"), bootstrap = FALSE, niterations = 1000L, conf_level = 0.95, padjMethod = "BH" )computeZScoreVariability( object, method = c("robust", "gaussian"), bootstrap = FALSE, niterations = 1000L, conf_level = 0.95, padjMethod = "BH" )
object |
A |
method |
Either |
bootstrap |
logical, if TRUE bootstrap confidence bounds for the variability estimates are computed by resampling samples with replacement. |
niterations |
Number of bootstrap iterations, used only when
|
conf_level |
Confidence level for the bootstrap bounds. |
padjMethod |
Method for p-value adjustment, passed to
|
Variability is defined as the standard deviation, across samples, of
calibrated deviation scores. Calibration is what makes the number
interpretable: deviation scores are first standardised against a
within-sample null estimated across all motifs (see
calibrateDeviations), so that a calibrated score of 1 corresponds to
one unit of sample-level noise. A motif with variability greater than 1
therefore varies across samples by more than the background spread, and
variability near 1 is what a motif carrying no signal is expected to show.
Under the null hypothesis that a motif's calibrated scores are independent
draws from a standard normal distribution, follows a
chi-squared distribution with degrees of freedom, where
is the observed variability and the number of samples with a
non-missing score for that motif. P-values are obtained from the upper tail
of that distribution and adjusted for multiple testing across motifs.
Note that this function must not be applied to the z assay returned
by deviationZScores. Those are row-wise Z-scores computed for
visualisation, and their standard deviation across samples is 1 for every
motif by construction, which would make the test degenerate. The default
input is therefore the deviations assay.
The approach is analogous to chromVAR::computeVariability, with one
difference: chromVAR calibrates each motif against a set of GC- and
width-matched background peak sets, whereas here the null is estimated
across motifs within each sample. The latter needs no additional deviation
computations and can be applied to existing results, at the cost of
assuming that most motifs are inactive in any given sample.
A data.frame with one row per motif and the columns
motifs, variability, p_value and
p_value_adjusted, plus bootstrap_lower_bound and
bootstrap_upper_bound when bootstrap is TRUE. Rows are
returned in the order of the input.
Irem Gunduz
differential_deviation_test for testing activity
differences between predefined groups.
# Load example data load(system.file("extdata", "tc_mem.rda", package = "methylTFR")) load(system.file("extdata", "tc_naive.rda", package = "methylTFR")) devs <- cbind(tc_mem, tc_naive) # Rank motifs by how much their activity varies across samples var_res <- computeZScoreVariability(devs) head(var_res[order(-var_res$variability), ])# Load example data load(system.file("extdata", "tc_mem.rda", package = "methylTFR")) load(system.file("extdata", "tc_naive.rda", package = "methylTFR")) devs <- cbind(tc_mem, tc_naive) # Rank motifs by how much their activity varies across samples var_res <- computeZScoreVariability(devs) head(var_res[order(-var_res$variability), ])
Function to get deviations from a methylTFRdeviations object.
deviations(x)deviations(x)
x |
A methylTFRdeviations object. |
A matrix of deviations.
# Load example data load(system.file("extdata", "tc_mem.rda", package = "methylTFR")) # Get deviations deviations(tc_mem)# Load example data load(system.file("extdata", "tc_mem.rda", package = "methylTFR")) # Get deviations deviations(tc_mem)
Extract bias corrected deviations from methylTFRdeviations object.
## S4 method for signature 'methylTFRdeviations' deviations(x)## S4 method for signature 'methylTFRdeviations' deviations(x)
x |
methylTFRdeviations object. |
A matrix of bias corrected deviations.
# Load the data load(system.file("extdata", "tc_mem.rda", package = "methylTFR")) # Get deviations deviations(tc_mem)# Load the data load(system.file("extdata", "tc_mem.rda", package = "methylTFR")) # Get deviations deviations(tc_mem)
Function to get deviation Z-scores from a methylTFRdeviations object.
deviationZScores(x)deviationZScores(x)
x |
A methylTFRdeviations object. |
A matrix of deviation Z-scores.
# Load example data load(system.file("extdata", "tc_mem.rda", package = "methylTFR")) # Get deviation Z-scores deviationZScores(tc_mem)# Load example data load(system.file("extdata", "tc_mem.rda", package = "methylTFR")) # Get deviation Z-scores deviationZScores(tc_mem)
Extract deviation Z-scores from methylTFRdeviations object.
## S4 method for signature 'methylTFRdeviations' deviationZScores(x)## S4 method for signature 'methylTFRdeviations' deviationZScores(x)
x |
methylTFRdeviations object. |
A matrix of deviation Z-scores.
# Load the data load(system.file("extdata", "tc_mem.rda", package = "methylTFR")) # Get deviation Z-scores deviationZScores(tc_mem)# Load the data load(system.file("extdata", "tc_mem.rda", package = "methylTFR")) # Get deviation Z-scores deviationZScores(tc_mem)
Differential analysis is to test which motifs are having significant deviations among different groups. Adapted from chromVAR::differential_test
differential_deviation_test( deviations, groups = NULL, motifs = rownames(deviations), alternative = c("two.sided", "less", "greater"), parametric = TRUE, padjMethod = "BH" )differential_deviation_test( deviations, groups = NULL, motifs = rownames(deviations), alternative = c("two.sided", "less", "greater"), parametric = TRUE, padjMethod = "BH" )
deviations |
a |
groups |
a character vector of group names or colnames(deviations) |
motifs |
a character vector of motif names used in analysis or rownames(deviations) |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
parametric |
logical, if TRUE, parametric tests are used, otherwise non-parametric tests are used. |
padjMethod |
method for p-value adjustment, default is "BH" |
a data.frame contains motifs with
corresponding p-value and
adjusted p-value
# Load example data load(system.file("extdata", "tc_mem.rda", package = "methylTFR" )) load(system.file("extdata", "tc_naive.rda", package = "methylTFR" )) devs <- cbind(tc_mem, tc_naive) # Construct group labels from sample names get_groupname <- function(x) { return(unlist(strsplit(x, split = "_"))[1]) } groups <- sub(".bedGraph", "", unlist(lapply( FUN = get_groupname, X = colnames(devs) ))) # Perform differential analysis tc_result <- differential_deviation_test( deviations = devs, groups = groups, motifs = rownames(devs), alternative = "two.sided", parametric = TRUE, padjMethod = "BH" )# Load example data load(system.file("extdata", "tc_mem.rda", package = "methylTFR" )) load(system.file("extdata", "tc_naive.rda", package = "methylTFR" )) devs <- cbind(tc_mem, tc_naive) # Construct group labels from sample names get_groupname <- function(x) { return(unlist(strsplit(x, split = "_"))[1]) } groups <- sub(".bedGraph", "", unlist(lapply( FUN = get_groupname, X = colnames(devs) ))) # Perform differential analysis tc_result <- differential_deviation_test( deviations = devs, groups = groups, motifs = rownames(devs), alternative = "two.sided", parametric = TRUE, padjMethod = "BH" )
Class for storing results from
run_methyltfr function.
This class inherits from
SummarizedExperiment, and most methods
for that class should work for objects of this class as well. Additionally,
two accessor functions are defined for extracting bias corrected
deviations (deviations)
and deviation Z-scores
(
deviationZScores).
Creates a footprint plot of expected vs observed methylation for a given motif and a single methylation site.
plotExpectedFootprint( motif, tf_bindsites, msites, sample_name = NULL, gc_dist, gcfreqs, enhancer = NULL, returnPlotData = FALSE )plotExpectedFootprint( motif, tf_bindsites, msites, sample_name = NULL, gc_dist, gcfreqs, enhancer = NULL, returnPlotData = FALSE )
motif |
Motif name as a character string |
tf_bindsites |
Transcript Factor binding sites from the annotation package |
msites |
Methylation sites as a data frame |
sample_name |
Optional sample name as a character string, defaults to the file name if not provided |
gc_dist |
a |
gcfreqs |
GC frequency of the genome used to compute expected methylation |
enhancer |
Specific region such as distal motif, proximal motif |
returnPlotData |
Logical indicating whether to return the plot data |
A ggplot object of TF footprint plot for a single sample
library(ggplot2) library(methylTFR) # Load the data load(system.file("extdata", "BATF_tf_bindsites.rda", package = "methylTFR" )) load(system.file("extdata", "example_data.rda", package = "methylTFR" )) load(system.file("extdata", "BATF_gcfreqs.rda", package = "methylTFR" )) load(system.file("extdata", "gcdist_subset.rda", package = "methylTFR" )) # Plot the expected footprint p <- plotExpectedFootprint( motif = "BATF", tf_bindsites = tf_bindsites, msites = msites, sample_name = "Sample1", gc_dist = gcdist, gcfreqs = gcfreqs, enhancer = NULL, returnPlotData = FALSE )library(ggplot2) library(methylTFR) # Load the data load(system.file("extdata", "BATF_tf_bindsites.rda", package = "methylTFR" )) load(system.file("extdata", "example_data.rda", package = "methylTFR" )) load(system.file("extdata", "BATF_gcfreqs.rda", package = "methylTFR" )) load(system.file("extdata", "gcdist_subset.rda", package = "methylTFR" )) # Plot the expected footprint p <- plotExpectedFootprint( motif = "BATF", tf_bindsites = tf_bindsites, msites = msites, sample_name = "Sample1", gc_dist = gcdist, gcfreqs = gcfreqs, enhancer = NULL, returnPlotData = FALSE )
Creates a footprint plot of bias corrected methylation for a given motif and sample
plotMotifFootprint( motif, tf_bindsites, msites, sample_name = NULL, gc_dist, gcfreqs, enhancer = NULL, method = "division", flankNorm = 50 )plotMotifFootprint( motif, tf_bindsites, msites, sample_name = NULL, gc_dist, gcfreqs, enhancer = NULL, method = "division", flankNorm = 50 )
motif |
Motif name as a character string |
tf_bindsites |
Transcript Factor binding sites from the annotation package |
msites |
Methylation sites as a data frame |
sample_name |
Optional sample name as a character string, defaults to the file name if not provided |
gc_dist |
a |
gcfreqs |
GC frequency of the genome used to compute expected methylation |
enhancer |
Specific region such as distal motif, proximal motif |
method |
Method to calculate the difference, either "substraction" or "division" |
flankNorm |
Numeric value indicating the flank normalization distance, default is 50 |
A ggplot object of TF footprint difference plot for a single sample
library(ggplot2) library(methylTFR) # Load the data load(system.file("extdata", "BATF_tf_bindsites.rda", package = "methylTFR" )) load(system.file("extdata", "example_data.rda", package = "methylTFR" )) load(system.file("extdata", "BATF_gcfreqs.rda", package = "methylTFR" )) load(system.file("extdata", "gcdist_subset.rda", package = "methylTFR" )) # Plot the expected footprint p <- plotMotifFootprint( motif = "BATF", tf_bindsites = tf_bindsites, msites = msites, sample_name = "Sample1", gc_dist = gcdist, gcfreqs = gcfreqs, enhancer = NULL, method = "division" )library(ggplot2) library(methylTFR) # Load the data load(system.file("extdata", "BATF_tf_bindsites.rda", package = "methylTFR" )) load(system.file("extdata", "example_data.rda", package = "methylTFR" )) load(system.file("extdata", "BATF_gcfreqs.rda", package = "methylTFR" )) load(system.file("extdata", "gcdist_subset.rda", package = "methylTFR" )) # Plot the expected footprint p <- plotMotifFootprint( motif = "BATF", tf_bindsites = tf_bindsites, msites = msites, sample_name = "Sample1", gc_dist = gcdist, gcfreqs = gcfreqs, enhancer = NULL, method = "division" )
Combine methylTFRdeviations objects by row.
## S4 method for signature 'methylTFRdeviations' rbind(..., deparse.level = 1)## S4 method for signature 'methylTFRdeviations' rbind(..., deparse.level = 1)
... |
methylTFRdeviations objects. |
deparse.level |
passed to the underlying method. |
See cbind for why this is defined explicitly
rather than inherited.
A methylTFRdeviations object.
load(system.file("extdata", "tc_mem.rda", package = "methylTFR")) devs <- rbind(tc_mem[seq_len(2), ], tc_mem[3:4, ])load(system.file("extdata", "tc_mem.rda", package = "methylTFR")) devs <- rbind(tc_mem[seq_len(2), ], tc_mem[3:4, ])
read_methylome is a function to import methylation data into a GRanges object. Bed file should be in EPP, ALLC or BisSNP format.
read_methylome(filename, type, cov_threshold = 1)read_methylome(filename, type, cov_threshold = 1)
filename |
filename which contains methylation data |
type |
Type of file format. Currently supported epp, bissnp, bismarkCytosine, bismarkcov, allc and encode |
cov_threshold |
numeric, coverage threshold to filter out low coverage sites, default is 1 |
a GenomicRange object with methylation, coverage information
Irem Gunduz
# Read bissnp file bissnp_path <- system.file( "extdata", "bissnp.tsv.gz", package = "methylTFR" ) bissnp <- read_methylome(bissnp_path, "bissnp")# Read bissnp file bissnp_path <- system.file( "extdata", "bissnp.tsv.gz", package = "methylTFR" ) bissnp <- read_methylome(bissnp_path, "bissnp")
This function is a wrapper function to calculate the deviation in transcription factor footprint base for all given motifs per raw samples
run_methyltfr( sample_ann, sample_dir, tf_bindsites = NULL, gcfreqs = NULL, gc_dist = NULL, sampleColName = "bedFile", chunkSize = 20, full_path = FALSE, annfile = NULL, threads = 1, enhancer = NULL, filetype = NULL, ignoreStrand = TRUE, cov_threshold = 1 )run_methyltfr( sample_ann, sample_dir, tf_bindsites = NULL, gcfreqs = NULL, gc_dist = NULL, sampleColName = "bedFile", chunkSize = 20, full_path = FALSE, annfile = NULL, threads = 1, enhancer = NULL, filetype = NULL, ignoreStrand = TRUE, cov_threshold = 1 )
sample_ann |
A tab seperated file contains sample annotations |
sample_dir |
The directory where all bed file and annotation file stored |
tf_bindsites |
a |
gcfreqs |
a |
gc_dist |
a |
sampleColName |
column name of the sample bed file in the annotation file |
chunkSize |
Chunk size for parallel processing of motifs (default: 20) |
full_path |
if TRUE, the bed file path in the annotation file is full path |
annfile |
if provided, the sample annotation file is not read from the sample_dir |
threads |
Thread count for parallel processing |
enhancer |
a |
filetype |
file type of the bed file, currently supported: bissnp,epp,allc,bismarkcytosine,bismarkcov,encode |
ignoreStrand |
if TRUE, it ignores strand info from annotation |
cov_threshold |
|
a methylTFRdeviations object with
bias-corrected deviation and Z-scores
run_methylTFR_RnBeads for running methylTFR
directly on a preprocessed RnBeads object.
# A minimal end-to-end run on the BATF example data bundled with the # package. The annotation objects cover a single motif, so the result # has one row. load(system.file("extdata", "example_data.rda", package = "methylTFR")) load(system.file("extdata", "BATF_tf_bindsites.rda", package = "methylTFR")) load(system.file("extdata", "BATF_gcfreqs.rda", package = "methylTFR")) load(system.file("extdata", "gcdist_subset.rda", package = "methylTFR")) # run_methyltfr() reads per-sample calls from disk, so the bundled sites # are written out as a bismarkCov file first. sample_dir <- tempfile("methylTFR_example") dir.create(sample_dir) n_meth <- round(msites$score * msites$coverage) write.table( data.frame( chr = as.character(GenomicRanges::seqnames(msites)), start = GenomicRanges::start(msites), end = GenomicRanges::end(msites), percent = msites$score * 100, meth = n_meth, unmeth = msites$coverage - n_meth ), file.path(sample_dir, "sample_1.cov"), sep = "\t", row.names = FALSE, col.names = FALSE, quote = FALSE ) write.table( data.frame(sampleName = "sample_1", bedFile = "sample_1.cov"), file.path(sample_dir, "samples.tsv"), sep = "\t", row.names = FALSE, quote = FALSE ) devs <- run_methyltfr( sample_ann = "samples.tsv", sample_dir = sample_dir, tf_bindsites = tf_bindsites, gcfreqs = gcfreqs, gc_dist = gcdist, filetype = "bismarkcov" ) deviations(devs) unlink(sample_dir, recursive = TRUE)# A minimal end-to-end run on the BATF example data bundled with the # package. The annotation objects cover a single motif, so the result # has one row. load(system.file("extdata", "example_data.rda", package = "methylTFR")) load(system.file("extdata", "BATF_tf_bindsites.rda", package = "methylTFR")) load(system.file("extdata", "BATF_gcfreqs.rda", package = "methylTFR")) load(system.file("extdata", "gcdist_subset.rda", package = "methylTFR")) # run_methyltfr() reads per-sample calls from disk, so the bundled sites # are written out as a bismarkCov file first. sample_dir <- tempfile("methylTFR_example") dir.create(sample_dir) n_meth <- round(msites$score * msites$coverage) write.table( data.frame( chr = as.character(GenomicRanges::seqnames(msites)), start = GenomicRanges::start(msites), end = GenomicRanges::end(msites), percent = msites$score * 100, meth = n_meth, unmeth = msites$coverage - n_meth ), file.path(sample_dir, "sample_1.cov"), sep = "\t", row.names = FALSE, col.names = FALSE, quote = FALSE ) write.table( data.frame(sampleName = "sample_1", bedFile = "sample_1.cov"), file.path(sample_dir, "samples.tsv"), sep = "\t", row.names = FALSE, quote = FALSE ) devs <- run_methyltfr( sample_ann = "samples.tsv", sample_dir = sample_dir, tf_bindsites = tf_bindsites, gcfreqs = gcfreqs, gc_dist = gcdist, filetype = "bismarkcov" ) deviations(devs) unlink(sample_dir, recursive = TRUE)
Run the methylTFR workflow directly on a preprocessed RnBeads object, without exporting per-sample BED files first.
run_methylTFR_RnBeads( rnb_set, tf_bindsites = NULL, gcfreqs = NULL, gc_dist = NULL, chunkSize = 20, threads = 1, enhancer = NULL, ignoreStrand = TRUE, cov_threshold = 1, dpval_threshold = 0.05, sample_ann = NULL )run_methylTFR_RnBeads( rnb_set, tf_bindsites = NULL, gcfreqs = NULL, gc_dist = NULL, chunkSize = 20, threads = 1, enhancer = NULL, ignoreStrand = TRUE, cov_threshold = 1, dpval_threshold = 0.05, sample_ann = NULL )
rnb_set |
A preprocessed |
tf_bindsites |
a |
gcfreqs |
a |
gc_dist |
a |
chunkSize |
Chunk size for parallel processing of motifs. |
threads |
Thread count for parallel processing. |
enhancer |
an optional |
ignoreStrand |
if TRUE, strand information is ignored. |
cov_threshold |
numeric, minimum coverage of a retained site. |
dpval_threshold |
numeric, maximum detection p-value of a retained probe. |
sample_ann |
Optional |
Methylation calls are read at single-cytosine resolution. Sequencing
sets (RnBiseqSet) are filtered by coverage, array sets
(RnBeadSet) by detection p-value. The number of sites retained
per sample is reported through logger.
a methylTFRdeviations object with bias-corrected
deviations and Z-scores.
run_methyltfr for running methylTFR from
per-sample BED files.
# A minimal end-to-end run on the BATF example data bundled with the # package. The bundled calls are wrapped in an RnBiseqSet so that the # example exercises the same code path as a preprocessed RnBeads object. load(system.file("extdata", "example_data.rda", package = "methylTFR")) load(system.file("extdata", "BATF_tf_bindsites.rda", package = "methylTFR")) load(system.file("extdata", "BATF_gcfreqs.rda", package = "methylTFR")) load(system.file("extdata", "gcdist_subset.rda", package = "methylTFR")) if (requireNamespace("RnBeads", quietly = TRUE) && requireNamespace("RnBeads.hg38", quietly = TRUE)) { # identifiers.column is a session option, not a property of the object, # so it has to be set before the set is built or samples() falls back # to row numbers and methylTFR cannot name the columns it returns old_ids <- RnBeads::rnb.getOption("identifiers.column") RnBeads::rnb.options(identifiers.column = "sampleName") sites <- data.frame( chr = as.character(GenomicRanges::seqnames(msites)), start = GenomicRanges::start(msites), strand = "*", stringsAsFactors = FALSE ) rnb_set <- RnBeads::RnBiseqSet( pheno = data.frame(sampleName = "sample_1"), sites = sites, meth = matrix(msites$score, ncol = 1, dimnames = list(NULL, "sample_1")), covg = matrix(msites$coverage, ncol = 1, dimnames = list(NULL, "sample_1")), assembly = "hg38", summarize.regions = FALSE ) devs <- run_methylTFR_RnBeads( rnb_set = rnb_set, tf_bindsites = tf_bindsites, gcfreqs = gcfreqs, gc_dist = gcdist ) RnBeads::rnb.options(identifiers.column = old_ids) deviations(devs) }# A minimal end-to-end run on the BATF example data bundled with the # package. The bundled calls are wrapped in an RnBiseqSet so that the # example exercises the same code path as a preprocessed RnBeads object. load(system.file("extdata", "example_data.rda", package = "methylTFR")) load(system.file("extdata", "BATF_tf_bindsites.rda", package = "methylTFR")) load(system.file("extdata", "BATF_gcfreqs.rda", package = "methylTFR")) load(system.file("extdata", "gcdist_subset.rda", package = "methylTFR")) if (requireNamespace("RnBeads", quietly = TRUE) && requireNamespace("RnBeads.hg38", quietly = TRUE)) { # identifiers.column is a session option, not a property of the object, # so it has to be set before the set is built or samples() falls back # to row numbers and methylTFR cannot name the columns it returns old_ids <- RnBeads::rnb.getOption("identifiers.column") RnBeads::rnb.options(identifiers.column = "sampleName") sites <- data.frame( chr = as.character(GenomicRanges::seqnames(msites)), start = GenomicRanges::start(msites), strand = "*", stringsAsFactors = FALSE ) rnb_set <- RnBeads::RnBiseqSet( pheno = data.frame(sampleName = "sample_1"), sites = sites, meth = matrix(msites$score, ncol = 1, dimnames = list(NULL, "sample_1")), covg = matrix(msites$coverage, ncol = 1, dimnames = list(NULL, "sample_1")), assembly = "hg38", summarize.regions = FALSE ) devs <- run_methylTFR_RnBeads( rnb_set = rnb_set, tf_bindsites = tf_bindsites, gcfreqs = gcfreqs, gc_dist = gcdist ) RnBeads::rnb.options(identifiers.column = old_ids) deviations(devs) }