
Reverse modification probabilities if needed (merge_methylation_with_metadata()
helper)
Source: R/merge_with_metadata.R
reverse_probabilities_if_needed.Rd
This function takes a vector of condensed modification probabilities
(e.g. c("128,0,63,255", "3,78,1"
) and a vector of directions (which
must all be either "forward"
or "reverse"
, not case-sensitive),
and returns a vector of condensed modification probabilities where those
that were originally forward are unchanged, and those that were originally
reverse are flipped to now be forward.
Called by merge_methylation_with_metadata()
to create a forward dataset, alongside
reverse_sequence_if_needed()
, reverse_quality_if_needed()
, and reverse_locations_if_needed()
.
Arguments
- probabilities_vector
character vector
. The probabilities to be reversed for each sequence/read. Each read should have one character value, representing a comma-separated list of the modification probabilities for each assessed base along the read e.g."230,7,64,145"
. In most situations these will be 8-bit integers from 0 to 255, but this function will work on any comma-separated values.
These comma-separated characters/strings can be produced from numeric vectors viavector_to_string()
and converted back to vectors viastring_to_vector()
.- direction_vector
character vector
. Whether each sequence is forward or reverse. Must contain only"forward"
and"reverse"
, but is not case sensitive. Must be the same length asprobabilities_vector
.