Experiment¶
Experiment is GenAIRR's fluent pipeline
builder. Every method returns the same Experiment
extended by one pipeline stage; the pipeline runs when you call
.run_records(...), .run(...), or
.compile().run(...). For the conceptual walk-through -
which methods are ancestor-phase vs descendant-phase, which clonal
model to choose, how compile reuse works - see
the Experiment builder
guide. The reference below catalogues the public surface.
Common methods¶
The methods you'll reach for in most real pipelines:
| Method | Purpose |
|---|---|
.recombine(...) |
Add the V(D)J recombination pass - the foundational ancestor-phase mechanism |
.process_coding_ends(...) |
Opt in to signed net processing of explicitly confirmed original coding ends |
.productive_only() |
Constrain sampling so only productive rearrangements survive |
.mutate(...) |
Apply biological SHM (uniform or S5F) on top of recombination |
.clonal_lineage(...) |
Grow BCR affinity-maturation lineage trees |
.clonal_repertoire(...) |
Generate TCR / flat-BCR abundance repertoires with clone sizes and duplicate_count |
.expand_clones(...) |
Legacy fixed-size clonal star model |
.paired_end(...) |
Project assembled sequences as paired R1 / R2 reads |
.run_records(...) |
Compile + run + return a SimulationResult |
For the full pipeline-stage map (constraints, trim overrides, all the corruption methods, compile reuse, strict mode), see The Experiment builder.
Class reference¶
The autogenerated reference below comes straight from the
docstrings in src/GenAIRR/experiment.py. This page is the
pilot for the wider generated-reference effort.
GenAIRR.experiment.Experiment
¶
Bases: _CorruptionMixin, _ConstraintsMixin, _ClonalMixin, _MutationMixin, _GenotypeAllelesMixin, _RecombinationMixin, _RefdataControlsMixin, _CompileMixin, _RunMixin, _IntrospectionMixin
Fluent builder for a simulation pipeline.
Build an Experiment from a config name, a :class:DataConfig,
or a :class:GenAIRR._engine.RefDataConfig via :meth:Experiment.on,
chain configuration steps (currently just :meth:recombine), then
call :meth:run (or :meth:compile for explicit two-stage flow).
The builder is stateful but not destructive: each fluent call
returns self after appending a step. The same Experiment
can be compile()-d and run()-d multiple times with
different seeds.
on(source)
classmethod
¶
Start an experiment against the given reference data.
source is one of:
- a config-name string (e.g. "human_igh"),
- a :class:GenAIRR.DataConfig instance,
- a :class:GenAIRR._engine.RefDataConfig.
When source is a config name or a DataConfig, the
underlying empirical distributions (NP lengths, per-gene
trims) are kept on the experiment so :meth:recombine can
use them as the default sampling distributions. A bare
RefDataConfig has no such backing — :meth:recombine
falls through to its uniform [0..6] placeholder unless
the caller passes np1_lengths / np2_lengths
explicitly.