| Title: | Detecting patterns of post-transcriptional modifications using machine learning |
|---|---|
| Description: | RNAmodR.ML extend the functionality of the RNAmodR package and classical detection strategies towards detection through machine learning models. RNAmodR.ML provides classes, functions and an example workflow to establish a detection stratedy, which can be packaged. |
| Authors: | Felix G.M. Ernst [aut, cre] (ORCID: <https://orcid.org/0000-0001-5064-0928>), Denis L.J. Lafontaine [ctb] |
| Maintainer: | Felix G.M. Ernst <[email protected]> |
| License: | Artistic-2.0 |
| Version: | 1.27.0 |
| Built: | 2026-05-16 09:25:56 UTC |
| Source: | https://github.com/bioc/RNAmodR.ML |
The ModifierMLkeras class extends the virtual class
ModifierMLModel and unifies the access to Keras machine
learning models used in the detection of post-transcriptional modifications
in RNA sequencing data. The ModifierMLkeras class is virtual itself
and must be extended from for each individual machine learning model.
The ModifierMLkeras class extends the virtual class
ModifierMLModel and unifies the access to Keras machine
learning models used in the detection of post-transcriptional modifications
in RNA sequencing data. The ModifierMLkeras class is virtual itself
and must be extended from for each individual machine learning model.
Since a stored model needs to be loaded from file, the additional slot
modelFile is used and can be accessed through a function of the same
name. Upon creation of a ModifierMLkeras object, the model is loaded
from file, if modelFile is not an empty character value and a valid
file name.
## S4 method for signature 'ModifierMLkeras,ModifierML' useModel(x, y)## S4 method for signature 'ModifierMLkeras,ModifierML' useModel(x, y)
x |
a |
y |
a |
a ModifierMLkeras object
modelFilea character vector of length == 1L, which describes
a model to load via load_model_hdf5.
The model is then stored in the model slot.
The ModifierMLranger class extends the virtual class
ModifierMLModel and unifies the access to
ranger machine learning models used in the
detection of post-transcriptional modifications in RNA sequencing data. The
ModifierMLranger class is virtual itself and must be extended from for
each individual machine learning model.
## S4 method for signature 'ModifierMLranger,ModifierML' useModel(x, y)## S4 method for signature 'ModifierMLranger,ModifierML' useModel(x, y)
x |
a |
y |
a |
a ModifierMLranger object
# example class derived from the virtual ModifierMLranger class setClass("ModifierMLexample", contains = c("ModifierMLranger")) ModifierMLexample <- function(...){ new("ModifierMLexample") } mlmodel <- ModifierMLexample()# example class derived from the virtual ModifierMLranger class setClass("ModifierMLexample", contains = c("ModifierMLranger")) ModifierMLexample <- function(...){ new("ModifierMLexample") } mlmodel <- ModifierMLexample()
To extend the functionality of the RNAmodR package and classical
detection strategies towards detection through machine learning models,
RNAmodR.ML provides classes and an example workflow.
Felix G M Ernst [aut]
RNAmodR package.
This contains an example ModifierSet object
data(dmod) data(mod7) data(me) data(model)data(dmod) data(mod7) data(me) data(model)
a GRanges object containg D positions
a GRanges object containg m7G positions
a ModMLExample object for examples
a ranger object for examples
The exported functions here are used in the vignette as examples. If you want to reuse them, please implement them yourself. This will allow for fine tuning on your side and does not create a depency to example functions, which could change
aggregate_example(x) find_mod_example(x, minCoverage)aggregate_example(x) find_mod_example(x, minCoverage)
x |
a |
minCoverage |
the minimum coverage for finding modifications |
aggregate_example a SplitDataFrameList object containing the
aggregated data for a Modifier object
find_mod_example a GRanges object with coordinates of
found modifications
# no examples runable. See vignette for explanation on how to use these # example functions aggregate_example find_mod_example# no examples runable. See vignette for explanation on how to use these # example functions aggregate_example find_mod_example
The ModifierML class is a virtual class, which provides the central
functionality for searching with a machine learning models for patterns of
post-transcriptional RNA modifications in high throughput sequencing data.
It extends the virtual Modifier class form the RNAmodR package
and add the useMLModel function. If not called directly for a
ModifierML class, the useMLModel will be called from the
aggregate function.
The slot mlModel is added and serves a dual purpose. If mlModel
is a character, a class of the type ModifierMLModel is created upon
creation of a ModifierML object. However, for developing purposes
the slot can also remain empty and a ModifierMLModel object can be set
using the setMLModel function and retrieved using the
getMLModel. If the mlModel slot is empty, the findMod
setting will be set to FALSE and the ModifierML object will
be returned just with the aggregate data. Such an object can then be used to
train a machine learning model. The data can be accessed using
trainingData.
setMLModel(x) <- value getMLModel(x) hasMLModel(x) useMLModel(x) ## S4 replacement method for signature 'ModifierML' setMLModel(x) <- value ## S4 method for signature 'ModifierML' getMLModel(x) ## S4 method for signature 'ModifierML' hasMLModel(x) ## S4 method for signature 'ModifierML' aggregate(x, force = FALSE) ## S4 method for signature 'ModifierML' useMLModel(x) ## S4 method for signature 'ModifierML' modify(x, force = FALSE)setMLModel(x) <- value getMLModel(x) hasMLModel(x) useMLModel(x) ## S4 replacement method for signature 'ModifierML' setMLModel(x) <- value ## S4 method for signature 'ModifierML' getMLModel(x) ## S4 method for signature 'ModifierML' hasMLModel(x) ## S4 method for signature 'ModifierML' aggregate(x, force = FALSE) ## S4 method for signature 'ModifierML' useMLModel(x) ## S4 method for signature 'ModifierML' modify(x, force = FALSE)
x |
a |
value |
a |
force |
whether to recreate the aggregated data, if it is already stored
inside the |
a ModifierML object
mlModela character describing a class name for creating a
ModifierMLModel object or a ModifierMLModel object itself.
If mlModel is a character, the class will tried to be create
by calling a function of the same name.
# an example implementation of a ModifierML object setClass("ModMLExample", contains = c("RNAModifierML"), prototype = list(mod = c("D"), score = "score", dataType = c("PileupSequenceData", "CoverageSequenceData"), mlModel = character(0))) # constructor function for ModMLExample ModMLExample <- function(x, annotation = NA, sequences = NA, seqinfo = NA, ...){ RNAmodR:::Modifier("ModMLExample", x = x, annotation = annotation, sequences = sequences, seqinfo = seqinfo, ...) }# an example implementation of a ModifierML object setClass("ModMLExample", contains = c("RNAModifierML"), prototype = list(mod = c("D"), score = "score", dataType = c("PileupSequenceData", "CoverageSequenceData"), mlModel = character(0))) # constructor function for ModMLExample ModMLExample <- function(x, annotation = NA, sequences = NA, seqinfo = NA, ...){ RNAmodR:::Modifier("ModMLExample", x = x, annotation = annotation, sequences = sequences, seqinfo = seqinfo, ...) }
trainingData subsets the aggregate data of a ModifierML object
to positions as defined by coord. Positions with an entry in the
mod column are labeled TRUE.
trainingData(x, coord, ...) ## S4 method for signature 'ModifierML,GRanges' trainingData(x, coord, ...) ## S4 method for signature 'ModifierML,GRangesList' trainingData(x, coord, ...)trainingData(x, coord, ...) ## S4 method for signature 'ModifierML,GRanges' trainingData(x, coord, ...) ## S4 method for signature 'ModifierML,GRangesList' trainingData(x, coord, ...)
x |
a |
coord |
a |
... |
See |
a CompressedSplitDataFrameList with aggregate data and an
addition label column.
For more details have a look at
subsetByCoord.
data("dmod",package = "RNAmodR.ML") setClass("ModMLExample", contains = c("RNAModifierML"), prototype = list(mod = c("D"), score = "score", dataType = c("PileupSequenceData", "CoverageSequenceData"), mlModel = character(0))) data("me",package = "RNAmodR.ML") nextUPos <- function(gr){ nextU <- lapply(seq.int(1L,2L), function(i){ subseq <- subseq(RNAmodR::sequences(me)[dmod$Parent], start(dmod)+3L) pos <- start(dmod) + 2L + vapply(strsplit(as.character(subseq),""), function(y){which(y == "U")[i]},integer(1)) ans <- dmod ranges(ans) <- IRanges(start = pos, width = 1L) ans }) nextU <- do.call(c,nextU) nextU$mod <- NULL unique(nextU) } nondmod <- nextUPos(dmod) nondmod <- nondmod[!(nondmod %in% dmod)] coord <- unique(c(dmod,nondmod)) coord <- coord[order(as.integer(coord$Parent))] trainingData(me,coord)data("dmod",package = "RNAmodR.ML") setClass("ModMLExample", contains = c("RNAModifierML"), prototype = list(mod = c("D"), score = "score", dataType = c("PileupSequenceData", "CoverageSequenceData"), mlModel = character(0))) data("me",package = "RNAmodR.ML") nextUPos <- function(gr){ nextU <- lapply(seq.int(1L,2L), function(i){ subseq <- subseq(RNAmodR::sequences(me)[dmod$Parent], start(dmod)+3L) pos <- start(dmod) + 2L + vapply(strsplit(as.character(subseq),""), function(y){which(y == "U")[i]},integer(1)) ans <- dmod ranges(ans) <- IRanges(start = pos, width = 1L) ans }) nextU <- do.call(c,nextU) nextU$mod <- NULL unique(nextU) } nondmod <- nextUPos(dmod) nondmod <- nondmod[!(nondmod %in% dmod)] coord <- unique(c(dmod,nondmod)) coord <- coord[order(as.integer(coord$Parent))] trainingData(me,coord)
The ModifierMLModel is a virtual class and is used for representing
different types of machine learning models used in the detection of
post transcriptional modifiations in RNA sequencing data.
The next class inheriting from here should only implement a certain type
of model and also be virtual. The grand child of the ModifierMLModel
class should than implement a specific model for detecting certain types
of modifications.
useModel(x, y) ## S4 method for signature 'ModifierMLModel,ANY' useModel(x, y)useModel(x, y) ## S4 method for signature 'ModifierMLModel,ANY' useModel(x, y)
x |
a |
y |
See |
a ModifierMLModel object
modela machine learning object of any type
ModifierMLranger
ModifierMLkeras
ModifierMLranger for an example implementation
# an example implementation of a ModifierMLModel object using the # ModifierMLModel derived class ModifierMLranger setClass("ModifierMLexample", contains = c("ModifierMLranger")) ModifierMLexample <- function(...){ new("ModifierMLexample") }# an example implementation of a ModifierMLModel object using the # ModifierMLModel derived class ModifierMLranger setClass("ModifierMLexample", contains = c("ModifierMLranger")) ModifierMLexample <- function(...){ new("ModifierMLexample") }