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

Dimension-name ordering: the pool with the smallest value varies fastest (inner loop). Can be set on each individual pool instead.

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.

import poolparty as pp
pp.init()
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.

import poolparty as pp
pp.init()
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.

import poolparty as pp
pp.init()
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.

import poolparty as pp
pp.init()
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().