## 3 Methods
### Probability estimator for ranking based on physical properties of the amino acids  
The concept of substitution class [13] can be used to reduce the alphabet of symbols in our alignment and it allows to capture general features required at a given position to maintain specificity. This point is particularly relevant in our work, for its practical implications. In fact, once a SPD is found, determining the chemical-physical property mainly responsible for its specificity can give hints on the mutations to be tried to push the protein toward another class. This is indeed one of the main application we envision for our method. Additionally, the concept of reducing the 20-letter amino acid alphabet to a few letter one is very general in the theoretical modeling of protein structure, especially in Coarse Grained representations[14]. As illustrated in the following subsections, this reduction can be done either based on a set of physical or chemical characteristics identified _a priori_ or by letting SDPhound find the most appropriate set of substitution classes for a given alignment. A priori partitioning of amino acids on a physical basis  
Suppose we characterize and group the amino acids based on some convenient physical property such as size, charge, hydrophobicity, etc. as detailed in the SI. Let \(\sigma_{\alpha}\) indicate one of these classes, that we shall call \"_pigeonholes_\" so as to avoid confusion with the specificity classes. Following the same line of thought of subsection 3.2., we define  
\[P_{p}(\sigma_{\alpha},i)\approx\sum_{\sigma_{\beta}}f_{p}(\sigma_{\beta},i)M( \sigma_{\beta}\rightarrow\sigma_{\alpha}) \tag{13}\]  
as the probability to find a member of pigeonhole \(\sigma_{\alpha}\) in position \(p\) in the sequence belonging to class \(i\). For example, if \(\sigma_{\alpha}\) corresponds to \"being a positively charged amino acid\", this is the probability to find a basic residue in position \(p\) for a class \(i\) protein. \(f_{p}(\sigma_{\beta},i)\) is the relative occurrence frequency at position \(p\) of a generic member of the pigeonhole \(\sigma_{\beta}\) and \(M(\sigma_{\beta}\rightarrow\sigma_{\alpha})\) is the substitution probability of any member of pigeonhole \(\sigma_{\beta}\) with one belonging to \(\sigma_{\alpha}\). We define this probability as:  
\[M(\sigma_{\beta}\rightarrow\sigma_{\alpha})=\sum_{\alpha\in\sigma_{\alpha}} \sum_{\beta\in\sigma_{\beta}}P(\beta|\sigma_{\beta})m(\beta\rightarrow\alpha) \tag{14}\]The probability to pick the element \(\beta\) within the pigeonhole \(\sigma_{\beta}\) is estimated according to the usual frequentist approach:  
\[P(\beta|\sigma_{\beta})\approx\frac{\sum_{p}f_{p}(\beta)}{\sum_{p}f_{p}(\sigma_ {\beta})} \tag{15}\]  
Once the probability (13) is calculated, it can be used to obtain the mutual information  
\[I_{p}=\sum_{i=1}^{N}\sum_{\sigma_{\alpha}}P_{p}(\sigma_{\alpha},i)\text{ln} \frac{P_{p}(\sigma_{\alpha},i)}{P_{p}(\sigma_{\alpha})P(i)} \tag{16}\]  
Given the meaning of the probability employed, a ranking of the positions based on the mutual information above rewards positions depending on the physical characteristic associated to the pigeonhole. This generalization of standard mutual information based ranking paves the way for an efficient new way of analysing SDPs, because it is able to translate SDP relevance in terms of physical meaning. As we shall show in the applications, this suggests how to target mutations in a more focused way, alternative to purely random mutagenesis. Optimal automatic pigeonholing  
An amino acid partitioning based on some _a priori_ chosen property, like the one introduced in the previous subsection, may not capture the characteristic interplay of phenomena responsible for specificity. Therefore, an automated procedure searching for an optimal amino acid distribution among a predefined number of otherwise arbitrary pigeonholes may be preferable.