I have 5 ab1 files, and I know how to create a chromatogram in R for each one of them individually, using sangerseqR
.
seq_obj <- sangerseqR::readsangerseq("file1.ab1")
sangerseqR::chromatogram(seq_obj)
This produces this plot (showing portion only):
However, what I want is to visualize the 5 chromatograms at once, similar to what Benchling does, see the screenshot below:
I am looking for an R package that can do this easy, but I cannot find any.
Otherwise I was thinking of trying to reproduce the aligned chromatograms myself, since I can obtain the trace data with sangerseqR
, and I can make a MSA of the 5 sequences easy.
In order to do this, there are 2 things to note...
One thing is that gaps have to be included in the chromatogram, masking the trace data on that spot, see the Benchling screenshot.
Another thing is that bases should be spaced in a regular fashion so we can "align" them. Notice how Benchling compresses/expands the trace data, so that base spacing is regular. Conversely, sangerseqR
maintains the time variable so that bases are not regularly spaced (see the area I circled in the first image).
If I end up having to do this myself, is there an option in sangerseqR
that allows me to keep a regular spacing of the bases? Or any other R package that I could use for this at least (in case no package can produce the alignment of the 5 sequences right away)?
Many many thanks!
This is definitely not in R. But if you are interested doing it in python, it will be very close to what you want. Here is the link to the package sangerseq_viewer.
Actually this is really good info! But I want to integrate it in a Shiny R app I'm making and seems a bit overkill. I have the data I want to plot in the ab1 files, and making a ggplot with that data is not difficult...
Only problem I have is what I mentioned up there... I don't know how to widen/narrow the basecall windows, so that they all have the same width and nucleotide bases appear at a regular space, so I can compare sequences... I'm trying to check the sangerseq_viewer code for that formula, but no luck yet.