insert_tags
Insert XML-style region tags at a fixed position in a sequence, creating a
named segment that downstream operations can target by name. start and
stop are 0-based indices into the underlying (non-tag) characters.
Omitting stop creates a zero-length point tag at start.
import poolparty as pp
pp.init()
Parameters
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
(required) |
The Pool to insert tags into. Can also be a plain sequence string. |
|
|
(required) |
Name for the region (e.g. |
|
|
(required) |
0-based start index, counting only non-tag characters. |
|
|
|
Exclusive end index (non-tag characters). 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 insert_tags() in the
API Reference.
Examples
Tag a central region
Mark positions 4–12 of a 16-mer as the cre region.
import poolparty as pp
pp.init()
wt = pp.from_seq("AAAAATCGATCGTTTT")
tagged = pp.insert_tags(wt, "cre", start=4, stop=12)
tagged.print_library()
Zero-length point tag (stop omitted)
Omit stop to place a self-closing tag at position 4 without enclosing
any bases — useful as a landmark for replace_region().
import poolparty as pp
pp.init()
wt = pp.from_seq("AAAAATCGATCGTTTT")
point = pp.insert_tags(wt, "ins", start=4)
point.print_library()
Two non-overlapping regions in the same sequence
Apply insert_tags twice to define left and right regions.
import poolparty as pp
pp.init()
wt = pp.from_seq("AAAAATCGGGGGCCCTTTT")
step1 = pp.insert_tags(wt, "left", start=4, stop=8)
step2 = pp.insert_tags(step1, "right", start=13, stop=17)
step2.print_library()
Chain into mutagenize to restrict mutations to the tagged region
Tag a region then mutagenize only that segment; the flanks stay intact.
Use mode="sequential" for deterministic ordering of single mutants.
import poolparty as pp
pp.init()
wt = pp.from_seq("AAAAATCGATCGTTTT")
tagged = pp.insert_tags(wt, "cre", start=4, stop=12)
mutants = pp.mutagenize(tagged, num_mutations=1, region="cre", mode="sequential")
mutants.print_library()
AAAA<cre>GTCGATCG</cre>TTTT
AAAA<cre>TTCGATCG</cre>TTTT
AAAA<cre>AACGATCG</cre>TTTT
AAAA<cre>ACCGATCG</cre>TTTT ... (24 total)
See insert_tags().