Skip to content

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

@KeithKelleher

Description

@KeithKelleher

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions