repeat
Repeat the state space of a pool a specified number of times, producing a
new pool whose total number of states is times × the input pool’s
state count — each input state appears times times consecutively.
import poolparty as pp
pp.init()
Parameters
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
(required) |
Input pool whose states will be repeated. |
|
|
(required) |
Number of times to repeat each state. |
|
|
|
Prefix for the operation node name in the pool graph. |
|
|
|
Iteration priority for downstream multi-pool iteration. |
|
|
|
Design card columns to include in library output. |
Note
Only the most commonly used parameters are shown above. For the full
parameter list, see repeat() in the
API Reference.
Examples
Repeat a Two-Sequence Pool Three Times
Expand a two-sequence pool to six draws by repeating each state three times in order.
pool = pp.from_seqs(["AAAA", "CCCC"], mode="sequential")
tripled = pp.repeat(pool, times=3)
tripled.print_library()
AAAA
AAAA
CCCC
CCCC
CCCC
Repeat a Scan Result to Get More Coverage
Repeat a deletion-scan pool to obtain additional draws of every variant, useful when downstream counting requires a minimum number of observations per sequence.
wt = pp.from_seq("ATCGATCG")
dels = wt.deletion_scan(deletion_length=2, mode="sequential")
doubled = pp.repeat(dels, times=2)
doubled.print_library()
--CGATCG
A--GATCG
A--GATCG
AT--ATCG
... (14 total)
Operator shorthand (*)
pool * N is equivalent to pp.repeat(pool, times=N) — it creates a
new pool with N copies of the input pool’s states. N * pool is
identical to pool * N. This is useful for generating multiple replicates
of a stochastic draw.
wt = pp.from_seq("ATCGATCG")
shuffled = pp.shuffle_seq(wt, mode="random")
rep = shuffled * 5
rep.print_library()
AGTACGTC
GTTAAGCC
CACTTGGA
TCATGACG
wt = pp.from_seq("ATCGATCG")
rep = 3 * pp.shuffle_seq(wt, mode="random")
rep.print_library()
AGTACGTC
GTTAAGCC
See repeat().