DNA or RNA Iteration (Making Choices)
This is a follow-up to DNA or RNA.
Write a function, dna_or_rna(sequence), that determines if a sequence
of base pairs is DNA, RNA, or if it is not possible to tell given the
sequence provided. Since all the function will know about the material is the
sequence the only way to tell the difference between DNA and RNA is that
RNA has the base Uracil ("u") instead of the base Thymine ("t"). Have the
function return one of three outputs: "DNA", "RNA", or "UNKNOWN".
Copy and paste the following sequence data into your script:
sequences = c("ttgaatgccttacaactgatcattacacaggcggcatgaagcaaaaatatactgtgaaccaatgcaggcg", "gauuauuccccacaaagggagugggauuaggagcugcaucauuuacaagagcagaauguuucaaaugcau", "gaaagcaagaaaaggcaggcgaggaagggaagaagggggggaaacc", "guuuccuacaguauuugaugagaaugagaguuuacuccuggaagauaauauuagaauguuuacaacugcaccugaucagguggauaaggaagaugaagacu", "gauaaggaagaugaagacuuucaggaaucuaauaaaaugcacuccaugaauggauucauguaugggaaucagccggguc")
- Use the function you wrote and a
forloop to create a vector of sequence types for the values insequences - Use the function and a
forloop to create a data frame that includes a column of sequences and a column of their types - Use the function and
sapplyto create a vector of sequence types for the values insequences - Use the function, and
dplyrto create a data frame that inclues a column of sequences and a column of their types
Optional: For a little extra challenge make your function work with both upper and lower case letters, or even strings with mixed capitalization
Expected outputs for DNA or RNA Iteration