
Map a sequence to a vector of numbers (generic ggDNAvis
helper)
Source: R/dna_tools.R
convert_sequence_to_numbers.Rd
This function takes a sequence and encodes it as a vector
of numbers for visualisation via raster::raster()
.
Encoding: A = 1
, C = 2
, G = 3
, T/U = 4
.
Arguments
- sequence
character
. A DNA/RNA sequence (A/C/G/T/U
) to be encoded numerically. No other characters allowed. Only one sequence allowed.- length
integer
. How long the output numerical vector should be. If shorter than the sequence, the vector will include the first n bases up to this length. If longer than the sequence, the vector will be padded with 0s at the end. If left blank/set toNA
(default), will output a vector the same length as the input sequence.