knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
devtools::load_all()
library(cdm)
devtools::check()

Brief description of what the package is about :

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.

How each function in the package works individually

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')

How the functions in the package are used in conjuction with each other

  1. In the example below, a DNA sequence of 60 bp is generated with create_dna.
  2. It is then to converted to mRNA with transcribe.
  3. From the resulting mRNA sequence, the get_codons function creates a vector of codons (3 bp each).
  4. The translate function produces the string of amino acids from the codon vector.
  5. The occurrences of each amino acid in the peptide sequence is counted by 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()


rforbiodatascience22/group_18_package documentation built on April 5, 2022, 7:51 p.m.