Seed2LP is a Python tool that searches seeds in metabolic networks. It uses answer set programming (ASP) and provides three approaches for seed detection:
- Full network mode, that activates all compounds of the metabolic network.
- Target mode, that activates metabolites of interest.
- FBA mode, that randomly searches seeds ensuring a positive flux into the objective reaction, using ASP linear constraints with clingo-lpx
Mandatory inputs:
- Network file (sbml)
- Result directory
An extension of seed inference for Target has been added, searching for set of seeds and transfers based on Target mode:
- Community mode.
Mandatory inputs:
- Community file ; text file containing name of sbml file (without extension)
- SBML directory: diretory containting all possible networks
- Result directory
There are also multiple additional features:
- Network: allows drawing the network from the ASP definition and checking the network ASP decription by comparing with the Cobrapy description, or write into an SBML file the corrected network (exchanging products and reactants or deleted reaction having all boundaries to 0)
- Flux: Allows checking the flux for individual network with Cobrapy from Seed2LP result files, or any file having the same json structure than Seed2LP.
- Flux community: Allows checking the flux for community with Cobrapy from Seed2LP result files, or any file having the same json structure than Seed2LP.
- Scope: Perform scopes from seeds for individual network from Seed2LP result files, or any file having the same json structure than Seed2LP.
The notebook directory of this repo contains scripts that reproduce the results presented in associated papers.
If you use Seed2LP in your work, please cite:
-
Ghassemi Nedjad C. et al.
Seed2LP: seed inference in metabolic networks for reverse ecology applications.
Bioinformatics, 2025.
DOI: https://doi.org/10.1093/bioinformatics/btaf140
HAL
Individual dataset and code repository -
Ghassemi Nedjad C., Mendoza S. N., Frioux C. and Paulevé L.
Seed inference in interacting microbial communities using combinatorial optimization.
In CMSB 2025
DOI: http://doi.org/10.1007/978-3-032-01436-8\_20
HAL
Community dataset and code repository
@article{GhassemiNedjad.2025,
year = {2025},
title = {{Seed2LP: seed inference in metabolic networks for reverse ecology applications}},
author = {Ghassemi-Nedjad, Chabname and Bolteau, Mathieu and Bourneuf, Lucas and Paulevé, Loïc and Frioux, Clémence},
journal = {Bioinformatics},
doi = {10.1093/bioinformatics/btaf140},
pmid = {40163742},
}
@inproceedings{GhassemiNedjad.2026,
title = {Seed {Inference} in {Interacting} {Microbial} {Communities} {Using} {Combinatorial} {Optimization}},
isbn = {978-3-032-01436-8},
booktitle = {Computational {Methods} in {Systems} {Biology}},
publisher = {Springer Nature Switzerland},
author = {Ghassemi Nedjad, Chabname and Mendoza, Sebastián Nelson and Frioux, Clémence and Paulevé, Loïc},
editor = {Fages, François and Pérès, Sabine},
year = {2026},
pages = {370--387},
}From pypi
pip install seed2lp
From github
pip install git+https://github.com/bioasp/seed2lp
From repository source after git clone
pip install .
or
python setup.py install
Requires Python >= 3.11.
For below requirements, installing Seed2LP will install all needed packages if not already installed.
| name | version |
|---|---|
| clyngor | 0.3.18 |
| clingo-lpx | 1.3.0 |
| COBRApy | 0.26.0 |
| pyyaml | 6.0 |
| menetools | 3.4.0 |
| padmet | 5.0.1 |
The following examples uses a toy described on Seed2LP paper.
Get all solutions in all Target modes (Reasoning, Filter, Guess&Check, Guess&Check with Diversity, Hybrid lpx), in all optimisations (subset minimal and minimize)
seed2lp target networks/toys/SBML/toy_paper.SBML results/toys/
Get one solution in Full Network in reasoning and check flux
seed2lp full networks/toys/SBML/toy_paper.SBML results/toys/ -nbs 1 -so reasoning -cf
Get one solution in FBA only in subset minimal
seed2lp fba networks/toys/SBML/toy_paper.SBML results/toys/ -nbs 1 -m subsetmin
The first step of the tool is to read the network, analyse it to be able to perform a logic analyse of the Network, each reaction must be defined as follows:
For each reaction, multiple factors are verified and correction is done if needed such as swapping set of reactants and set of products if the boundaries of a reaction are negative or deleting reactions with null boundaries. A warning is outputted when changes are done.
📃 Output example:
WARNING :
- R_R2: Deleted.
Boundaries was: [0.0 ; 0.0]
- R_R7: Reactants and products switched.
Boundaries was: [-1000.0 ; 0.0]
For individual network, it is possible to run Seed2LP for all the 3 modes (Full network, Target and FBA by changing the command, and for each one to use specifics arguments.
For Community, ony a Target mode is performed, and arguments are availabled to choose between optimisation methods (optimise set of seeds and transfers)
This mode searches seeds with this goal: "activate"/"produce" all reaction/metabolites of the network.
💻 Command:
seed2lp full [network_file] [output_directory] [arguments]
There are also different seed inference submodes and optimisations
📜 Target
This mode searches seeds with this goal: producing a set of metabolites, or if a reaction is given, ensuring the production of the reactants needed for its activation.
💻 Command:
seed2lp target [network_file] [output_directory] [arguments]
There are also seed inference submodes and optimisations
📜 FBA
This mode randomly searches seeds by ensuring flux on objective reaction. It ensures the resulting model statisfies both logical and flux constraints using a hybrid ASP-LP solver.
💻 Command:
seed2lp fba [network_file] [output_directory] [arguments]
There are also optimisations
💻 Command:
seed2lp community [community_file_text] [sbml_directory] [result directory]
There are also seed inference submodes, uses only subset minimal optimisation and performs different algorithm of optimisations
Common for individual network and community
- Reasoning: Use ASP solving with clingo
- Classic: Use reasoning (logical, Boolean abstraction of metabolic activity) search only, without calculating flux into objective reaction.
Command:-so reasoning
- Classic: Use reasoning (logical, Boolean abstraction of metabolic activity) search only, without calculating flux into objective reaction.
- Hybrids with COBRApy: Use ASP solving with clingo to solve seeds and check solution with COBRApy
- Filter: Use reasoning search only, but for all results the flux is checked, and only the solutions having flux are returned.
Command:-so filter - Guess-check: Use reasoning search and directly interact with the solver during solving by adding new constraints. Flux is checked for every solution proposed by the solver and new constraints are derived out of it to guide the remaining solving process. All outputted solutions have flux natively.
Command:-so guess_check - Guess-check-diversity: Reuse Guess-check but also avoid a subset of current set of seeds for the next solving by adding new constraints on seeds
Command:-so guess_check_div
- Filter: Use reasoning search only, but for all results the flux is checked, and only the solutions having flux are returned.
Only for individual network
- Hybrid-lpx: Use ASP solving with clingo-lpx to solve seeds and check fluxes with ASP linear constraints:
- Hybrid: Ensure the resulting model statisfies both logical and flux constraints using a hybrid ASP-LP solver.
Command:-so hybrid
- Hybrid: Ensure the resulting model statisfies both logical and flux constraints using a hybrid ASP-LP solver.
It is possible to choose what kind of optimisation to perform on set of seeds.
The subset minimal (submin) mode finds a set of seeds which satisfies all the constraints, then from this set, it tries to eliminate seeds until it finds the minimal set that will satisfy the constraints.
This method of search does not guarantee minimality in terms of size of the set. But it can be a faster way to have set of seeds the most minimal possible from a set already validated.
📃 Example:
Considering all the followings sets of seeds below, that statisfy constraints for the objective, which of them are subset minimal and will be selected?
Sets of seeds is choosen ? reasons {A,B,C,D,E} no {A,B,C} is a set of seeds included into this set {A,B,C} yes There is no other set smaller included in this set {A,D,E,F} no {A,D,F} is a set of seeds included into this set {A,D,F} yes There is no other set smaller included in this set {A,C,E,F} yes There is no other set smaller included in this set
The minimize (min) set-mode finds set of seeds of minimal size which satisfies all the constraints.
This method of search ensures minimality. But it is computationally more demanding.
📃 Example:
Considering all the followings sets of seeds below, that statisfy constraints for the objective, which of them are of minimal size and will be selected?
Sets of seeds is choosen ? reasons {A,B,C,D,E} no There is a smaller set of size 3 existing {A,B,C} yes This a one of the smaller set {A,D,E,F} no There is a smaller set of size 3 existing {A,D,F} yes This a one of the smaller set {A,C,E,F} no There is a smaller set of size 3 existing
In community, the tool search for a set of seeds and transfers. The tool only perorm a subset minimal type of optimisations in community. Three algorithms have been implemented to optimise these sets :
- Global: Optimisation by performing a subset minimality on set of seeds+transfers. This method do not ensures a subset minimality of seeds sets.
Command:-cm global - Bisteps: Optimisation by performing a subset minimality on set of seeds first, and another step find and perform a subset minimialty of transfers sets (first transfers set found). This method ensures a subset minimalisty of set of seeds.
Command:-cm bisteps - Delete supersets: Optimisation by performing a subset minimality on set of seeds+transfers. For each solution, a ASP constraint is added to forbid superset of current seed sets for next resolution. Also, a post check is performed to detect and delete all previous solution found which is a superset of the current set of seeds. This method approximate a subset minimalisty of set of seeds, and ensures it when all solutions are found.
Command:-cm delsupset
For each mode, a result json file is created. This file will write all models for all submodes reasoning / hybrid and set-mode subset minimial / minimize.
If the check-flux option is used, -cf / --check-flux, a tsv file is created with all the fluxes calculated with Cobrapy, and if hybrid submode or fba mode is used, the LP flux found (calculated from ASP).
The results are also written in the terminal.
📜 Network
This feature can reconstruct a very basic picture of the network from the ASP conversion of the source network (in SBML format).
- It can create the picture with the reaction names, or without the reaction.
- It can also create all the reactions description / formula from ASP and Cobrapy and give a difference of both contents.
- It can write an SBML file derived from the SBML sources after correction of the network
- Deletion of reaction with boundaries [0,0]
- Exchanging set of reactants and products when boundaries negatives: ie [-1000, 0], [-100; -10], ...
💻 Command:
seed2lp network [network_file] [output_directory] [arguments]
📜 Flux
This feature allows the calculation, using Cobrapy library, of the flux of the objective function from a result file of seed2lp and save them. This can be a validation of the solutions provided by Seed2LP.
💻 Command:
seed2lp flux [network_file] [seed2lp_result_file]
📝 Notes:
It is possible to do the flux calculation using Cobrapy directly after the seed search by using the argument
-cf/--check-fluxon each mode. A tsv file is created with all the fluxes calculated with Cobrapy, and if hybrid submode or fba mode is used, the LP flux found (calculated from ASP).
Main 📜 options for search mode features
| option | short | default | description | search mode |
|---|---|---|---|---|
| --targets-file | -tf | optional | List of metabolites⭐ and/or an objective🔆 reaction as file |
Target |
| --objective | -o | optional | An objective🔆 reaction as command line |
Full Network and FBA |
| --seeds-file | -sf | optional | List of metabolites⭐ known to be seeds and will be in the initial set of seeds |
ALL |
| --possible-seeds-file | -psf | optional | List of metabolites⭐ among which the seed selection will be performed be in the set of seeds |
ALL |
| --forbidden-seeds-file | -fsf | optional | List of metabolites⭐ that can not be in the set of seeds |
ALL |
📝 Notes:
Target search mode :
- If no target file given, the targets will be the reactants of the objective reaction found in the SBML file. The flux calculation will be done on the objective objective reaction found in the SBML file.
- If only Metabolites given in the file: the targets will be these given metabolites. The flux calculation will be done on the objective objective reaction found in the SBML file.
- If only Reaction given in the file: the targets will be the reactants of the objective reaction found in the SBML file. The flux calculation will be done on this given reaction
- If both Metabolites and Reaction given in the file: the targets will be these given metabolites. The flux calculation will be done on this given reaction
Full network (hybrid submode) and FBA :
If no objective reaction given, the objective reaction will be the one found in the SBML file for flux calculation.
💬 Comments:
⭐ One metabolite by line, must be prefixed with "M_" to fit the ID of the SBML file.
🔆 One Objective reaction only, must be prefixed with "R_" to fit the ID of the SBML file.
| option | short | default | description | search mode |
|---|---|---|---|---|
| --mode | -m | subsetmin | run different set modes: minimize, subsetmin, all |
ALL |
| --solve | -so | reasoning | run different submodes: reasoning, filter, gues-check, hybrid, all |
Full Network and Target |
| option | short | default | description | search mode |
|---|---|---|---|---|
| --targets-as-seeds | -tas | False | If used, targets found are given, allowed to be in the set of seeds |
ALL |
| --topological-injection | -ti | False | If used, the exchange⭐ metabolite from source file are set as seeds directly |
ALL |
| --keep-import-reactions | -kir | False | If used, the exchange⭐ reactions are not deleted during the conversion to ASP |
ALL |
| --accumulation | -accu | False | If used, solutions with possible accumulating metabolites are allowed |
Full Network and Target |
💬 Comments:
⭐ An exchange reaction is defined as a reaction having one or multiple metabolites as reactants or products (while the other set must be empty), it represent import or export reactions, and can be reversible or not, written forwards or backwards:
- R ⟶ ∅
$\quad$ |$\quad$ R ⟷ ∅$\quad$ |$\quad$ R ⟵ ∅- ∅ ⟶ P
$\quad$ |$\quad$ ∅ ⟷ P$\quad$ |$\quad$ ∅ ⟵ PAn exchange metabolite will be the metabolite involved in the exchange reaction
| option | short | default | description | search mode |
|---|---|---|---|---|
| --check-flux | -cf | False | If used, the Cobrapy flux calculation from seeds will be executed and saved |
ALL |
| --maximize-flux | -max | False | If used, the flux calculation with ASP will be maximized |
ALL⭐ |
💬 Comments:
⭐ The option is used only in Hybrid mode for Full Network and Target search mode features.
The application has its own configuration file located here: seed2lp/config.yaml.
It is possible to use another configuration file by using the option -conf or --config-file.
But all these configurations are overwritten by the arguments if used. The config file is used as "the default configuration" of your app.
Seed2Lp needs a gcc version >= 7.
💻 Linux Commands:
Check your version:
gcc --versionInstall latest version (here v11):
sudo apt install gcc-11Link to the latest version (here v11):
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 20Check your version:
gcc --version

