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

pool

Pool

(required)

Input pool whose states will be repeated.

times

int

(required)

Number of times to repeat each state.

prefix

str | None

None

Prefix for the operation node name in the pool graph.

iter_order

float | None

None

Iteration priority for downstream multi-pool iteration.

cards

dict | list | None

None

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()
tripled: seq_length=4, num_states=6 AAAA
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()
doubled: seq_length=8, num_states=14 --CGATCG
--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()
rep: seq_length=8, num_states=5 TGGCAACT
AGTACGTC
GTTAAGCC
CACTTGGA
TCATGACG
wt  = pp.from_seq("ATCGATCG")
rep = 3 * pp.shuffle_seq(wt, mode="random")
rep.print_library()
rep: seq_length=8, num_states=3 TGGCAACT
AGTACGTC
GTTAAGCC

See repeat().