dinucleotideFrequency {XNAString} | R Documentation

## XNADinucleotideFrequencyFun returns double letters frequency for a given object in base, sugar or backbone slot

### Description

XNADinucleotideFrequencyFun returns double letters frequency for a given object in base, sugar or backbone slot

XNADinucleotideFrequency method returns dinucleotide frequency for a given object. It works for 3 slots: base, sugar and backbone. If matrix_nbr equals 1, dinucleotide frequency for the first elements in the slot is returned. Double letters can be given as argument, otherwise unique double letters in object's dictionary are in use.

### Usage

    XNADinucleotideFrequencyFun(
      obj,
      slot,
      double_letters = NA,
      matrix_nbr = 1,
      as.prob = FALSE,
      base_only = FALSE
    )

    XNADinucleotideFrequency(
      obj,
      slot,
      double_letters = NA,
      matrix_nbr = 1,
      as.prob = FALSE,
      base_only = FALSE,
      ...
    )

    ## S4 method for signature 'XNAString'
    XNADinucleotideFrequency(
      obj,
      slot,
      double_letters = NA,
      matrix_nbr = 1,
      as.prob = FALSE,
      base_only = FALSE
    )

    ## S4 method for signature 'XNAStringSet'
    XNADinucleotideFrequency(
      obj,
      slot,
      double_letters = NA,
      matrix_nbr = 1,
      as.prob = FALSE,
      base_only = FALSE
    )

### Arguments

`obj` | XNAString or XNAStringSet class
`slot` | string (slot name: base, sugar or backbone)
`double_letters` | string (or string vector) - double letters
`matrix_nbr` | numeric (1 or 2, if 1 - first slot's element is use, if 2 - 2nd element in slot)
`as.prob` | logical - if TRUE frequency returned as probability of occurence
`base_only` | logical - if TRUE, frequency checked for 'A', 'C', 'G', 'T', other
`...` | optional arguments to generic function to support additional methods

### Value

matrix (frequency matrix for a given slot)

### Examples

      my_dic <-
    data.table::data.table(
     type = c(rep("base", 3), rep("sugar", 2), rep("backbone", 3)),
     symbol = c("G", "E", "A", "F", "O", "S", "B", "X")
    )
    xnastring_obj <- XNAString(
     name = "b",
     base = c("GGEG"),
     sugar = c("FFOO"),
     dictionary = my_dic
    )
    XNAString::XNADinucleotideFrequency(
     obj = xnastring_obj,
     slot = "base",
     matrix_nbr = 1
    )

[Package XNAString version 1.2.2 Index]