-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Anastasija Gricenko edited this page Aug 14, 2026
·
15 revisions
SangerTraces is the package that allows to visualize the contents of the ab1 files. It comes with 9 pre-made color schemes. The Hydrophobicity, HelixPropensity, StrandPropensity, TurnPropensity and BurriedIndex color schemes were reused from https://github.com/moshi4/pyMSAviz. pyMSAviz package.
pip install SangerTraces# import the package
from sangertraces import SangerTrace
# use the SangerTrace class to create the trace object
trace = SangerTrace("B_reverse.ab1", start = 10, end = 100, wrap_length = 80,
translate = ["FR1", "FR2", "FR3", "FR2_rev", "FR3_rev", "FR2_rev", "FR1_rev"],
color_scheme="BuriedIndex")
# call the plot_ab1_trace function to create PIL image figure
fig2 = trace.plot_ab1_trace()
# save the figure
fig2.save("Test1.png")- filename (str, required) — Path to the AB1 file to visualize.
- start (int, optional) — Start position for visualization (nucleotide number). Must be the positive integer. If invalid value is provided defaults to 1
- end (int, optional) — End position for visualization. Must be the positive integer. Defaults to full sequence length if invalid value is provided
- wrap_length (int, optional) — Number of bases to display per row. Defaults displaying the entire sequence on one row if not provided or invalid value is provided. It is advised to use the warp length 60 - 120 for better readability.
- translate (list or str, optional) — Translation frames for the sequence. If not provided no translation is shown.
Accepts a list from 'FR1', 'FR2', 'FR3', 'FR1_rev', 'FR2_rev', 'FR3_rev'. Alternatively accepts the string 'forward' (shows all forward frames) or 'reverse' (shows all reverse frames). View example below:
Using the
reversekeyword.forwardcan be used in the same way.from sangertraces import SangerTrace trace = SangerTrace("B_reverse.ab1", start= 2, end = 350, wrap_length= 80, color_scheme="Simple", translate="reverse") fig = trace.plot_ab1_trace() # save the figure fig.save("Test2.png")
Using the list of values e.g
['FR1', 'FR2', 'FR3', 'FR1_rev', 'FR2_rev']from sangertraces import SangerTrace trace = SangerTrace("B_reverse.ab1", start= 2, end = 350, wrap_length= 80, color_scheme="Simple", translate=['FR1', 'FR2', 'FR3', 'FR1_rev', 'FR2_rev']) fig = trace.plot_ab1_trace() fig.save("Test2.png")
- color_scheme (str, optional) — Color scheme for nucleotide traces and translated protein. Available options: 'Nazgul', 'Simple', 'ColorBlind', 'Geneious-like', 'Hydrophobicity', 'HelixPropensity', 'StrandPropensity', 'TurnPropensity', 'BuriedIndex'. Default value is ColorBlind.
The images below show how each color scheme looks like
- show_calls (bool, optional) — Whether to display base call letters below traces. Default is True, change to False to disable
- show_quality (bool, optional) — Whether to display Phred quality scores as bars. Default is True, change to False to disable