R: Generic function to extract sequence fragments

getFrag {seqinr} | R Documentation

## Generic function to extract sequence fragments

### Description

getFrag is used to extract the sequence fragment starting at the `begin` position and ending at the `end` position.

### Usage

    getFrag(object, begin, end, ...)
    ## S3 method for class 'SeqAcnucWeb'
    getFrag(object, begin, end, ..., socket = autosocket(), name = getName(object))
    ## S3 method for class 'SeqFastadna'
    getFrag(object, begin, end, ..., name = getName(object))
    ## S3 method for class 'SeqFastaAA'
    getFrag(object, begin, end, ..., name = getName(object))
    ## S3 method for class 'SeqFrag'
    getFrag(object, begin, end, ..., name = getName(object))

### Arguments

`object` | an object of the class `SeqAcnucWeb` or `SeqFastadna`, or `SeqFastaAA` or `SeqFrag` or a list of these objects
`begin` | First position of the fragment to extract. This position is included. Numerotation starts at 1.
`end` | Last position of the fragment to extract. This position is included.
`socket` | an object of class `sockconn` connecting to a remote ACNUC database (default is a socket to the last opened database by `choosebank`).
`name` | the sequence name
`...` | further arguments passed to or from other methods

### Value

`getFrag` returns an object of class `SeqFrag`.

### Author(s)

D. Charif, J.R. Lobry, L. Palmeira

### References

`citation("seqinr")`

### See Also

`SeqAcnucWeb`, `SeqFastadna`, `SeqFastaAA`, `SeqFrag`

### Examples

    #
    # List all available methods for getFrag generic function:
    #
       methods(getFrag)
    #
    # Example with a DNA sequence from a FASTA file:
    #
      dnafile <- system.file("sequences/malM.fasta", package = "seqinr")
      sfdna <- read.fasta(file = dnafile)
      myfrag <- getFrag(sfdna[[1]], begin = 1, end = 10)
      stopifnot(getSequence(myfrag, as.string = TRUE) == "atgaaaatga")

[Package seqinr version 3.4-5 Index]