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

Add CX2 conversion functionality #5

Merged
merged 8 commits into from
Aug 8, 2024
Merged

Conversation

pkalita-lbl
Copy link
Contributor

Fixes #3

These changes add a new package (gocam.translation.cx2) with one main function (model_to_cx2) responsible for converting a GO-CAM Model instance to CX2 format. This functionality is also exposed through a new convert CLI subcommand. The CLI also has some very basic functionality for uploading to NDEx.

Details

  • The new dependency on the ndex2 package is used to facilitate both CX2 generation and interacting with the NDEx API.
  • src/gocam/translation/cx2/main.py is the crux of the conversion logic. Some style-related constants are defined in src/gocam/translation/cx2/style.py. The edge style mappings are designed to be aligned with the GO-CAM visualization widget.
  • A new convert subcommand is added to the CLI in src/gocam/cli.py. For now the only supported output format is CX2, but I assume we will have more in the future. If not, we could consider having this be a dedicated CX2 subcommand.

Examples

Using the CLI to convert an example Model file to CX2 (printed to stdout):

gocam convert --output-format cx2 src/data/examples/Model-663d668500002178.yaml 

Using the CLI to fetch a GO-CAM model and then convert it to CX2:

gocam fetch 663d668500002178 | gocam convert --input-format yaml --output-format cx2

@pkalita-lbl pkalita-lbl requested a review from cmungall August 1, 2024 22:58
Copy link

github-actions bot commented Aug 1, 2024

PR Preview Action v1.4.7
🚀 Deployed preview to https://geneontology.github.io/gocam-py/pr-preview/pr-5/
on branch gh-pages at 2024-08-08 00:00 UTC

@pkalita-lbl pkalita-lbl merged commit e4258b4 into main Aug 8, 2024
3 checks passed
@pkalita-lbl pkalita-lbl deleted the issue-3-convert-to-cx2 branch September 19, 2024 20:22
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

Successfully merging this pull request may close these issues.

Convert GO-CAM JSON to CX JSON (for NDEx consumption)
2 participants