{"id":13994261,"url":"https://github.com/lobolab/mergem","last_synced_at":"2025-07-22T19:31:34.873Z","repository":{"id":43760007,"uuid":"427165067","full_name":"lobolab/mergem","owner":"lobolab","description":"mergem is a python package and command-line tool for merging, comparing, and translating genome-scale metabolic models","archived":false,"fork":false,"pushed_at":"2024-03-02T00:21:19.000Z","size":10091,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-07-18T23:39:05.742Z","etag":null,"topics":["genome-scale-models","sbml","systems-biology"],"latest_commit_sha":null,"homepage":"https://lobolab.umbc.edu/mergem/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lobolab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-11-11T22:48:37.000Z","updated_at":"2024-03-20T00:11:53.000Z","dependencies_parsed_at":"2024-03-24T08:33:33.581Z","dependency_job_id":"f09b0dbe-49c0-4cc1-be2d-e75bc106e43a","html_url":"https://github.com/lobolab/mergem","commit_stats":{"total_commits":66,"total_committers":3,"mean_commits":22.0,"dds":"0.43939393939393945","last_synced_commit":"b1a58a383ede6208aa5df48e6874937a08bc483c"},"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lobolab%2Fmergem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lobolab%2Fmergem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lobolab%2Fmergem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lobolab%2Fmergem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lobolab","download_url":"https://codeload.github.com/lobolab/mergem/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":214675184,"owners_count":15768122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["genome-scale-models","sbml","systems-biology"],"created_at":"2024-08-09T14:02:47.625Z","updated_at":"2025-07-22T19:31:34.858Z","avatar_url":"https://github.com/lobolab.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"mergem\n======\nmergem is a python package and command-line tool for merging, comparing, and translating genome-scale metabolic models.\n\n------\n\n\nInstallation\n------\nUse pip to install the latest release:\n\n    pip install mergem\n\n------\n\nUsage\n------\nFor detailed usage instructions, please refer to the [documentation](https://mergem.readthedocs.io/en/latest/).\n\n#### Command-line usage\nCommand-line options can be viewed using \"--help\" flag, as shown below:\n\n    \u003e mergem --help\n    Usage: mergem [INPUT_FILENAMES] [OPTIONS]\n\n    mergem takes genome-scale metabolic models as input, merges them into a\n    single model and saves merged model as .xml. Users can optionally select the\n    objective and provide an output filename for merged model, and translate the \n    models to a different namespace.\n\n    Lobo Lab (https://lobolab.umbc.edu)\n\n    Options:\n    -obj TEXT  Set objective: 'merge' all objectives (default) or 1, 2, 3...\n             (objective from one of the input models)\n    -o TEXT    Save merged model as (filename with format .xml, .sbml, etc.)\n    -v         Print merging statistics\n    -up        Update ID mapping table\n    -s         Save ID mapping table as CSV\n    -e         Uses exact stoichiometry when merging reactions\n    -p         Consider protonation when merging reactions\n    -a         Extend annotations with mergem database of metabolites and reactions\n    -t         Translate metabolite and reaction IDs to a target namespace (chebi, metacyc, \n               kegg, reactome, metanetx, hmdb, biocyc, bigg, seed, sabiork, or rhea)\n    -c         output as a community model\n    --version  Show the version and exit.\n    --help     Show this message and exit.\n\n \nFor merging two models and setting objective of merged model from first model, use:\n\n    mergem model1.xml model2.xml\n\n\nThe `-obj` argument can be used to set the objective function of merged model. Allowed values include `merge` to merge input model objective functions (default) or an integer representing the objective function from the model in order of input (1, 2, 3, ..):\n\n    mergem model1.xml model2.xml -obj 1\n\n\nTo print merge statistics, append the `-v` flag:\n\n    mergem model1.xml model2.xml -v\n\n\nOutput model filename can be provided using the `-o` argument followed by desired output filename with file format specified in the extension (.xml, ...):\n\n\n    mergem model.xml model2.xml -o mergedmodel.xml\n\n\nSave the ID mapping table as a CSV file by using the `-s` argument:\n\n\n    mergem model1.xml model2.xml -s\n\n\nBy default, reactions are merged when they have both a similar set of reactants and a similar set of products, without comparing their stoichiometry. To merge reactions only when they have the same exact stoichiometry in their reactants and products, use the `-e` argument:\n\n\n    mergem model1.xml model2.xml -e\n\n\nBy default, reactions are compared ignoring the hydrogen and proton metabolites. To consider also the hydrogen and proton metabolites when comparing reactions, use the `-p` argument:\n\n\n    mergem model1.xml model2.xml -p\n\n\nMetabolite and reaction annotations are merged from all input models. In addition, mergem can extend these annotations using the mergem database. For extending the annotations using mergem database, use the `-a` argument:\n\n\n    mergem model1.xml model2.xml -a\n\n\nMergem can translate the metabolite and reaction IDs to another database system when using the `-t` argument:\n\n\n    mergem model1.xml -t chebi\n\n\nMergem can merge models into a community models using the `-c` argument. In addition, the metabolites of a single model can be assigned compartments without merging:\n\n\n    mergem model1.xml model2.xml -c\n\n\n#### Python usage\n\nTo use mergem  within a python script, simply import the package with:\n\n    import mergem\n\nFor merging or processing one, two, or more models, provide a list of models to the merge function:\n\n    results = mergem.merge(input_models, set_objective='merge', exact_sto=False, use_prot=False, extend_annot=False, trans_to_db=None, community_model=False)\n    merged_model = results['merged_model']\n    jacc_matrix = results['jacc_matrix']\n    num_met_merged = results['num_met_merged']\n    num_reac_merged = results['num_reac_merged']\n    met_sources = results['met_sources']\n    reac_sources = results['reac_sources']\n\n* `input_models` is a list of one or more COBRApy model objects or strings specifying file names.\n* `set_objective` specifies if the objective functions are merged ('merge') or copied from a single model (specifying the index of the model: '1', 2', '3', etc.).\n* `exact_sto` use exact stoichiometry when merging reactions.\n* `use_prot` consider hydrogen and proton metabolites when merging reactions.\n* `add_annot` add additional metabolite and reaction annotations from mergem dictionaries.\n* `trans_to_db` translate metabolite and reaction IDs to a target database (chebi, metacyc, kegg, reactome, metanetx, hmdb, biocyc, bigg, seed, sabiork, or rhea)\n* `community_model` consider community metabolites when merging\n\n* `results` a dictionary with all the results, including:\n* `merged_model` the merged model.\n* `jacc_matrix` metabolite and reaction jaccard distances.\n* `num_met_merged` number of metabolites merged.\n* `num_reac_merged` number of reactions merged.\n* `met_sources` dictionary mapping each metabolite ID in the merged model to the corresponding metabolite IDs from each of the input models.\n* `reac_sources` dictionary mapping each reaction ID in the merged model to the corresponding reaction IDs from each of the input models.\n\nThe merge function returns a dictionary of results including the merged model, the metabolite and reaction Jaccard distance matrix between models, and the metabolite and reaction model sources. \n\n\nThe following functions can also be imported from mergem:\n\n    from mergem import translate, load_model, save_model, map_localization, map_metabolite_univ_id, map_reaction_univ_id, get_metabolite_properties, get_reaction_properties, update_id_mapper\n\n* `translate(input_model, trans_to_db)` translates a model to another target database specified in `trans_to_db`.\n* `load_model(filename)` loads a model from the given filename/path.\n* `save_model(cobra_model, file_name)` takes a cobra model as input and exports it as file `file_name`.\n* `map_localization(id_or_model_localization)` converts localization suffixes into common notation.\n* `map_metabolite_univ_id(met_id)` maps metabolite id to metabolite universal id.\n* `map_reaction_univ_id(reac_id)` maps reaction id to metabolite universal id.\n* `get_metabolite_properties(met_univ_id)` retrieves the properties of a metabolite using its universal id\n* `get_reaction_properties(reac_univ_id)` retrieves the properties of a reaction using its universal id\n* `update_id_mapper(delete_database_files)` updates and build mergem database. It will download the latest source database files, merge the identifiers based on common properties, and save the mapping mapping tables and information internally. This process can take several hours. The parameter specifies if the downloaded intermediate database files are deleted after the update (saves disk space but the next update will take longer; dafault is True).\n\n\n------\nCitation\n======\nPlease cite mergem using: \u003cbr\u003e\n\u003cbr\u003e [mergem: merging, comparing, and translating genome-scale metabolic models using universal identifiers](https://doi.org/10.1093/nargab/lqae010)\n\u003cbr\u003e A. Hari, A. Zarrabi, D. Lobo\n\u003cbr\u003e \u003cb\u003eNAR Genomics and Bioinformatics\u003c/b\u003e, 6(1), lqae010, 2024\n\n------\nAcknowledgements \n======\n\nThis package was developed at [The Lobo Lab](https://lobolab.umbc.edu), University of Maryland, Baltimore County.\n\n------\n\nLicense\n======\nThis package is under GNU GENERAL PUBLIC LICENSE. The package is free for use without any express or implied warranty.\nIn no event will the authors be held liable for any damages arising from the\nuse of this software. Permission is granted to anyone to use this software for any purpose, \nsubject to the following restrictions:\n\n1. The origin of this software and database must not be misrepresented;\n   you must not claim that you wrote the original software.\n2. If you use this software and/or database in a work (any production in the scientific, literary, and artistic domain), \n   an acknowledgment and citation (see publication above) in the work is required.\n3. This notice may not be removed or altered from any distribution.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flobolab%2Fmergem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flobolab%2Fmergem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flobolab%2Fmergem/lists"}