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.
import poolparty as pp
pp.init()
Parameters
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
(required) |
The background Pool whose named region will be replaced. |
|
|
(required) |
Pool whose sequences replace the region content. |
|
|
(required) |
Name of the region to replace (must exist in the background pool). |
|
|
|
When |
|
|
|
When |
|
|
|
When |
|
|
|
Dimension-name ordering for downstream multi-pool iteration. |
|
|
|
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 replace_region() in the
API Reference.
Examples
Replace a region with all 4-mers
Enumerate all 256 4-mers inside the cre region using
from_iupac().
import poolparty as pp
pp.init()
wt = pp.from_seq("AAAA<cre>ATCG</cre>TTTT")
inserts = pp.from_iupac("NNNN", mode="sequential")
library = pp.replace_region(wt, inserts, region_name="cre")
library.print_library()
AAAAAAACTTTT
AAAAAAAGTTTT
AAAAAAATTTTT
AAAAAACATTTT
... (256 total)
Replace with a small explicit set
Supply from_seqs() to substitute only specific sequences.
import poolparty as pp
pp.init()
wt = pp.from_seq("AAAA<cre>ATCG</cre>TTTT")
inserts = pp.from_seqs(["AAA", "TTT", "CCC"], mode="sequential")
library = pp.replace_region(wt, inserts, region_name="cre")
library.print_library()
AAAATTTTTTT
AAAACCCTTTT
Replace a zero-length point tag (pure insertion)
When the region is a zero-length point tag, replace_region inserts
without deleting any bases.
import poolparty as pp
pp.init()
wt = pp.from_seq("AAAA<ins/>TTTT")
inserts = pp.from_seqs(["GC", "AT"], mode="sequential")
library = pp.replace_region(wt, inserts, region_name="ins")
library.print_library()
AAAAATTTTT
Insert reverse-complemented content (rc=True)
rc=True reverse-complements each content sequence before insertion.
import poolparty as pp
pp.init()
wt = pp.from_seq("AAAA<cre>ATCG</cre>TTTT")
inserts = pp.from_seqs(["GCGC", "ATAT"], mode="sequential")
library = pp.replace_region(wt, inserts, region_name="cre", rc=True)
library.print_library()
AAAAATATTTTT
See replace_region().