grunwaldlab / grunwaldlab/metacoder

Add function to visualize primer mismatch to binding sites

Open
#192 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

someday
Dominant language
R
Stars
148
Forks
30
PR merge metrics
No merged PRs in 30d

Description

I have this old function that I used to visualize alignments:

#' Display sequence alignment
#' 
#' Make a plot of a sequence alignment for an overview of alignment structure. 
#' 
#' @param alignment (\code{DNAbin}) A matrix representing a sequence alignment. 
#' 
#' @references ColorBrewer2 was used for the color palette
#' 
#' @return A \code{\link[ggplot2]{ggplot}} object
#' 
#' @examples
#' \dontrun{
#' library(ape)
#' data(woodmouse)
#' plot_alignment(woodmouse)}
#' 
#' @keywords internal
plot_alignment <- function(alignment) {
  color_key <- c("A" = "#a6cee3", "T" = "#1f78b4", "C" = "#b2df8a", "G" = "#33a02c", "-" = "#DDDDDD")
  alignment <- as.character(alignment)
  molten_alignment <- reshape::melt.matrix(alignment)
  names(molten_alignment) <- c("name", "position", "base")
  molten_alignment$base <-  toupper(molten_alignment$base)
  molten_alignment$color <- color_key[molten_alignment$base]
  molten_alignment$color[is.na(molten_alignment$color)] <- "#FFFFFF"
  ggplot2::ggplot(molten_alignment, ggplot2::aes_string(x = "position", y = "name")) +
    ggplot2::geom_tile(fill = molten_alignment$color) +
    ggplot2::theme(panel.grid = ggplot2::element_blank(), 
          panel.background = ggplot2::element_blank(),
          axis.title = ggplot2::element_blank(),
          axis.text  = ggplot2::element_blank(),
          axis.ticks = ggplot2::element_blank(), 
          axis.line  = ggplot2::element_blank())
}

I never finished it exactly and it is not a great fit as is for metacoder anyway, so I am removing it for now. However, the same functionality could be used to make a plot that shows all unique variations in a primer's binding site from the output of primersearch.

I am thinking of color-coded sequence alignment of the binding site with differences highlighted and a horizontal histogram showing the abundance of each unique binding site.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the old plot_alignment function in the issue and the primersearch output it should consume; no target file or test is identified. Define the visualization around unique primer binding-site variations, highlighted mismatches, and a horizontal abundance histogram, with completion confirmed by an example or test showing those elements.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
bioinformatics, data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.