sssom-py icon indicating copy to clipboard operation
sssom-py copied to clipboard

New method: flip

Open matentzn opened this issue 3 years ago • 2 comments

@kevinscharper noted in https://github.com/monarch-initiative/monarch-ingest/issues/326 that if you are not careful and "blindly apply" a mapping file to a dataset, you may end up applying it the wrong way. For example, Mondo SSSOM mappings have Mondo IDs in as subject_id and external ID's such as OMIM as object_ids.

I propose the development of a flip method that allows to swap subject and object. This is not just about "flipping IDs", you have to

  • make sure that all subject and object specific fields are flipped accordingly, and
  • skos:broadMatch gets flipped to skos:narrowMatch etc.

This method could be useful, I think, because it allows us to centralise the logic by which we permit flipping. For example, we can simply ignore cases where flipping would be clearly wrong, or the "inverse" properties are not known.

matentzn avatar Sep 21 '22 10:09 matentzn

Yes, flip and also normalizing to a canonical subject or object Id space

cmungall avatar Sep 21 '22 14:09 cmungall

@hrshdhgd from a priority perspective this comes after oak-synonimizer and https://github.com/monarch-initiative/mondo-ingest/issues/78.

matentzn avatar Sep 22 '22 11:09 matentzn

I second this proposal and was actually about to open a ticket to request such a feature.

Being able to automatically “flip” a mapping set would be helpful for the Uberon/CL-to-taxon-specific-ontology mappings, if we plan (as was the idea) to allow for them to be managed either on the Uberon/CL side or on the taxon-specific side, because we might then have to deal with mapping sets that are in a different “direction” (Uberon-maintained mappings would likely be using Uberon terms as subjects and the foreign terms as objects, whereas externally maintained mappings would likely be the other way round).

gouttegd avatar Feb 22 '23 11:02 gouttegd

Its in the high priority issues and will be addressed before end of March I think

matentzn avatar Feb 22 '23 11:02 matentzn

Do we agree on how the semapv:crossSpecies*Match predicates should be inverted?

For me, it should be:

  • A semapv:crossSpeciesExactMatch B -> B semapv:crossSpeciesExactMatch A
  • A semapv:crossSpeciesNarrowMatch B -> B semapv:crossSpeciesBroadMatch A
  • A semapv:crossSpeciesBroadMatch B -> B semapv:crossSpeciesNarrowMatch A
  • A semapv:crossSpeciesCloseMatch B -> cannot invert, drop

Makes sense?

gouttegd avatar Feb 22 '23 11:02 gouttegd

We have a draft document for this here: https://mapping-commons.github.io/sssom/chaining_rules/

Feel free to review and give feedback!

matentzn avatar Feb 22 '23 12:02 matentzn

Proposal to add rules for these predicates: https://github.com/mapping-commons/sssom/pull/261

gouttegd avatar Feb 22 '23 13:02 gouttegd