Install

# install bioconductor dependencies
source("https://bioconductor.org/biocLite.R")
biocLite(c("msa", "ggtree"))
# install from github
library(devtools)
install_github("esnapd/DegeneratePrimerTools")

# you will probably also want muscle and FastTree on your CLI
# see [bioconda](https://bioconda.github.io/) for easy install of these programs

Load Sequences

library(dplyr)
library(Biostrings)
library(DegeneratePrimerTools)

# load sequences
ahbafna <- system.file("sequences/AHBA.fna",package="DegeneratePrimerTools")
AHBAseqs <- readDNAStringSet(ahbafna)
AHBAseqs
AHBA_degeprimer <- degeprimer(AHBAseqs)
AHBA_degeprimer

Align Sequences

# alignments use the MSA package. You an Also provide your own sequence alignment
AHBA_degeprimer <- AHBA_degeprimer %>% run_alignment()
AHBA_degeprimer

Create Tree

# build a tree from the multiple sequence alignment using the bionj funciton frmo APE.
# you can also provide your own tree
AHBA_degeprimer <- AHBA_degeprimer %>% build_tree()
AHBA_degeprimer
plot(AHBA_degeprimer@phy_tree)

Find Primers

# run DEGEPRIME to find degenerate primers and store them in the
# primerdata slot
AHBA_degeprimer <- AHBA_degeprimer %>% 
  design_primers(maxdegeneracies=c(1,10, 20, 50), number_iterations=2, force=TRUE)
AHBA_degeprimer
tail(AHBA_degeprimer@primerdata)

Recap

#to get to this point it is also possible to use chaining
AHBA_degeprimer <- degeprimer(AHBAseqs) %>%
  run_alignment() %>%
  build_tree() %>%
  design_primers(maxdegeneracies=c(1,10), number_iterations=2) # this can take awhile

Choose Primers

# interactive display of primers that helps choose the best degernate primer locations
AHBA_degeprimer %>% choose_primer()

Add Primer to the Object

AHBA_degeprimer <- AHBA_degeprimer %>% 
  add_primerpair(name="primerpair1", fpos=455, fdeg=10, rpos=617, rdeg=10) %>%
  add_primerpair(name="primerpair2", fpos=928, fdeg=10, rpos=1133, rdeg=10)
AHBA_degeprimer@primerpairs

Plot Coverage

plot_coveragematrix(AHBA_degeprimer,max.mismatch = 0)
plot_coveragematrix(AHBA_degeprimer,max.mismatch = 1)
plot_coveragematrix(AHBA_degeprimer,max.mismatch = 2)
plot_coveragematrix(AHBA_degeprimer,max.mismatch = 3)

Shiny App

DegeneratePrimerTools provides a Shiny App that lets you upload a fastafile and optionally choose a series of degeneracy values. IT will run a multiple sequence alingment, use DEGEPRIME to find deernate primers and display the top 4 most conserved sites and the primers chosen at those sites.

shiny::runGitHub("esnapd/DegeneratePrimerTools", subdir = "shiny")


esnapd/DegeneratePrimerTools documentation built on May 16, 2019, 8:52 a.m.