biolink / biolink-model-toolkit

A collection of useful python functions for looking up information and working with the Biolink Model
https://biolink.github.io/biolink-model-toolkit/
BSD 3-Clause "New" or "Revised" License
20 stars 10 forks source link

Need a toolkit method to return subclass(es) of biolink:Association, related to given subject and object categories plus a list of predicates #140

Closed RichardBruskiewich closed 11 months ago

RichardBruskiewich commented 12 months ago

I want to be able to look up candidate subclass(es) descendant of biolink:Association associated with a given subject and object categories (predicates too, if it helps? Plus any other desired metadata you think may help?), something like the following(?).

        associations: Optional[List[str]] = bmt.get_associations(
            subject_categories=subject_categories,  # Optional[List[str]] = None
            predicates=predicates,                  # Optional[List[str]] = None
            object_categories=object_categories,    # Optional[List[str]] = None
            # I don't know if there is any other metadata that could be
            # given to the method to further constrain the search
            formatted=True
        )

The "formatted" boolean flag is to ask the method to return CURIES not simple names (like other similar methods in the Toolkit)

Note that usually at least one of the subject_categories, predicates or object_categories are assumed necessary to resolve the specific association subclasses, but some of the matches can be 'wildcard' when some of those parameters have value None (not sure how open ended the search should be if all the values are None).

I guess when this is the case, the method defaults to the behaviour of bmt.get_all_associations().

The main use case here is to be able to use the specified biolink:Association subclass details in validation of a given edge, e.g. to access association-subclass-specific qualifier value range datatypes.

I'm assuming for the time being that the lists returned will be a specific as all the parameters constrain them to be, but perhaps a future iteration of this use case might pre-filter the subject and object categories list to only filter against the most specific node category, that is, (optionally, with a strict: bool flag?) not to filter using the parent (ancestral) categories?

RichardBruskiewich commented 11 months ago

Resolved by PR #141