Create Sequence Chromatogram from Data Frame
Hello!
I have information of a sequence in this data frame:
I would like to make a Seq chromatogram like this:
Edited by GenoMax : Since the chromatogram image was not showing up in final display (it showed up in edit preview) I am including a screencap of what OP had included as an embedded image.
I didn't find any tutorial.
Thanks!
• 1,587 views
•
link
1 answer
Can you please elaborate what you want to achieve with this type of plot?
A very primitive approach would be something like shown here:
# simulate some data
seqdata <- as.data.frame(matrix(rbinom(200,1,0.25),ncol=4))
colnames(seqdata) <- c("A","C","G","T")
seqdata[,"pos"] <- as.numeric(rownames(seqdata))
# plot
library(tidyverse)
seqdata %>% gather("base", "count", -pos) %>% filter(count > 0) %>% ggplot(aes(x=pos,color=base)) + geom_density(adjust=1/dim(seqdata)[1]) + facet_grid(base~.)
However, this just represents an ideal chromatogram. A real one measured one by capillary electrophoresis would exhibit e.g. noise at the start, broad merged peaks at base repeats, a decreasing signal towards the end etc.
• 0 views
•
link
Log in to answer this question.
I think this function in
Rshould be of some help: https://rdrr.io/bioc/sangerseqR/man/chromatogram.html .