knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
devtools::load_all() library(cdm) devtools::check()
This package contains 5 functions, which together simulate the central dogma of biology.
With the first function, create_dna
, the user can generate a random DNA sequence of a given length.
The second function, transcribe
, produces an mRNA sequence from the DNA supplied to it as an argument.
The function get_codons
separates the argument mRNA sequence into a vector of codons (three-letter strings).
The function translate
takes as argument such vector of codons, and returns a string of corresponding amino acids.
Finally, the function count_aa
uses the output of translate
(a string of amino acid 1-letter codes) to create a bar plot showing the abundances of each amino acid in the input sequence.
create_dna
create_dna(size = 10)
This creates a random DNA sequence of the length given as size
, and made of the four nucleotides A, C, G or T.
transcribe
This function transcribes the DNA sequence into a mRNA one, replacing thymine (T) with uracil (U). It takes a string and returns a string.
transcribe("ATGC")
get_codons
This function takes as a first argument an RNA sequence (a string), and as a second argument, called start
, an integer indicating the start position of the reading frame. The function returns a vector of 3-letter strings.
get_codons(seq = "AUGCUG" , start = 1 )
translation
This function takes as argument a vector of strings (codons), converts each codon to its corresponding amino acid (1-letter code) based on the codon table, and concatenates the letters into peptide.
translate("AUG")
count_aa
This function takes as an argument a string representing a peptide (in 1-letter amino acid codes) and returns a bar plot showing the number of occurences of each amino acid in the peptide.
count_aa('AUGCGCUA')
create_dna
.transcribe
.get_codons
function creates a vector of codons (3 bp each).translate
function produces the string of amino acids from the codon vector.count_aa
and displayed in a bar plot.DNA <- create_dna(size = 60) DNA mRNA <- transcribe(DNA) mRNA codons <- get_codons(mRNA) codons peptide <- translate(codons) peptide count_aa(peptide) # alternative aa_plot <- create_dna(size = 60) %>% transcribe() %>% get_codons() %>% translate(start = 1) %>% count_aa()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.