Skip to contents

Gives the codon number and position in the codon of nucleotid positions.

Usage

codon_finder(pos, begin, end, safer_check = TRUE)

Arguments

pos

Vector of integers indicating the positions of nucleotids in a sequence. Must be between begin and end arguments.

begin

Single integer indicating the position of the first base of the coding sequence.

end

Single indicating the position of the last base of the coding sequence.

safer_check

Single logical value. Perform some "safer" checks (see https://github.com/safer-r)? If TRUE, checkings are performed before main code running: 1) R classical operators (like "<-") not overwritten by another package because of the R scope and 2) required functions and related packages effectively present in local R lybraries. Set to FALSE if this fonction is used inside another "safer" function to avoid pointless multiple checkings.

Value

A data frame with column names:

- pos: values of the pos argument.

- codon_nb: the codon number in the CDS encompassing the pos value.

- codon_pos: the position of pos in the codon (either 1, 2 or 3).

- codon_begin: the first base position of the codon.

- codon_end: the last base position of the codon.

Details

WARNINGS

Only for coding sequences (no introns): ((end - begin) + 1) / 3 must be an integer (i.e., modulo zero)

Negatives positions allowed but this implies that one base has the position 0 in the sequence

Author

Gael Millot <gael.millot@pasteur.fr>

Yushi Han <yushi.han2000@gmail.com>

Haiding Wang <wanghaiding442@gmail.com>

Examples

codon_finder(c(5, 6, 8, 10), begin = 5, end = 10)
#>   pos codon_nb codon_pos codon_begin codon_end
#> 1   5        1         1           5         7
#> 2   6        1         2           5         7
#> 3   8        2         1           8        10
#> 4  10        2         3           8        10

codon_finder(c(0, 5, 6, 8, 10), begin = -2, end = 12)
#>   pos codon_nb codon_pos codon_begin codon_end
#> 1   0        1         3          -2         0
#> 2   5        3         2           4         6
#> 3   6        3         3           4         6
#> 4   8        4         2           7         9
#> 5  10        5         1          10        12