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 has_direct_output slot to Activity class #11

Merged
merged 7 commits into from
Sep 16, 2024

Conversation

pkalita-lbl
Copy link
Contributor

@pkalita-lbl pkalita-lbl commented Aug 30, 2024

Fixes #8

Summary

These changes bring the input and output slots on the Activity class more inline with the ShEx schema. In particular:

  • Remove the existing has_direct_input slot
  • Add has_input and has_output slots which are multivalued
  • Add has_primary_input and has_primary_output slots which are single-valued

Details

  • The range of all four of the new slots is MoleculeAssociation, which was previously used as the range of the has_direct_input slot.
  • The MinervaWrapper.minerva_object_to_model method has been updated so that it populates the has_input, has_output, has_primary_input, and has_primary_output slots based on facts with the RO:0002233 (has input), RO:0002234 (has output), RO:0004009 (has primary input), and RO:0004008 (has primary output) properties, respectively.
  • The MinervaWrapper.minerva_object_to_model method has been updated to emit warnings when the values of single-valued slots part_of, occurs_in, has_primary_input, or has_primary_output are overwritten. This is purely informative for now. The warnings may help us suss out areas where the modeling needs to be updated.
  • A note about exclude_unset vs exclude_defaults in src/gocam/cli.py. I was seeing an issue where has_input and has_output were not appearing the YAML serialization produced by the gocam fetch command. The reason was that in the the LinkML-generated Pydantic model, multivalued slots have a default value of an empty list. The code in MinervaWrapper appended to those empty lists. As far as exclude_unset is concerned, mutating that default value means it is still "unset" (i.e. still equal by identity to the default). This didn't happen for the causal_associations slot because of a bit of code (now removed) that swapped out the default empty list for a new empty list. That's unnecessary, in general, but it did have the effect of satisfying exclude_unset. Since exclude_default does a compare-by-value with the default, it notices that the default value was modified in place and includes it in the output.

Copy link

github-actions bot commented Aug 30, 2024

PR Preview Action v1.4.7
🚀 Deployed preview to https://geneontology.github.io/gocam-py/pr-preview/pr-11/
on branch gh-pages at 2024-09-13 22:33 UTC

@pkalita-lbl
Copy link
Contributor Author

After I opened this PR I did an exploration of running a lot more Minerva data through minerva_object_to_model and I'm seeing a fair number of these warnings about overwriting has_direct_input or has_direct_output. So empirically it would seem that maybe the choice of having those slots be single-valued need a second look.

@pkalita-lbl pkalita-lbl marked this pull request as draft September 12, 2024 16:48
@pkalita-lbl pkalita-lbl marked this pull request as ready for review September 13, 2024 23:10
@pkalita-lbl
Copy link
Contributor Author

@cmungall I think this is now ready for review based on our discussion earlier this week.

@pkalita-lbl pkalita-lbl merged commit e29440e into main Sep 16, 2024
3 checks passed
@pkalita-lbl pkalita-lbl deleted the issue-8-activity-input-output branch September 16, 2024 16:17
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.

Add has_direct_output to Activity class
2 participants