Real Experiment Results

class fac.real_experiments.FullRealExperimentResult(er_by_model: Dict[str, RealExperimentResultForModel], masks_each: List[Tuple[str, ndarray]])

Results of running a real experiment for multiple models on a list of exons.

Parameters:
  • er_by_model – a dictionary mapping model names to fac.RealExperimentResultForModel.

  • masks_each – a list of tuples, each containing a mask and a name. The mask is a boolean array of shape (num_exons,) indicating which exons were used in the experiment. The name is a string identifying the mask.

filter_models(func: Callable[[str], bool]) FullRealExperimentResult

Filter the models in this result, keeping only those for which func returns True when called with the model name.

map_model_keys(func: Callable[[str], str]) FullRealExperimentResult

Map the model names in this result using func.

mean_decrease_probability_each(*, k, transpose=False) Dict[str, ndarray]

Mean decrease probability for each model, for each mask.

Returns:

a dictionary mapping model names to arrays of shape (num_seeds, num_masks).

classmethod merge(er_by_models: List[FullRealExperimentResult]) FullRealExperimentResult

Merge multiple FullRealExperimentResult instances into one. The masks must be the same for all instances.

class fac.real_experiments.RealExperimentResultForModel(actual: ndarray, predicteds: List[ndarray])

Results of running a real experiment for a model on a list of exons.

Parameters:
  • actual – are the real log PSI values for the exons. Shape (num_exons,).

  • predicted – the predicted log PSI values for the exons. Shape (num_seeds, num_exons).

compute_mean_decrease_probability_each(masks, *, k, transpose=False)

Compute the mean decrease probability for each mask.

Parameters:

masks – a list of tuples, each containing a mask and a name. The mask is a boolean array of shape (num_exons,) indicating which exons were used in the experiment. The name is a string identifying the mask.

Returns:

an array of shape (num_seeds, num_masks) containing the mean decrease probability for each seed and each mask.

fac.poison_exons.poison_exon_scores(model_to_analyze: ModelToAnalyze, limit=None) ndarray

Run the model on poison exons and return the log10 of the probabilities.

Parameters:
  • model_to_analyze – The model to be analyzed.

  • limit – The maximum number of poison exons to analyze. Useful for testing.

fac.poison_exons.poison_exon_scores_for_model_series(mods: Dict[str, List[ModelToAnalyze]], limit=None) Dict[str, List[ndarray]]

Run the model on poison exons and return the log10 of the probabilities.

Parameters:
  • mods – A dictionary of models to be analyzed.

  • limit – The maximum number of poison exons to analyze. Useful for testing.

Plotting

fac.real_experiments.plot_summary(ax, summaries, title, *, name_remapping=frozendict.frozendict({}), is_transposed=False, **kwargs)

Plot a summary of each experiment, showing the mean decrease in probability of closed frames. Also, print the p-values of the permutation tests.

Parameters:
  • ax – the axis to plot on.

  • summaries – a dictionary mapping model names to lists of tuples. Each tuple contains the mean decrease probabilities of closed frames and the mean decrease probabilities of closed frames for the control.

  • title – the title of the plot.

  • name_remapping – a dictionary mapping model names to new names.

fac.poison_exons.poison_exon_scatterplots(results: Dict[str, ndarray])

Plot scatterplots of the results of the poison exon analysis. Will plot the results of the analysis for each model in the results dictionary, and provide line fits to the data, as well as the correlation coefficient, for the open and closed exons separately.

Parameters:

results – A dictionary of results, where the keys are the names of the models and the values are the results of the poison exon analysis.

fac.poison_exons.poison_exons_summary_plot(results: Dict[str, ndarray], ax=None, *, k, **kwargs)

Plot the summary of the poison exon analysis. This will plot the mean decrease probability for each model in the results dictionary, and provide a bar plot of the results.

Parameters:

results – A dictionary of results, where the keys are the names of the models and the values are the results of the poison exon analysis.