Substitution Probability Models

Minimal API for developing substitution likelihood probability models for species mutation.

Probability models for species substitution.

Implements base class SubstitutionModel, which can be extended to allow for development of new lambda tables. An example of such an extension, RadiusModel, is also implemented.

Todo

  • Allow for parallelism in lambda table calculations by implementing a sub_probs abstractmethod that SubstitutionModel.gen_lambda() uses, if available.

class smact.structure_prediction.probability_models.RadiusModel[source]

Bases: SubstitutionModel

Substitution probability model based on Shannon radii.

sub_prob(s1, s2)[source]

Calculate the probability of substituting species s1 for s2.

Based on the difference in Shannon radii, the probability is assumed to be:

\[p = 1 - k \Delta r^2.\]
Parameters
  • s1 – The species being substituted.

  • s2 – The species substituting.

Returns

The probability of substitution.

class smact.structure_prediction.probability_models.SubstitutionModel[source]

Bases: ABC

Abstract base class for substitution models.

gen_lambda()[source]

Generate a lambda table for a list of species.

Parameters

species – A list of species strings.

Returns

A pivot table-style DataFrame containing lambda values for every possible species pair.

abstract sub_prob(s1: str, s2: str) float[source]

Calculate the probability of substituting species s1 for s2.

Parameters
  • s1 – The species being substituted.

  • s2 – The species substituting.

Returns

The probability of substitution.