Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement translation from GrFN3 to CAG #257

Open
pauldhein opened this issue Sep 24, 2021 · 0 comments
Open

Implement translation from GrFN3 to CAG #257

pauldhein opened this issue Sep 24, 2021 · 0 comments
Assignees

Comments

@pauldhein
Copy link
Contributor

Overview

Now that we are switching over to GrFN3 we need to revamp the grfn2cag translation pipeline. @aswinchester this would be a great task for you to get integrated into the core of the AutoMATES repository. Please reach out to @dpdicken and @titomeister for assistance as you accomplish this task. They will be more than happy to pair-program with you and help you along the way!

Everyone

  • This issue pairs with issue Finish GrFN3 test suite generation #256 . This issue will need to be completed in order for that issue to be complete.
  • All tasks for this issue should be carried out on the grfn2gromet branch or a child branch from that branch. DO NOT attempt to do this on master because the setup tests and objects only exist on the grfn2gromet branch.

Useful pointers

  • automates/model_assembly/networks.py: this file contains the class definitions for the GroundedFunctionNetwork and the CausalAnalysisGraph classes. This file should be the one location where implementations need to be made.
  • scripts/model_assembly/py2grfn.py: this is a script that will run our whole pipeline to translate Python source code into a GrFN/CAG. Read the flag definitions carefully. You will need to supply the correct flags to actually run CAG generation and to test whether the CAG is equivalent to one saved/loaded from JSON.
  • tests/data/program_analysis/language_tests/python/<idiom-name>/<test-name>/<test-name>.py: this is a collection of Python code examples that can be used to see if we can generate CAGs for certain programming idioms that we may see in scientific model source code.
  • tests/model_assembly/test_grfn2cag.py: this is a file where tests exist that will test whether the methods that will be defined as part of this issue are working or not. Use this file to determine if your implementations are successful or not after you can successfully run the py2grfn.py script.
  • tests/conftest.py: a helper file for the tests mentioned above that defines pytest fixtures used during the testing process.

Tasks

  • Implement the methods defined in both the CausalAnalysisGraph and CAGContainer classes marked with TODO: @Alex ....
    • CausalAnalysisGraph.from_GrFN(): this method creates a CausalAnalysisGraph from a GroundedFunctionNetwork
    • CausalAnalysisGraph.from_json_file(): this method creates a CausalAnalysisGraph from a CAG.json file
    • CAGContainer.from_func_node(): this method creates a CAGContainer from a GrFN BaseConFuncNode. Containers in a CAG play the role of determining variable node subgraph membership based upon the functions found in the GrFN parent. Ask @cl4yton if you need guidance on what a CAGContainer should look like.
    • CAGContainer.from_dict(): this method creates a CAGContainer from a dictionary of data. This dict is derived from a re-loaded CAG.json.
  • Add a to_igraph_gml() method in the CausalAnalysisGraph class that allows the CAG to be converted to an igraph object that can be used with the identifiability algorithm. An example of this for the old CAG class is in the same file (commented out and below the new class definition).

Helpful tips

  • When making the from_json_file and from_dict methods take a look at the already implemented to_json and to_dict methods because those reveal what information is expected to be present in the CAG.json.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants