biolink / biolink-model

Schema and generated objects for biolink data model and upper ontology
https://biolink.github.io/biolink-model/
Other
169 stars 71 forks source link

It seems impossible to instantiate GeneToGoTermAssociation objects using the python classes #1507

Open KeithKelleher opened 1 month ago

KeithKelleher commented 1 month ago

Describe the bug I'm using the python classes for the biolink model, currently trying to create a GeneToGoTermAssociation object. Whatever I pass as the subject of the association, it gets cast to a "GeneId" and GeneId can't pass through the __post_init__ validation for FunctionalAssociation. It fails with this error:

TypeError: biolink_model.datamodel.model.MacromolecularMachineMixin() argument after ** must be a mapping, not GeneId

To Reproduce Here's a minimal reproduction:

from biolink_model.datamodel import GeneToGoTermAssociation, Gene

gene = Gene(id="NCBIGene:10513", category="biolink:Gene") print(gene)

ggta = GeneToGoTermAssociation(id=2, subject=gene, predicate="biolink:associated_with", object="GO:0005875")

Expected behavior It should be possible to create those objects using the python classes

What working group (or team) did this request originate from? NCATS Informatics