Repository: biopython/biopython

Issue:
Why 1.25-raw_miyata_matrix in Bio.SubsMat.MatrixInfo
### Setup

I am reporting a problem with Biopython version, Python version, and operating
system as follows:

```python
import sys; print(sys.version)
import platform; print(platform.python_implementation()); print(platform.platform())
import Bio; print(Bio.__version__)
```

<details>

```py
3.7.9 | packaged by conda-forge | (default, Dec  9 2020, 20:36:16) [MSC v.1916 64 bit (AMD64)]
CPython
Windows-10-10.0.19041-SP0
1.78
```

</details>

### Expected behaviour

`Bio.SubsMat.MatrixInfo` provides users with the raw `miyata` matrix, or any modified `miyata` matrix with an explanation on why.

#### Denotation

* raw `miyata` matrix: physicochemical distance matrix origins from `Miyata T, Miyazawa S, Yasunaga T. Two types of amino acid substitutions in protein evolution. J Mol Evol. 1979 Mar 15;12(3):219-36. doi: 10.1007/BF01732340. PMID: 439147.`
* modified `miyata` matrix: similarity matrix converted from raw `miyata` matrix

### Actual behaviour

`Bio.SubsMat.MatrixInfo` provides a similarity matrix converted by `1.25-d_{i} for d_{i} in raw miyata matrix`, which origins from <https://web.archive.org/web/19991013233553/http://www.embl-heidelberg.de/~vogt/matrices/miyata.cmp>. But none ever get to know why to use 1.25. At least in my limited search, only `biopython` implements this modified matrix. I would appreciate it if someone can provide any reference or explanation on this.

### Steps to reproduce

https://github.com/biopython/biopython/blob/171697883aca6894f8367f8f20f1463ce7784d0c/Bio/SubsMat/MatrixInfo.py#L1911-L1915

* <https://en.wikipedia.org/wiki/Amino_acid_replacement#Miyata's_distance>



Discussion:
The simple answer is because that's what Dr. Gerhard Vogt used, but I don't know why or how this particular value was picked. My guess is the offset is some kind of weighted average of the distances, used as part of turning distances (large for different sequences) into similarity scores (large for similar sequences).

Perhaps @idoerg recalls something as the original contributor of this code back in 2000?

The only recent meaningful change to this code was in #1781 by @darcymason to address #308 (an error in the Grant matrix). Again, there was a mysterious offset from Dr Vogt.

Thanks for your reply. It seems the reason to use this offset is buried by the time of sand. Neither the mean nor standard deviation of the original values of the distance matrix is related to it.

But using 1.25 instead of 1 to convert the original distance matrix into a similarity matrix would affect the signs of the following pairs:

```py
{key:value for key,value in miyata.items() if value > 0 and 1-(1.25-value) < 0}
```

```py
('W', 'F')-> original=1.11, 1-1.11=-0.11, 1.25-1.11=0.14
('W', 'Y')-> original=1.06, 1-1.06=-0.06, 1.25-1.06=0.19
('K', 'Q')-> original=1.06, 1-1.06=-0.06, 1.25-1.06=0.19
('R', 'Q')-> original=1.13, 1-1.13=-0.13, 1.25-1.13=0.12
('K', 'E')-> original=1.14, 1-1.14=-0.14, 1.25-1.14=0.11
('Q', 'T')-> original=1.12, 1-1.12=-0.12, 1.25-1.12=0.13
```

Maybe it is intended to balance the distribution of values close to zero? Just guessing🐵.
Do you want to make a pull request to clarify the docstring for this module, or shall we just close this issue?

Resolving patch:
diff --git a/Bio/SubsMat/MatrixInfo.py b/Bio/SubsMat/MatrixInfo.py
--- a/Bio/SubsMat/MatrixInfo.py
+++ b/Bio/SubsMat/MatrixInfo.py
@@ -1909,6 +1909,8 @@
 
 
 # http://www.embl-heidelberg.de/~vogt/matrices/miyata.cmp
+# This similarity matrix is converted from the original miyata physicochemical distance matrix (PMID: 439147) via this formula: similarity = 1.25 - distance
+# The offset 1.25 is chosen by Dr. Gerhard Vogt. Be cautious about this offset since there is no known solid reason to use it.
 miyata = {
     ("W", "F"): 0.14, ("L", "R"): -1.37, ("S", "P"): 0.69, ("I", "I"): 1.25,
     ("Q", "Q"): 1.25, ("N", "A"): -0.53, ("H", "T"): -0.07, ("N", "E"): 0.4,


Test patch: