Open roddypr opened 7 years ago
Then we need a different example.
The point is for them to learn how to do regular expressions.
On 2017-Jul-20, at 18:15, Rodrigo Pracana notifications@github.com wrote:
This question asks to generate the reverse complement of a sequence using "gsub". Using "gsub" is quite dangerous in this question. A better solution is to use "match", despite this not being the point of the exercise:
sequence <- "ATTACGACGCGATTCCCGGTTAATCGAATTCCCA"
Complement of each nucleotide
dna_code <- c("A","C","G","T") complement_code <- c("T","G", "C","A")
Complement of sequence
comp_seq <- complement_code[match(sequence, dna_code)]
Reverse
rev_comp <- rev(rev_comp)
paste together
rev_comp <- paste(rev_comp, collapse = "")
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
This question asks to generate the reverse complement of a sequence using "gsub". Using "gsub" is quite dangerous in this question. A better solution is to use "match", despite this not being the point of the exercise: