slice_seq ========= Extract a subsequence using Python-style slicing, a named region, or both. When ``keep_context=True``, the sliced content is reassembled into the original flanking context. .. code-block:: python import poolparty as pp pp.init() ---- Parameters ---------- .. list-table:: :widths: auto :header-rows: 1 * - Parameter - Type - Default - Description * - ``pool`` - ``Pool | str`` - *(required)* - Input pool or sequence string. * - ``region`` - ``str | list | None`` - ``None`` - Region to slice from. A string selects a named region; a ``[start, stop]`` pair selects by position. ``None`` uses the full sequence. * - ``start`` - ``int | None`` - ``None`` - Start index (0-based, Python-style). Applied after region extraction when ``region`` is set. * - ``stop`` - ``int | None`` - ``None`` - Stop index (exclusive, Python-style). * - ``step`` - ``int | None`` - ``None`` - Step size (Python-style). * - ``keep_context`` - ``bool`` - ``False`` - If ``True``, reassemble the sliced content back into the original flanking context (prefix + sliced + suffix). Requires ``region``. * - ``iter_order`` - ``float | None`` - ``None`` - Enumeration order when combined with other pools. * - ``prefix`` - ``str | None`` - ``None`` - Prefix for the operation node name in the pool graph. * - ``style`` - ``str | None`` - ``None`` - Display style applied to the sliced output. ---- .. note:: Only the most commonly used parameters are shown above. For the full parameter list, see :func:`~poolparty.slice_seq` in the :doc:`API Reference `. Examples -------- Slice by position ~~~~~~~~~~~~~~~~~ Extract bases 2–6 from an 8-mer. .. code-block:: python pool = pp.from_seq("ACGTACGT") sliced = pp.slice_seq(pool, start=2, stop=6) sliced.print_library() .. raw:: html