trainingData: Assemble training data from aggregate sequence data

Description Usage Arguments Value See Also Examples

Description

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.

Usage

1
2
3
4
5
6
7
trainingData(x, coord, ...)

## S4 method for signature 'ModifierML,GRanges'
trainingData(x, coord, ...)

## S4 method for signature 'ModifierML,GRangesList'
trainingData(x, coord, ...)

Arguments

x

a ModifierML object

coord

a GRanges or a GRangesList object

...

See subsetByCoord for more details. type is hard coded to FALSE to disregard subsetting by type. In addition, merge is set to FALSE by default, but it can be set to TRUE.

Value

a CompressedSplitDataFrameList with aggregate data and an addition label column.

See Also

For more details have a look at subsetByCoord.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)

RNAmodR.ML documentation built on Nov. 8, 2020, 6:40 p.m.