subsetByCoord {RNAmodR} | R Documentation

## Subsetting data from a `SequenceData`, `SequenceDataSet`, `SequenceDataList`, `Modifier` or `ModifierSet` object.

### Description

With the `subsetByCoord` function data from a `SequenceData`, `SequenceDataSet`, `SequenceDataList`, `Modifier` or `ModifierSet` object can be subset to positions as defined in `coord`.

If `coord` contains a column `mod` and `x` is a `Modifier` object, it will be filtered to identifiers matching the `modType` of `x`. To disable this behaviour remove the column `mod` from `coord` or set `type = NA`

`labelByCoord` functions similarly. It will return a `SplitDataFrameList`, which matches the dimensions of the aggregated data plus the `labels` column, which contains logical values to indicate selected positions.

### Usage

    subsetByCoord(x, coord, ...)

    labelByCoord(x, coord, ...)

    ## S4 method for signature 'Modifier,GRanges'
    subsetByCoord(x, coord, ...)

    ## S4 method for signature 'Modifier,GRangesList'
    subsetByCoord(x, coord, ...)

    ## S4 method for signature 'ModifierSet'
    subset(x, name, pos = 1L, ...)

    ## S4 method for signature 'ModifierSet,GRanges'
    subsetByCoord(x, coord, ...)

    ## S4 method for signature 'ModifierSet,GRangesList'
    subsetByCoord(x, coord, ...)

    ## S4 method for signature 'Modifier,GRanges'
    labelByCoord(x, coord, ...)

    ## S4 method for signature 'Modifier,GRangesList'
    labelByCoord(x, coord, ...)

    ## S4 method for signature 'ModifierSet,GRanges'
    labelByCoord(x, coord, ...)

    ## S4 method for signature 'ModifierSet,GRangesList'
    labelByCoord(x, coord, ...)

    ## S4 method for signature 'SplitDataFrameList,GRanges'
    subsetByCoord(x, coord, ...)

    ## S4 method for signature 'SequenceData'
    subset(x, name, pos = 1L, ...)

    ## S4 method for signature 'SequenceData,GRanges'
    subsetByCoord(x, coord, ...)

    ## S4 method for signature 'SequenceData,GRangesList'
    subsetByCoord(x, coord, ...)

    ## S4 method for signature 'SequenceDataSet'
    subset(x, name, pos = 1L, ...)

    ## S4 method for signature 'SequenceDataSet,GRanges'
    subsetByCoord(x, coord, ...)

    ## S4 method for signature 'SequenceDataSet,GRangesList'
    subsetByCoord(x, coord, ...)

    ## S4 method for signature 'SequenceDataList'
    subset(x, name, pos = 1L, ...)

    ## S4 method for signature 'SequenceDataList,GRanges'
    subsetByCoord(x, coord, ...)

    ## S4 method for signature 'SequenceDataList,GRangesList'
    subsetByCoord(x, coord, ...)

    ## S4 method for signature 'SequenceData,GRanges'
    labelByCoord(x, coord, ...)

    ## S4 method for signature 'SequenceData,GRangesList'
    labelByCoord(x, coord, ...)

    ## S4 method for signature 'SequenceDataSet,GRanges'
    labelByCoord(x, coord, ...)

    ## S4 method for signature 'SequenceDataSet,GRangesList'
    labelByCoord(x, coord, ...)

    ## S4 method for signature 'SequenceDataList,GRanges'
    labelByCoord(x, coord, ...)

    ## S4 method for signature 'SequenceDataList,GRangesList'
    labelByCoord(x, coord, ...)

### Arguments

`x` | a `SequenceData`, `SequenceDataSet`, `SequenceDataList`, `Modifier` or `ModifierSet` object.
`coord` | coordinates of position to subset to. Either a `GRanges` or a `GRangesList` object. For both types the 'Parent' column is expected to match the transcript name.
`...` | Optional parameters: `type`: the modification type used for subsetting. By default this is derived from the `modType(x)`, but it can be overwritten using `type`. It must be a valid shortName for a modification according to `shortName(ModRNAString())` or `shortName(ModDNAString())` (depending on the type of Modifier class) and of course be present in metadata column `mod` of `coord`. To disable subsetting based on type, set `type = NA`. `flanking`: a single integer value to select how many flanking position should be included in the subset (default: `flanking = 0L`). `merge`: `TRUE` or `FALSE`: Should the overlapping selections be merged? This is particular important, if flanking value `!= 0L` are set. (default: `merge = TRUE`). `perTranscript`: `TRUE` or `FALSE`: Should the positions labeled per transcript and not per chromosome? (default: `perTranscript = FALSE`).
`name` | Optional: Limit results to one specific transcript.
`pos` | Optional: Limit results to a specific position.

### Value

If 'x' is a

- `SequenceData` or `Modifier`: a `SplitDataFrameList` with elments per transcript.

- `SequenceDataSet`, `SequenceDataList` or `ModifierSet`: a `SimpleList` of `SplitDataFrameList` with elments per transcript.

### Examples

    data(msi,package="RNAmodR")
    mod <- modifications(msi)
    coord <- unique(unlist(mod))
    coord$score <- NULL
    coord$sd <- NULL
    subsetByCoord(msi,coord)

[Package RNAmodR version 1.2.3 Index]