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. .. code-block:: python import poolparty as pp pp.init() ---- Parameters ---------- .. list-table:: :header-rows: 1 :widths: auto * - Parameter - Type - Default - Description * - ``pool`` - ``Pool`` - *(required)* - The Pool to annotate. * - ``region_name`` - ``str`` - *(required)* - Name for the region (e.g. ``'cre'``, ``'orf'``). * - ``extent`` - ``tuple[int, int] | None`` - ``None`` - ``(start, stop)`` tuple (0-based, exclusive stop). When ``None`` and the region does not yet exist, the entire sequence is annotated. Must be ``None`` if the region already exists. * - ``style`` - ``str | None`` - ``None`` - Named display style applied to the region (e.g. ``'blue bold'``). ``None`` leaves the display unchanged. * - ``iter_order`` - ``int | None`` - ``None`` - Enumeration order when combined with other pools. * - ``prefix`` - ``str | None`` - ``None`` - 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 :func:`~poolparty.annotate_region` in the :doc:`API Reference `. Examples -------- Annotate by extent with no style ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mark positions 4–12 as the ``cre`` region with default rendering. .. code-block:: python wt = pp.from_seq("AAAAATCGATCGTTTT") annotated = pp.annotate_region(wt, "cre", extent=(4, 12)) annotated.print_library() .. raw:: html