Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #3
These changes add a new package (
gocam.translation.cx2
) with one main function (model_to_cx2
) responsible for converting a GO-CAMModel
instance to CX2 format. This functionality is also exposed through a newconvert
CLI subcommand. The CLI also has some very basic functionality for uploading to NDEx.Details
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 insrc/gocam/translation/cx2/style.py
. The edge style mappings are designed to be aligned with the GO-CAM visualization widget.convert
subcommand is added to the CLI insrc/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):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