Giter Site home page Giter Site logo

predator's Introduction

Predator

Seed extraction in metabolic networks.

installation

pip install predator

Solving modes

Complete scope

Activating all metabolites. This is the default mode, if no targets are provided.

Examples:

python -m predator data.sbml
python -m predator data.sbml --visualize data.png --export data.lp --no-topological-injection

Target scope

This is an optimized solving mode, used if targets are provided, using --targets/-t or --targets-file/-tf.

The optimization rely on the use of Strongly Connected Components.

Examples:

python -m predator data.sbml -t protein_1
python -m predator data.sbml -t protein_1 protein_2 --forbidden-seeds protein_3 --targets-are-forbidden --start-seeds protein_42

Pareto front exploration

Using asprin, it enumerates the pareto front solutions over the following constraints:

  • minimization of seeds
  • maximization of targets
  • minimization of targets that are also seeds (if flag --targets-are-forbidden/-taf is given)

If --greedy flag is given, the whole graph will be treated in one step. It is not expected to scale over large graphs, but may provide slightly different answers.

Example:

python -m predator data.sbml -t protein_1 --pareto

TODO

  • union et intersection des solutions
    • implem pour la recherche search_seeds_activate_all
    • implem pour la recherche search_seeds_activate_targets_iterative
    • implem pour la recherche search_seeds_activate_targets_greedy
    • implem pour la recherche search_pareto_front
    • implem pour la recherche search_pareto_targets_iterative

release cycle

Releases made with zest.releaser:

pip install zest.releaser[recommended]  # install the manager
fullrelease  # make a new release

predator's People

Contributors

aluriak avatar cfrioux avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

predator's Issues

viz of DAG not implemented if no targets

When using the -vdoption without targets, the program runs normally and says the image was created although this is not the case:

python -m predator networks/ns_2.sbml -vd viz/ns_2_dag.png

gives the following output:

DEBUG args = Namespace(export=None, forbidden_seeds=[], forbidden_seeds_file=None, greedy=False, infile='networks/ns_2.sbml', info=False, intersection=False, no_prerun=False, no_topological_injection=False, pareto=False, pareto_full=False, scc_with_asp=False, seeds=[], seeds_file=None, semantic_injection=False, targets=[], targets_are_forbidden=False, targets_file=None, union=False, verbose=False, visualize=None, visualize_dag='viz/ns_2_dag.png', visualize_without_reactions=None)
Solution 1:
h, o, a, g, e, k, m

Solution 2:
h, n, a, g, e, k, m

Solution 3:
h, a, g, e, k, m, b

end of solutions.
Rendering…
-> DAG of SCC rendered in viz/ns_2_dag.png
-> Ok!
TIME DATA EXTRACTION: 0.0s
TIME     PRE-RUN    : 0.334s
TIME SCCs EXTRACTION: unperformed
TIME   SEED SEARCH  : 2.035s
TIME    RENDERING   : 0.0s
TIME      TOTAL     : 2.036s

The reason is that without targets, the DAG is not generated. Since args.visualize_dag is replaced by the dag only if targets exist, the code exits normally as if the graph was exported and the output says so.

Catch error when clingo is not in $PATH

So far the error is the following:

FileNotFoundError: [Errno 2] No such file or directory: 'clingo': 'clingo'

Ideally the program should exit smoothly rather than crash.

error when adding target to the command

The following command works as expected

python -m predator networks/ns_2.sbml

However, when adding the targets argument:

python -m predator networks/ns_2.sbml --targets d

I get the following error (on mac OSX and Ubuntu 18.04, python 3.7.6)

DEBUG args = Namespace(export=None, forbidden_seeds=[], forbidden_seeds_file=None, greedy=False, infile='networks/ns_2.sbml', info=False, intersection=False, no_prerun=False, no_topological_injection=False, pareto=False, pareto_full=False, scc_with_asp=False, seeds=[], seeds_file=None, semantic_injection=False, targets=['d'], targets_are_forbidden=False, targets_file=None, union=False, verbose=False, visualize=None, visualize_dag=None, visualize_without_reactions=None)
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/cfrioux/wd/code/predator/predator/__main__.py", line 160, in <module>
    for idx, seeds in enumerate(predator.search_seeds(graph, seeds, forbidden_seeds, targets, enum_mode=enum_mode, graph_filename=graph_filename, explore_pareto=args.pareto, pareto_no_target_as_seeds=args.pareto_full, greedy=args.greedy, **supp_args), start=1):
  File "/Users/cfrioux/wd/code/predator/predator/predator.py", line 97, in search_seeds
    yield from func(graph_data, frozenset(start_seeds), frozenset(forbidden_seeds), frozenset(targets), graph_filename, enum_mode, **kwargs)
  File "/Users/cfrioux/wd/code/predator/predator/predator.py", line 324, in search_seeds_activate_targets_iterative
    for new_seeds, new_targets, new_fullfill in compute_hypothesis_from_scc(terminal, scc_data, sccs, rev_scc_dag, enum_mode, verbose=verbose):
  File "/Users/cfrioux/wd/code/predator/predator/predator.py", line 453, in _compute_hypothesis_from_scc__minimization
    yield from __compute_hypothesis_from_scc(models, scc_name, scc_encoding, sccs, rev_scc_dag, enum_mode, verbose)
  File "/Users/cfrioux/wd/code/predator/predator/predator.py", line 405, in __compute_hypothesis_from_scc
    _print('                NB MODEL:', len(models))
TypeError: object of type 'generator' has no len()

The --seeds aoption is working

pareto does not work if targets are provided

The -p and -pf options gives nothing if used with targets (-t option):

python -m predator networks/ns_2.sbml -pf -t A
DEBUG args = Namespace(export=None, forbidden_seeds=[], forbidden_seeds_file=None, greedy=False, infile='networks/ns_2.sbml', info=False, intersection=False, no_prerun=False, no_topological_injection=False, pareto=False, pareto_full=True, scc_with_asp=False, seeds=[], seeds_file=None, semantic_injection=False, targets=['A'], targets_are_forbidden=False, targets_file=None, union=False, verbose=False, visualize=None, visualize_dag=None, visualize_without_reactions=None)
end of solutions.
Rendering…
-> Ok!
TIME DATA EXTRACTION: 0.001s
TIME     PRE-RUN    : 0.315s
TIME SCCs EXTRACTION: unperformed
TIME   SEED SEARCH  : 0.001s
TIME    RENDERING   : 0.0s
TIME      TOTAL     : 0.002s

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.