recombine ========= Produce chimeric sequences by slicing multiple source pools at breakpoints and stitching together alternating segments. Requires at least two source pools of equal sequence length. Use ``mode='sequential'`` to enumerate all breakpoint combinations deterministically, or ``mode='random'`` (default) to draw chimeras stochastically. .. code-block:: python import poolparty as pp pp.init() ---- Parameters ---------- .. list-table:: :header-rows: 1 :widths: auto * - Parameter - Type - Default - Description * - ``pool`` - ``Pool | str | None`` - ``None`` - Parent pool for region-based recombination. If provided with ``region``, the recombined sequences replace the region content. * - ``sources`` - ``list[Pool]`` - *(required)* - Tuple or list of at least two :class:`~poolparty.Pool` objects to recombine. All sources must produce sequences of the same length. * - ``num_breakpoints`` - ``int`` - ``1`` - Number of crossover breakpoints. A single breakpoint produces 2-segment chimeras; N breakpoints produce N+1 segments. * - ``positions`` - ``list[int] | None`` - ``None`` - Explicit list of breakpoint positions. ``None`` = positions chosen by the current ``mode``. * - ``styles`` - ``list[str] | None`` - ``None`` - List of display styles, one per segment (length = ``num_breakpoints`` + 1). * - ``style_by`` - ``str`` - ``'order'`` - ``'order'`` styles segments by position in the chimera; ``'source'`` styles them by which source pool they came from. * - ``region`` - ``str | None`` - ``None`` - Name of a tagged region to restrict recombination to. * - ``mode`` - ``str`` - ``'random'`` - ``'random'`` selects breakpoints randomly; ``'sequential'`` enumerates all breakpoint positions; ``'fixed'`` uses ``positions`` exactly once. * - ``num_states`` - ``int | None`` - ``None`` - Fix the total number of output states. * - ``iter_order`` - ``int | None`` - ``None`` - Dimension-name ordering for downstream multi-pool iteration. * - ``prefix`` - ``str | None`` - ``None`` - Prefix for auto-generated sequence names. ---- .. note:: Only the most commonly used parameters are shown above. For the full parameter list, see :func:`~poolparty.recombine` in the :doc:`API Reference `. Examples -------- Two sources, single breakpoint ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Enumerate all single-crossover chimeras between two 10-base sequences. Each breakpoint position produces two states (one per source ordering), yielding 18 chimeras total. .. code-block:: python src_a = pp.from_seq("AAAAAAAAAA") src_b = pp.from_seq("CCCCCCCCCC") rec = pp.recombine(sources=[src_a, src_b], mode="sequential") rec.print_library() .. raw:: html