
Convert string-ified modification probabilities and locations to a single vector of probabilities (visualise_methylation() helper)
Source: R/visualise_methylation.R
convert_modification_to_number_vector.RdTakes modification locations (indices along the read signifying bases at which
modification probability was assessed) and modification probabilities (the probability
of modification at each assessed location, as an integer from 0 to 255), as comma-separated
strings (e.g. "1,5,25") produced from numerical vectors via vector_to_string().
Outputs a numerical vector of the modification probability for each base along the read.
i.e. -2 for indices outside sequences, -1 for bases where modification was not assessed,
and probability from 0-255 for bases where modification was assessed.
Usage
convert_modification_to_number_vector(
modification_locations_str,
modification_probabilities_str,
max_length,
sequence_length
)Arguments
- modification_locations_str
character. A comma-separated string representing a condensed numerical vector (e.g."3,6,9,12", produced viavector_to_string()) of the indices along the read at which modification was assessed. Indexing starts at 1.- modification_probabilities_str
character. A comma-separated string representing a condensed numerical vector (e.g."2,212,128,64", produced viavector_to_string()) of the probability of modification as an 8-bit (0-255) integer for each base where modification was assessed.- max_length
integer. How long the output vector should be.- sequence_length
integer. How long the sequence itself is. If smaller thanmax_length, the remaining spaces will be filled with-2s i.e. set to the background colour invisualise_methylation().