trainingData {RNAmodR.ML} | R Documentation

## Assemble training data from aggregate sequence data

### 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

    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

    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)

[Package RNAmodR.ML version 1.0.0 Index]