letterFrequency {Modstrings} | R Documentation

## Calculate the frequency of letters in nucleotide sequence with modifications, or the consensus matrix of a set of sequences

### Description

These functions follow the same principle as the `Biostrings` functions. Please be aware, that the matices can become quite large, since the alphabet of `ModString` objects contains more letters.

### Usage

    ## S4 method for signature 'ModDNAString'
    hasOnlyBaseLetters(x)

    ## S4 method for signature 'ModRNAString'
    hasOnlyBaseLetters(x)

    ## S4 method for signature 'ModDNAString'
    alphabetFrequency(x, as.prob = FALSE, baseOnly = FALSE)

    ## S4 method for signature 'ModRNAString'
    alphabetFrequency(x, as.prob = FALSE, baseOnly = FALSE)

    ## S4 method for signature 'ModDNAStringSet'
    alphabetFrequency(x, as.prob = FALSE, collapse = FALSE, baseOnly = FALSE)

    ## S4 method for signature 'ModRNAStringSet'
    alphabetFrequency(x, as.prob = FALSE, collapse = FALSE, baseOnly = FALSE)

    ## S4 method for signature 'MaskedModString'
    alphabetFrequency(x, as.prob = FALSE, ...)

    ## S4 method for signature 'ModStringViews'
    letterFrequency(x, letters, OR = "|", as.prob = FALSE, ...)

    ## S4 method for signature 'MaskedModString'
    letterFrequency(x, letters, OR = "|", as.prob = FALSE)

    ## S4 method for signature 'ModStringSet'
    consensusMatrix(x, as.prob = FALSE, shift = 0L, width = NULL, baseOnly = FALSE)

    ## S4 method for signature 'ModDNAStringSet'
    consensusString(x, threshold = 0.25, shift = 0L, width = NULL)

    ## S4 method for signature 'ModRNAStringSet'
    consensusString(x, threshold = 0.25, shift = 0L, width = NULL)

    ## S4 method for signature 'ModStringViews'
    consensusString(x, threshold, shift = 0L, width = NULL)

### Arguments

`x` | a `ModString`, a `ModStringSet`, a `ModStringViews` or a `MaskedModString` object.
`as.prob` | `TRUE` or `FALSE` (default): Should the result be returned as probabilities instead of counts? (`sum per column = 1`)
`baseOnly` | `TRUE` or `FALSE` (default): Should the result omit occurances of the letters `N.-+`?
`collapse` | `TRUE` or `FALSE` (default): Should the results summed up all elements for `ModStringSet` or `ModStringViews` objects or reported per element.
`...` | See `letterFrequency`.
`letters` | See `letterFrequency`.
`OR` | See `letterFrequency`.
`shift` | See `letterFrequency`.
`width` | See `letterFrequency`.
`threshold` | Since the amiguityMap is fixed to `"?"` for `ModString` objects, only the treshold can be set (default `threshold = 0.25`)

### Value

a matrix with the results (letter x pos).

### Examples

    mod <- ModDNAString(paste(alphabet(ModDNAString()), collapse = ""))
    hasOnlyBaseLetters(mod)
    alphabetFrequency(mod)

[Package Modstrings version 1.6.0 Index]