annotate_region
Tag a region by position range and optionally apply a display style in one
step. If the named region already exists in the pool, extent must be
None (the existing bounds are kept) but a new style can still be
applied.
import poolparty as pp
pp.init()
Parameters
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
(required) |
The Pool to annotate. |
|
|
(required) |
Name for the region (e.g. |
|
|
|
|
|
|
|
Named display style applied to the region (e.g. |
|
|
|
Dimension-name ordering for downstream multi-pool iteration. |
|
|
|
Prefix for the operation node name in the pool graph. |
Note
Only the most commonly used parameters are shown above. For the full
parameter list, see annotate_region() in the
API Reference.
Examples
Annotate by extent with no style
Mark positions 4–12 as the cre region with default rendering.
wt = pp.from_seq("AAAAATCGATCGTTTT")
annotated = pp.annotate_region(wt, "cre", extent=(4, 12))
annotated.print_library()
Annotate entire sequence (extent omitted)
Omit extent to tag the full sequence as a single named region.
wt = pp.from_seq("ATCGATCG")
annotated = pp.annotate_region(wt, "full")
annotated.print_library()
Annotate with a named style
style inserts the tag and applies a colour/weight in one call.
wt = pp.from_seq("AAAAATCGATCGTTTT")
annotated = pp.annotate_region(wt, "cre", extent=(4, 12),
style="green bold")
annotated.print_library()
Two regions with different styles
Chain two calls to give adjacent segments distinct colours.
wt = pp.from_seq("AAAAATCGGGGGCCCTTTT")
step1 = pp.annotate_region(wt, "left", extent=(4, 8), style="blue bold")
step2 = pp.annotate_region(step1, "right", extent=(13, 17), style="red bold")
step2.print_library()
Apply a style to an existing region (extent=None)
When the region already exists, omit extent and supply only style
to add colour without re-tagging.
wt = pp.from_seq("AAAA<cre>ATCGATCG</cre>TTTT")
styled = pp.annotate_region(wt, "cre", style="red")
styled.print_library()
See annotate_region().