join

Concatenate a list of pools (or plain strings) end-to-end into a single composite pool. Every combination of one sequence from each input pool is produced (Cartesian product). Pass a spacer string to insert a fixed linker between adjacent segments.

import poolparty as pp
pp.init()

Parameters

Parameter

Type

Default

Description

pools

list[Pool | str]

(required)

List of Pool objects or plain strings. Strings are automatically promoted to single-sequence pools.

spacer_str

str

''

Fixed string inserted between every adjacent pair of segments. Not itself a pool dimension.

iter_order

int | None

None

Controls which pool varies fastest when enumerating combinations. The pool with the smallest value is the inner loop. Can also be set on each individual pool.

prefix

str | None

None

Prefix for auto-generated sequence names.

style

str | None

None

Display style applied to the joined result.


Note

Only the most commonly used parameters are shown above. For the full parameter list, see join() in the API Reference.

Examples

Join two pools (all pairwise combinations)

Joining two multi-sequence pools produces every combination of one sequence from each input.

left  = pp.from_seqs(["AA", "CC"], mode="sequential")
right = pp.from_seqs(["GG", "TT"], mode="sequential")
pool  = pp.join([left, right])
pool.print_library()
pool: seq_length=4, num_states=4 AAGG
AATT
CCGG
CCTT

Join with a fixed spacer

spacer_str inserts a constant linker between every adjacent pair.

left  = pp.from_seq("ACGT")
right = pp.from_seqs(["AAAA", "CCCC", "GGGG"], mode="sequential")
pool  = pp.join([left, right], spacer_str="TTT")
pool.print_library()
pool: seq_length=11, num_states=3 ACGTTTTAAAA
ACGTTTTCCCC
ACGTTTTGGGG

Controlling iteration order with iter_order

The pool with the smallest iter_order value varies fastest (inner loop). Here b is the inner loop and a is the outer loop.

a    = pp.from_seqs(["A", "C"], mode='sequential', iter_order=2)   # outer (slower)
b    = pp.from_seqs(["G", "T"], mode='sequential', iter_order=1)   # inner (faster)
pool = pp.join([a, b])
pool.print_library()
pool: seq_length=2, num_states=4 AG
AT
CG
CT

Join three pools with a literal string segment

Plain strings in the list are treated as fixed single-sequence pools, eliminating the need to call from_seq() for constant flanks.

promoter = pp.from_seqs(["AAAA", "CCCC"], mode="sequential")
insert   = pp.from_seqs(["GCGC", "TATA"], mode="sequential")
pool     = pp.join([promoter, "NNNNN", insert])
pool.print_library()
pool: seq_length=13, num_states=4 AAAANNNNNGCGC
AAAANNNNNTATA
CCCCNNNNNGCGC
CCCCNNNNNTATA

See join().