modifyNucleotides {Modstrings} | R Documentation

## Modifying nucleotides in a nucleotide sequence (or set of sequences) at specified locations

### Description

`modifyNucleotides` modifies a nucleotide in a sequence (or set of sequences) based on the type of modification provided. It checks for the identity of the base nucleotide to be

### Usage

    modifyNucleotides(x, at, mod, nc.type = "short", verbose = FALSE)

    ## S4 method for signature 'ModString'
    modifyNucleotides(x, at, mod, nc.type = c("short",
      "nc"), verbose = FALSE)

    ## S4 method for signature 'ModStringSet'
    modifyNucleotides(x, at, mod,
      nc.type = c("short", "nc"), verbose = FALSE)

    ## S4 method for signature 'DNAString'
    modifyNucleotides(x, at, mod, nc.type = c("short",
      "nc"), verbose = FALSE)

    ## S4 method for signature 'RNAString'
    modifyNucleotides(x, at, mod, nc.type = c("short",
      "nc"), verbose = FALSE)

    ## S4 method for signature 'DNAStringSet'
    modifyNucleotides(x, at, mod,
      nc.type = c("short", "nc"), verbose = FALSE)

    ## S4 method for signature 'RNAStringSet'
    modifyNucleotides(x, at, mod,
      nc.type = c("short", "nc"), verbose = FALSE)

### Arguments

`x` | a `ModString` or `ModStringSet` object
`at` | the location where the modification should be made. The same input as in the original `replaceLetterAt` are expected: If x is a `ModString` object, then at is typically an integer vector with no NAs but a logical vector or Rle object is valid too. Locations can be repeated and in this case the last replacement to occur at a given location prevails. If x is a rectangular `ModStringSet` object, then `at` must be a matrix of logicals with the same dimensions as x. If the `ModStringSet` is not rectangular, `at` must be a list of logical vectors.
`mod` | The modification short name or nomenclature If x is a `ModString` object, then letter must be a `ModString` object or a character vector (with no NAs) with a total number of letters (sum(nchar(letter))) equal to the number of locations specified in at. If x is a rectangular `ModStringSet` object, then letter must be a `ModStringSet` object or a character vector of the same length as x. In addition, the number of letters in each element of letter must match the number of locations specified in the corresponding row of at (all(width(letter) == rowSums(at)))
`nc.type` | the type of nomenclature to be used. Either "short" or "nc". "Short" for m3C would be "m3C", "nc" for m3C would be "3C". ( `default = "short"`)
`verbose` | See `replaceLetterAt`.

### Value

the input `ModString` or `ModStringSet` object with the changes applied

### Examples

    # modify nucleotides in a ModDNAString
    seq <- ModDNAString("AGTC")
    mseq1 <- modifyNucleotides(seq,c(1,2,4),c("1mA","7mG","3mC"))
    # This fails since m7G requires a G at the selected position in the sequence
    ## Not run:
    mseq <- modifyNucleotides(seq,c(3),c("7mG"))

    ## End(Not run)

    # modify nucleotides in a ModRNAString
    seq <- ModRNAString("AGUC")
    mseq1 <- modifyNucleotides(seq,c(1,2,4),c("m1A","m7G","m3C"))
    # This fails since m7G requires a G at the selected position in the sequence
    ## Not run:
    mseq <- modifyNucleotides(seq,c(3),c("m7G"))

    ## End(Not run)

[Package Modstrings version 1.0.3 Index]