Utilities for Creating and Validating Degenerate primers
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
R
data-raw
data
inst
shiny
tests
vignettes
.Rbuildignore
.gitignore
DESCRIPTION
DegeneratePrimerTools-1.Rproj
NAMESPACE
Readme.Rmd

Readme.Rmd

---
title: "Basic Functionality"
author: "zachcp"
date: "December 27, 2016"
output: html_document
---

## Install

```{r, warning=FALSE, message=FALSE}
# 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

```{r, warning=FALSE, message=FALSE}
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

```{r, message=FALSE, warning=FALSE }
# alignments use the MSA package. You an Also provide your own sequence alignment
AHBA_degeprimer <- AHBA_degeprimer %>% run_alignment()
AHBA_degeprimer
```

## Create Tree

```{r, message=FALSE, warning=FALSE }
# 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
```{r, message=FALSE, warning=FALSE}
# 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
```{r, eval=FALSE}
#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
```{r, eval=FALSE}
# interactive display of primers that helps choose the best degernate primer locations
AHBA_degeprimer %>% choose_primer()
```
![](data-raw/choose_primer.png)

## Add Primer to the Object
```{r}
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
```{r}
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.


```{r, eval=FALSE}
shiny::runGitHub("esnapd/DegeneratePrimerTools", subdir = "shiny")
```