R: Transfer nids (0, 1, ..., 4) , aids (0, 1, ..., 21) and cids...

nid.aid.cid {phyclust} | R Documentation

## Transfer nids (0, 1, ..., 4) , aids (0, 1, ..., 21) and cids (0, 1, ..., 64)

### Description

Transfer nids (0, 1, ..., 4) , aids (0, 1, ..., 21) and cids (0, 1, ..., 64).

### Usage

    ### S3 methods for a list, vector or matrix (default).
    nid2aid(nidseq, start = 1, end = NULL, drop.gap = FALSE, byrow = TRUE)
    nid2cid(nidseq, start = 1, end = NULL, drop.gap = FALSE, byrow = TRUE)
    cid2aid(cidseq)
    aid2acode(aidseq, lower.case = FALSE)
    acode2aid(acodeseq)

### Arguments

`nidseq` | a numerical vector contains nucleotide ids, 0, 1, 2, 3, or 4.
`cidseq` | a numerical vector contains codon ids, 0, 1, ..., or 64.
`aidseq` | a numerical vector contains amino acid ids, 0, 1, ..., or 21.
`acodeseq` | a character vector contains amino acid codes.
`start` | the start site to translate.
`end` | the end site to translate.
`drop.gap` | ignore gaps if TRUE.
`byrow` | advanced option, default = TRUE.
`lower.case` | transfer in lower cases.

### Details

These functions are based on the internal object `.nucleotide`, `.codon`, `.amino.acid`, and `.genetic.code` to transfer sequences.

### Value

`nid2aid` and `cid2aid` returns a numerical vector containing amino acid ids, and `nid2cid` returns a numerical vector containing codon ids, `aid2acode` returns a character vector containing amino acid codes, and `acode2aid` returns a numerical vector containing amino acid ids.

### Author(s)

Wei-Chen Chen wccsnow@gmail.com

### References

Phylogenetic Clustering Website: https://snoweye.github.io/phyclust/

### See Also

`.nucleotide`, `.amino.acid`, `.codon`, `.genetic.code`, `code2nid`.

### Examples

    ## Not run:
    library(phyclust, quiet = TRUE)

    ### Test S3 methods by a vector
    a.vector <- c("A", "C", "G", "-", "T", "A")
    code2nid(a.vector)
    nid2cid(code2nid(a.vector))
    cid2aid(nid2cid(code2nid(a.vector)))
    nid2aid(code2nid(a.vector))
    aid2acode(nid2aid(code2nid(a.vector)))
    acode2aid(aid2acode(nid2aid(code2nid(a.vector))))

    ### Test S3 methods by a matrix
    a.matrix <- rbind(a.vector, a.vector, a.vector)
    code2nid(a.matrix)
    nid2cid(code2nid(a.matrix))
    cid2aid(nid2cid(code2nid(a.matrix)))
    nid2aid(code2nid(a.matrix))
    aid2acode(nid2aid(code2nid(a.matrix)))
    acode2aid(aid2acode(nid2aid(code2nid(a.matrix))))

    ### Test S3 methods by a list
    a.list <- list(a.vector, a.vector)
    code2nid(a.list)
    nid2cid(code2nid(a.list))
    cid2aid(nid2cid(code2nid(a.list)))
    nid2aid(code2nid(a.list))
    aid2acode(nid2aid(code2nid(a.list)))
    acode2aid(aid2acode(nid2aid(code2nid(a.list))))

    ## End(Not run)

[Package phyclust version 0.1-30 Index]