Porthmeus / MeMoMe

Metabolic Model Merging - a semiautomated way to merge genome scale metabolic models
Apache License 2.0
0 stars 0 forks source link

SUPER WEIRD: Metabolites with different inchis match #125

Closed Unaimend closed 6 months ago

Unaimend commented 6 months ago
def test_1toManyMatchingOnInchi(self):
    metaboliteA: MeMoMetabolite = MeMoMetabolite()
    metaboliteB: MeMoMetabolite = MeMoMetabolite()
    metaboliteA.set_id("A")
    metaboliteB.set_id("B")
    metaboliteA.set_inchi_string("InChI=1S/H2O/h1H2")
    metaboliteB.set_inchi_string("InChI=1S/CH4/h1H4")

    model = MeMoModel([metaboliteA])
    model2 = MeMoModel([metaboliteA, metaboliteB])
    res = model.match(model2, keep1ToMany = True)
    # This test should fail IMHO
    self.assertTrue(1==0)
    print(res)
    self.assertEqual(res.shape[0], 2)
    self.assertEqual(res["inchi_score"][0], 1.0000)
    val = res["inchi_score"][1]
    self.assertTrue(math.isclose(val, 1, rel_tol=1e-2))

results in

    met_id1 met_id2  inchi_score inchi_string_inchi  charge_diff_inchi  DB_score  charge_diff_db  inchi_string_db  Name_score  charge_diff  inchi_string
0       A       A            1  InChI=1S/H2O/h1H2                  0       NaN             NaN              NaN         NaN          NaN           NaN
1       A       B            1  InChI=1S/H2O/h1H2                  0       NaN             NaN              NaN         NaN          NaN           NaN

Why does the inchi of A match the inchi of B

Code can be found at https://github.com/Porthmeus/MeMoMe/tree/thomas/feature/108

execute

python -m unittest tests.test_MeMoModel.Test_MiscStuff.test_1toManyMatchingOnInchi

Unaimend commented 6 months ago

Confirmed by Porthmeus as a bug

Porthmeus commented 6 months ago

Fixed in ce13c46 - still needs to be merged