Skip to content

Numerical stability issue in --bpp output: BPP values can exceed 1 #27

Description

@shnchiba

Thank you for developing and maintaining MXFold2. I have been using MXFold2 to compute base-pairing probability (BPP) matrices with the --bpp option, and I noticed a numerical issue in the BPP output.

For some input sequences, the BPP matrix contains values greater than 1, although BPP values should theoretically be within the range [0, 1]. For example, using the attached minimal reproducible sequence (152.fasta), I obtained the following debug output before the np.triu() / symmetrization step in predict.py:

[BPP DEBUG] raw shape: (1138, 1138)
[BPP DEBUG] base-294 vs base-318: bpp = 1.00101781
[BPP DEBUG] raw row-sum max: 1.0011761

In another longer sequence, the original single-precision BPP output contained larger violations, with values around 1.08. After modifying the partition-function/BPP computation to use double precision, the issue disappeared in that case.

The modification I tested only changes the numerical precision used for the partition-function and BPP calculation from single precision to double precision. As far as I can tell, this issue affects the --bpp output, but it does not appear to affect the usual structure-prediction output.

I am reporting this in case it is useful for improving the numerical stability of the --bpp option. I would be happy to provide debug logs or a small patch if helpful.

152.fasta.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions