INCATools / ontology-development-kit

Bootstrap an OBO Library ontology
http://incatools.github.io/ontology-development-kit/
BSD 3-Clause "New" or "Revised" License
219 stars 54 forks source link

Add a simple system for table diffing to ODK #843

Open matentzn opened 1 year ago

matentzn commented 1 year ago

Daff is an amazing framework for diffing tables: https://github.com/paulfitz/daff

pip install daff
daff --input-format tsv m1.sssom.tsv m2.ols.sssom.tsv > diff.tsv
daff render  --input-format tsv diff.tsv > diff.html   

Gives us a nicely rendered diff of the table, e.g

image

We can then use pandoc to generate GitHub flavoured markdown:

pandoc -s diff.html -o diff.md -t gfm 

While colouring cell content directly is not supported in GitHub flavoured markdown, we could inject emojis into the changed cells by using replace in the --> character:

This generates a table like

| @@ | subject_id | subject_label | predicate_id | object_id | mapping_justification | ... | |-----|-------------|--------------------------------------------------|---------------|--------------|----------------------------|-----| | ... | ... | ... | ... | ... | ... | ... | | | ZFA:0000012 | central nervous system | oio:hasDbXref | TAO:0000012 | semapv:UnspecifiedMatching | ... | | → | ZFA:0000013 | cranial ganglion | oio:hasDbXref | TAO:0000013:warning:→:warning: | semapv:UnspecifiedMatching | ... | | | ZFA:0000014 | dorsal aorta | oio:hasDbXref | TAO:0000014 | semapv:UnspecifiedMatching | ... | | ... | ... | ... | ... | ... | ... | ... | | | ZFA:0000019 | epiphysis | oio:hasDbXref | TAO:0000019 | semapv:UnspecifiedMatching | ... | | → | ZFA:0000020 | extraembryonic structure:warning:→:warning:extrembryonic structure | oio:hasDbXref | TAO:0000020 | semapv:UnspecifiedMatching | ... | | | ZFA:0000020 | extraembryonic structure | oio:hasDbXref | CARO:0000042 | semapv:UnspecifiedMatching | ... | | ... | ... | ... | ... | ... | ... | ... |