-
Notifications
You must be signed in to change notification settings - Fork 0
Home
SangerTraces is a package that allows users to visualize the contents of ab1 files. It comes with nine pre-made color schemes. The Hydrophobicity, HelixPropensity, StrandPropensity, TurnPropensity, and BuriedIndex color schemes were adapted from the 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", "FR1_rev", "FR2_rev", "FR3_rev"],
color_scheme="BuriedIndex"
)
# Call the plot_ab1_trace function to create a PIL image
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 a positive integer. If an invalid value is provided, it defaults to 1.
- end (int, optional) — End position for visualization. Must be a positive integer. If an invalid value is provided, it defaults to the full sequence length.
- wrap_length (int, optional) — Number of bases to display per row. If not provided or an invalid value is provided, the entire sequence is displayed on one row. A wrap length of 60–120 is recommended for better readability.
-
translate (list or str, optional) — Translation frames for the sequence. If not provided, no translation is shown.
Accepts a list containing any of the following values:
'FR1','FR2','FR3','FR1_rev','FR2_rev', and'FR3_rev'.Alternatively, it accepts the string
'forward'(shows all forward frames) or'reverse'(shows all reverse frames).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 a 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 proteins. Available options:
'Nazgul','Simple','ColorBlind','Geneious-like','Hydrophobicity','HelixPropensity','StrandPropensity','TurnPropensity', and'BuriedIndex'. The default value is'ColorBlind'.The images below show how each color scheme looks:
BuriedIndex
ColorBlind
Geneious-like
HelixPropensity
Nazgul
Hydrophobicity
Simple
StrandPropensity
TurnPropensity
-
show_calls (bool, optional) — Whether to display base-call letters below the traces. The default is
True. Set toFalseto disable. -
show_quality (bool, optional) — Whether to display Phred quality scores as bars. The default is
True. Set toFalseto disable. - plot_title (str, optional) — plot title.
If you find the package useful go to https://github.com/anasgri/SangerTraces and 🌟 star it