Porthmeus / MeMoMe

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

Weird results when merging recon #114

Open Unaimend opened 6 months ago

Unaimend commented 6 months ago

Merging with recon results

import unittest
from pathlib import Path
import cobra as cb
import pandas as pd
import warnings

# from src.MeMoModel import MeMoModel
from src.MeMoMetabolite import MeMoMetabolite
from src.MeMoModel import MeMoModel

this_directory = Path(__file__).parent
dat = this_directory.joinpath("../manually_merged_models")

#class Test_annotateBulkRoutines(unittest.TestCase):
def test_MeMoModelCompare2():
    import time

    # Record the start time
    start_time = time.time()
    # test the comparison for metabolite matching
    #mod_path = dat.joinpath("MYb11_iCEL1314/M1_MYb11.xml")
    #mod_path2 = dat.joinpath("MYb11_iCEL1314/M2_iCEL1314.xml")

    mod_path = dat.joinpath("gapseq_recon3D/M1_recon3D_301_modified.xml")
    mod_path2 = dat.joinpath("gapseq_recon3D/M2_bacterial_model.xml")

    mod = MeMoModel.fromPath(mod_path)
    mod2 = MeMoModel.fromPath(mod_path2)

    print(len(mod.cobra_model.metabolites))
    print(len(mod2.cobra_model.metabolites))

    # self comparison
    res = mod.match(mod)
    res.to_csv("stuff.csv")
    end_time = time.time()

    # Calculate the elapsed time
    elapsed_time = end_time - start_time

    print("Elapsed time:", elapsed_time, "seconds")
in wrong matches 

image

Unaimend commented 6 months ago

Code is on the https://github.com/Porthmeus/MeMoMe/tree/thomas/feature/matching branch. Look at tests/utils/match... , just change res = mod.match(mod2) to res = mod.match(mod)

Unaimend commented 6 months ago

Please check with 1toMany matching disabled and enabled

Porthmeus commented 5 months ago

Confirmed - something is wrong here.

Unaimend commented 5 months ago

That is weird, I would have thought the stuff regarding https://github.com/Porthmeus/MeMoMe/issues/125 also fixes this issue

Unaimend commented 1 month ago

@Porthmeus is this fixed now? I think it is