Replace 3mer Experiments
- fac.replace_3mer.Replace3MerResult(acc_delta: ndarray, no_undesired_changes_mask: ndarray) None
Contains the results of a replace 3mer experiment.
- Parameters:
acc_delta – The delta in accuracy for all exons. Shape
`(num_seeds, num_exons, 2, 3, 64)``acc_delta[seed_idx, batch_idx, distance_from_which, phase, codon]`is the delta in accuracy, in percentage points, when you replace the codon at distance_out from the acceptor or donor (A if`distance_from_which == 0`, D if`distance_from_which == 1`) with the codon at index codonno_undesired_changes_mask – Whether or not undesired changes might be caused by the substitution. Shape
`(num_exons, 2, 3, 64)`.
- fac.replace_3mer.experiment(*, model_for_analysis: ModelToAnalyze, distance_out, limit=None) Replace3MerResult
Compute the delta in accuracy when replacing codons at all 3 phases with all 64 possible codons.
- Parameters:
model_for_analysis – The model to compute the delta in accuracy for
distance_out – The distance from the acceptor and donor sites to mutate the codons at
limit – The number of exons to run the experiment on. If None, run on all exons
- Returns:
the results of the experiment
- fac.replace_3mer.experiments(models: Dict[str, List[ModelToAnalyze]], distance_out, limit=None) Dict[str, Replace3MerResult]
A wrapper around
fac.replace_3mer.experimentthat takes a dictionary of model series and returns a dictionary of results. The keys of the input dictionary are used as the keys of the output dictionary.See
fac.replace_3mer.experimentfor more details.
- fac.replace_3mer.no_undesired_changes_mask(o_seq)
Compute a mask of whether a 3mer mutation induces a change to the stop codon landscape in any of the three phases that wasn’t the one that was mutated.
E.g., TAGCCC -> TAGTGA is a desired change because it adds a stop codon in phase 0, which was the mutation, but ATACCC -> ATAGCC is an undesired change because it adds a stop codon in phase 1, which is not the phase that was mutated.
- Parameters:
o_seq – The original sequence. Shape (N, 2, 9) where N is the number of exons, 2 is the number of locations, and 9 is the length of the original sequence at the location.
- Returns:
A mask of shape (N, 2, 3, 64) where N is the number of exons, 2 is the number of locations, 3 is the number of phases, and 64 is the number of codons. The mask is True when the codon mutation does not introduce or remove any out of frame stop codons.
Plotting
- fac.replace_3mer.plot_by_codon(result: Replace3MerResult, mask: ndarray, *, ax=None)
Plot the accuracy drop per codon. This is a detailed plot that shows the accuracy drop for each codon, averaged across seeds. The plot is split by phase. The x-axis is the codon and the y-axis is the accuracy drop.
- Parameters:
result – The result of the experiment
mask – You can pass
result.no_undesired_changes_mask, this is useful if you want to exclude some mutations that cause undesired changes.ax – The axis to plot on. If None, a new figure is created.
- fac.replace_3mer.plot_effect_grouped(results: Dict[str, Replace3MerResult], mask: ndarray, distance_out: int, **kwargs)
Plot the summary of the accuracy drop by codon, with all non-stop codons grouped together. This is a summary plot that shows the accuracy drop for each codon, averaged across seeds; and with all models placed on a single plot. The plot is split by model, phase, and then codon.
- Parameters:
acc_delta – The accuracy drop per codon. Second output of
`fac.replace_3mer.experiments`mask – The mask of experiment results to be used. First output of
`fac.replace_3mer.experiments`or all ones if you want to include all results.distance_out – The distance out from the splice site.
kwargs – Additional arguments to pass to plt.figure.
- fac.replace_3mer.plot_by_codon_table(results: Dict[str, Replace3MerResult], no_undesired_changes: ndarray)
Plots the same information as plot_by_codon, but in a table format.
- Parameters:
results – The accuracy drop per codon. Second output of
`fac.replace_3mer.experiments`.no_undesired_changes – The mask of experiment results to be used. First output of
`fac.replace_3mer.experiments`.