stylize_orf
Apply codon-aware inline styling to sequences without modifying them. Pass
style_codons= to cycle a list of styles across whole codons, or
style_frames= (length a multiple of 3) to style each base position within
a codon independently. Use region= to restrict coloring to a named ORF
segment. Use mode='sequential' to preserve all upstream states.
import poolparty as pp
pp.init()
Parameters
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
(required) |
The Pool or sequence string to style. |
|
|
|
Restrict styling to a named ORF region or a |
|
|
|
List of style names cycled across whole codons. Mutually exclusive
with |
|
|
|
List of style names (length a multiple of 3) applied per base
position within each codon. Mutually exclusive with
|
|
|
|
Reading frame (+1..+3 or -1..-3). Auto-detected from an
|
|
|
|
Prefix for the operation node name in the pool graph. |
|
|
|
Enumeration order when combined with other pools. |
Note
Only the most commonly used parameters are shown above. For the full
parameter list, see stylize_orf() in the
API Reference.
Examples
Alternating codon colours (style_codons)
Cycle two colours across the 5 codons of ATGAAATTTGGGCCC so the reading
frame is immediately visible.
cds = pp.from_seq("ATGAAATTTGGGCCC")
styled = pp.stylize_orf(cds, style_codons=["blue", "red"])
styled.print_library()
Per-base position styling (style_frames)
Colour each position within a codon independently — each of the three codon positions gets its own colour — to highlight wobble positions.
cds = pp.from_seq("ATGAAATTTGGGCCC")
styled = pp.stylize_orf(cds, style_frames=["blue", "red", "green"])
styled.print_library()
Restrict styling to a named ORF region
Use annotate_orf to register the reading frame, then stylize_orf with
region= to colour only the ORF while leaving flanking bases unstyled.
wt = pp.from_seq("AAAA<cds>ATGAAATTTGGGCCC</cds>TTTT")
orf = pp.annotate_orf(wt, "cds")
styled = pp.stylize_orf(orf, region="cds",
style_codons=["blue", "red"])
styled.print_library()
See stylize_orf().