replace_region
==============
Replace the entire content of a named region with sequences drawn from a
content pool. Every combination of background sequence and content sequence
is produced (Cartesian product). The region tags are removed in the output;
only the new content occupies that position.
.. 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 background Pool whose named region will be replaced.
* - ``content_pool``
- ``Pool``
- *(required)*
- Pool whose sequences replace the region content.
* - ``region_name``
- ``str``
- *(required)*
- Name of the region to replace (must exist in the background pool).
* - ``rc``
- ``bool``
- ``False``
- When ``True``, reverse-complement each content sequence before
inserting it.
* - ``sync``
- ``bool``
- ``False``
- When ``True``, pair background and content states 1:1 (lockstep
iteration) instead of taking the Cartesian product.
* - ``keep_tags``
- ``bool``
- ``False``
- When ``True``, preserve the region tags around the replaced content
so the region can still be referenced by downstream operations.
* - ``iter_order``
- ``int | None``
- ``None``
- Dimension-name ordering for downstream multi-pool iteration.
* - ``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.replace_region` in the
:doc:`API Reference `.
Examples
--------
Replace a region with all 4-mers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enumerate all 256 4-mers inside the ``cre`` region using
:func:`~poolparty.from_iupac`.
.. code-block:: python
import poolparty as pp
pp.init()
wt = pp.from_seq("AAAA