sync
Synchronize multiple pools so they iterate in lockstep — state i of every
synced pool is always drawn together. This is an in-place operation
(it modifies the pools and returns None).
import poolparty as pp
pp.init()
Note
All synced pools must have the same number of states, and no pool may be an ancestor of another in the DAG (which would create a circular dependency).
Parameters
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
(required) |
Pools to synchronize. Must all have the same |
Returns None — pools are modified in-place.
Note
Only the most commonly used parameters are shown above. For the full
parameter list, see sync() in the
API Reference.
Examples
Pair two pools 1:1
Without sync, joining two 3-state pools produces 9 sequences (Cartesian
product). After syncing, only the 3 matched pairs are drawn.
left = pp.from_seqs(["AAA", "CCC", "GGG"], mode="sequential")
right = pp.from_seqs(["TTT", "AAA", "CCC"], mode="sequential")
pp.sync([left, right])
paired = pp.join([left, right])
paired.print_library()
CCCAAA
GGGCCC
Sync scan results for matched comparisons
Synchronize a deletion scan and a mutagenize scan so that each deletion position is paired with a specific mutation draw.
wt = pp.from_seq("ACGTACGT")
dels = wt.deletion_scan(deletion_length=1, mode="sequential")
muts = pp.sample(wt.mutagenize(num_mutations=1, mode="random"), num_seqs=8, seed=0)
pp.sync([dels, muts])
combined = pp.join([dels, muts])
combined.print_library()
A-GTACGTACGTAGGT
AC-TACGTATGTACGT
ACG-ACGTACGTACTT
ACGT-CGTACTTACGT
ACGTA-GTGCGTACGT
ACGTAC-TACGTCCGT
ACGTACG-ACGAACGT
See sync().