shuffle_seq =========== Randomly permute the bases of a sequence, optionally restricting the shuffle to a named region while leaving flanking sequence untouched. Only ``mode="random"`` is supported; each draw is an independent permutation. .. code-block:: python import poolparty as pp pp.init() ---- Parameters ---------- .. list-table:: :header-rows: 1 :widths: auto * - Parameter - Type - Default - Description * - ``pool`` - ``Pool | str`` - *(required)* - The Pool to shuffle. Can also be a plain sequence string. * - ``region`` - ``str | None`` - ``None`` - Name of a tagged region to restrict the shuffle to. Flanking sequences are returned unchanged. * - ``shuffle_type`` - ``str`` - ``"mono"`` - ``"mono"`` randomly permutes individual bases (preserves mononucleotide composition). ``"dinuc"`` uses an Euler-path shuffle that preserves dinucleotide frequencies. * - ``prefix`` - ``str | None`` - ``None`` - Prefix for auto-generated sequence names. * - ``mode`` - ``str`` - ``'random'`` - Only ``'random'`` is meaningful; each draw produces an independent random permutation. * - ``num_states`` - ``int | None`` - ``None`` - Fix how many shuffled variants are drawn per :func:`~poolparty.generate_library` call. * - ``iter_order`` - ``int | None`` - ``None`` - Dimension-name ordering for downstream multi-pool iteration. * - ``style`` - ``str | None`` - ``None`` - Display style applied to the shuffled result. * - ``cards`` - ``dict | list | None`` - ``None`` - Design card columns to include in library output. .. note:: With ``shuffle_type="dinuc"``, the **first and last bases are always fixed** — this is a mathematical constraint of the Euler-path algorithm used to preserve dinucleotide frequencies. ---- .. note:: Only the most commonly used parameters are shown above. For the full parameter list, see :func:`~poolparty.shuffle_seq` in the :doc:`API Reference `. Examples -------- Shuffle the full sequence ~~~~~~~~~~~~~~~~~~~~~~~~~~ With default ``num_states`` (``None`` → ``1``), each library generation returns one random permutation of all bases. Use a larger ``num_states`` to enumerate several shuffles in one call (see below). .. code-block:: python import poolparty as pp pp.init() wt = pp.from_seq("ATCGATCG") shuffled = pp.shuffle_seq(wt, mode="random") shuffled.print_library() .. raw:: html