pyprobound.experiment.Experiment
- class Experiment(rounds, counts_per_round=None, name='')
Bases:
TransformModels sequenced rounds corresponding to count table columns.
- rounds
A ModuleList of all rounds, including those not sequenced.
- Type:
- __init__(rounds, counts_per_round=None, name='')
Initializes the experiment from an iterable of sequenced rounds.
- Parameters:
rounds (
Iterable[BaseRound]) – The sequenced rounds modeled by the experiment.counts_per_round (
Tensor|list[float] |None) – A tensor with the number of probes in each round of the count table used for training, with shape \((\text{rounds},)\). Should be provided for Kd-seq or pseudocount > 0.name (
str) – A string used to describe the experiment.
Methods
cache(fun)Decorator for a function to cache its output.
check_length_consistency()Checks that input lengths of Binding components are consistent.
Iterator of child components.
forward(seqs)Predicts the log probe frequencies.
free_protein(i_index, b_index, u_index[, ...])Estimates the free protein concentration.
freeze()Turns off gradient calculation for all parameters.
max_embedding_size()The maximum number of bytes needed to encode a sequence.
optim_procedure([ancestry, current_order])The sequential optimization procedure for all Binding components.
reload(checkpoint)Loads the model from a checkpoint file.
reload_from_state_dict(state_dict)Loads the model from a state dict.
save(checkpoint[, flank_lengths])Saves the model to a file with "state_dict" and "metadata" fields.
unfreeze([parameter])Turns on gradient calculation for the specified parameter.
Attributes
A list of the number of probes in each round of the count table used for training, with shape \((\text{rounds},)\).
unfreezablealias of
Literal['all']Non-Inherited Members
- property counts_per_round: list[float]
A list of the number of probes in each round of the count table used for training, with shape \((\text{rounds},)\).
- forward(seqs)
Predicts the log probe frequencies.
\[\log \frac{\eta_{r} f_{i,r}}{ \sum_{r^\prime} \eta_{r^\prime} f_{i, r^\prime} }\]- Parameters:
seqs (
Tensor) – A sequence tensor of shape \((\text{minibatch},\text{length})\) or \((\text{minibatch},\text{in_channels},\text{length})\).- Return type:
Tensor- Returns:
The log frequency tensor of shape \((\text{minibatch},\text{rounds})\).
- free_protein(i_index, b_index, u_index, target_concentration=None, library_concentration=None)
Estimates the free protein concentration.
If the input (I), bound (B), and unbound (U) probes of a selection are modeled jointly, PyProBound can estimate free protein concentration.
\[\begin{split}[\text{P}]_F &= [\text{P}]_T - [\text{library}] p(B) \\ p(B) &= \frac{k_B}{k_I} \frac{\eta_I}{\eta_B}\end{split}\]- Parameters:
i_index (
int) – The index of the input round.b_index (
int) – The index of the BoundRound.u_index (
int) – The index of the UnboundRound.target_concentration (
float|None) – The total protein concentration \([\text{P}]_T\), taken from Aggregate if not provided.library_concentration (
float|None) – The total library concentration \([\text{library}]\), taken from Round if not provided.
- Return type:
float- Returns:
The free protein concentration represented as a float.