Skip to content

Commit de00d84

Browse files
authored
Merge pull request #5 from berkeleybop/ncit-clip
Pruned NCIT and OBI
2 parents 64bc71d + cbad8bc commit de00d84

File tree

10 files changed

+205
-68
lines changed

10 files changed

+205
-68
lines changed

docs/odk-workflows/RepoManagement.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ sh run.sh make update_repo
1111

1212
There are a large number of options that can be set to configure your ODK, but we will only discuss a few of them here.
1313

14+
NOTE for Windows users:
15+
16+
You may get a cryptic failure such as `Set Illegal Option -` if the update script located in `src/scripts/update_repo.sh`
17+
was saved using Windows Line endings. These need to change to unix line endings. In Notepad++, for example, you can
18+
click on Edit->EOL Conversion->Unix LF to change this.
19+
1420
## Managing imports
1521

1622
You can use the update repository worflow described on this page to perform the following operations to your imports:

docs/odk-workflows/components.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
# Adding components to an ODK repo
3+
4+
For details on what components are, please see component section of [repository file structure document](../odk-workflows/RepositoryFileStructure.md).
5+
6+
To add custom components to an ODK repo, please follow the following steps:
7+
8+
1) Locate your odk yaml file and open it with your favourite text editor (src/ontology/bero-odk.yaml)
9+
2) Search if there is already a component section to the yaml file, if not add it accordingly, adding the name of your component:
10+
11+
```
12+
components:
13+
products:
14+
- filename: your-component-name.owl
15+
```
16+
17+
3) Add the component to your catalog file (src/ontology/catalog-v001.xml)
18+
19+
```
20+
<uri name="http://purl.obolibrary.org/obo/bero/components/your-component-name.owl" uri="components/your-component-name.owl"/>
21+
```
22+
23+
4) Add the component to the edit file (src/ontology/bero-edit.obo)
24+
for .obo formats:
25+
26+
```
27+
import: http://purl.obolibrary.org/obo/bero/components/your-component-name.owl
28+
```
29+
30+
for .owl formats:
31+
32+
```
33+
Import(<http://purl.obolibrary.org/obo/bero/components/your-component-name.owl>)
34+
```
35+
36+
5) Refresh your repo by running `sh run.sh make update_repo` - this should create a new file in src/ontology/components.
37+
6) In your custom makefile (src/ontology/bero.Makefile) add a goal for your custom make file. In this example, the goal is a ROBOT template.
38+
39+
```
40+
$(COMPONENTSDIR)/your-component-name.owl: $(SRC) ../templates/your-component-template.tsv
41+
$(ROBOT) template --template ../templates/your-component-template.tsv \
42+
annotate --ontology-iri $(ONTBASE)/$@ --output $(COMPONENTSDIR)/your-component-name.owl
43+
```
44+
45+
(If using a ROBOT template, do not forget to add your template tsv in src/templates/)
46+
47+
7) Make the file by running `sh run.sh make components/your-component-name.owl`
48+

src/ontology/Makefile

Lines changed: 80 additions & 59 deletions
Large diffs are not rendered by default.

src/ontology/bero-odk.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ import_group:
2222
- id: omo
2323
- id: ecocore
2424
use_base: TRUE
25-
- id: obi
26-
make_base: TRUE
2725
- id: to
2826
make_base: TRUE
2927
- id: chebi
@@ -49,6 +47,9 @@ import_group:
4947
- id: mesh
5048
mirror_from: https://raw.githubusercontent.com/cmungall/mesh2owl/master/mesh-obo.obo
5149
module_type: custom
50+
- id: obi
51+
make_base: TRUE
52+
module_type: custom
5253

5354
robot_java_args: '-Xmx20G'
5455
robot_report:

src/ontology/bero.Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#changes here rather than in the main Makefile
55

66
MESH_TERMS_FILE = imports/mesh_terms.txt
7+
NCIT_TERMS_FILE = imports/ncit_terms.txt
78
MAIN_FILES_RELEASE = $(foreach n,$(MAIN_FILES), ../../$(n))
89

910
$(ONT)-full.owl: $(SRC) $(OTHER_SRC) $(IMPORT_FILES)
@@ -21,7 +22,10 @@ $(IMPORTDIR)/chebi_import.owl: $(MIRRORDIR)/chebi.owl $(IMPORTDIR)/chebi_terms_c
2122

2223

2324
$(IMPORTDIR)/ncit_import.owl: $(MIRRORDIR)/ncit.owl $(IMPORTDIR)/ncit_terms_combined.txt
24-
if [ $(IMP) = true ]; then $(ROBOT) remove -i $< \
25+
if [ $(IMP) = true ]; then $(ROBOT) extract -i $< \
26+
--method MIREOT \
27+
--branch-from-terms $(NCIT_TERMS_FILE) \
28+
remove \
2529
--term oboInOwl:hasExactSynonym \
2630
query --update ../sparql/preprocess-module.ru --update ../sparql/inject-subset-declaration.ru --update ../sparql/postprocess-module.ru \
2731
annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) --output $@.tmp.owl && mv $@.tmp.owl $@; fi
@@ -58,6 +62,15 @@ $(IMPORTDIR)/mesh_import.owl: $(MIRRORDIR)/mesh.owl
5862
query --update ../sparql/preprocess-module.ru --update ../sparql/inject-subset-declaration.ru --update ../sparql/postprocess-module.ru \
5963
annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) --output $@.tmp.owl && mv $@.tmp.owl $@; fi
6064

65+
$(IMPORTDIR)/obi_import.owl: $(MIRRORDIR)/obi.owl $(IMPORTDIR)/obi_terms_combined.txt
66+
if [ $(IMP) = true ]; then $(ROBOT) remove -i $< \
67+
--term OBI:0000011 \
68+
--select "self descendants" \
69+
--select "owl:deprecated='true'^^xsd:boolean" \
70+
--signature true \
71+
query --update ../sparql/preprocess-module.ru --update ../sparql/inject-subset-declaration.ru --update ../sparql/postprocess-module.ru \
72+
annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) --output $@.tmp.owl && mv $@.tmp.owl $@; fi
73+
6174
deploy_release:
6275
@test $(GHVERSION)
6376
ls -alt $(MAIN_FILES_RELEASE)
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
1-
1+
http://purl.obolibrary.org/obo/NCIT_C12913
2+
http://purl.obolibrary.org/obo/NCIT_C12219
3+
http://purl.obolibrary.org/obo/NCIT_C20633
4+
http://purl.obolibrary.org/obo/NCIT_C17828
5+
http://purl.obolibrary.org/obo/NCIT_C12218
6+
http://purl.obolibrary.org/obo/NCIT_C20047
7+
http://purl.obolibrary.org/obo/NCIT_C7057
8+
http://purl.obolibrary.org/obo/NCIT_C1908
9+
http://purl.obolibrary.org/obo/NCIT_C22188
10+
http://purl.obolibrary.org/obo/NCIT_C22187
11+
http://purl.obolibrary.org/obo/NCIT_C16612
12+
http://purl.obolibrary.org/obo/NCIT_C26548
13+
http://purl.obolibrary.org/obo/NCIT_C97325
14+
http://purl.obolibrary.org/obo/NCIT_C3910
15+
http://purl.obolibrary.org/obo/NCIT_C14250

src/ontology/imports/ncit_terms_combined.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
1-
21
http://purl.obolibrary.org/obo/BERO_0000000
2+
http://purl.obolibrary.org/obo/NCIT_C12218
3+
http://purl.obolibrary.org/obo/NCIT_C12219
4+
http://purl.obolibrary.org/obo/NCIT_C12913
5+
http://purl.obolibrary.org/obo/NCIT_C14250
6+
http://purl.obolibrary.org/obo/NCIT_C16612
7+
http://purl.obolibrary.org/obo/NCIT_C17828
8+
http://purl.obolibrary.org/obo/NCIT_C1908
9+
http://purl.obolibrary.org/obo/NCIT_C20047
10+
http://purl.obolibrary.org/obo/NCIT_C20633
11+
http://purl.obolibrary.org/obo/NCIT_C22187
12+
http://purl.obolibrary.org/obo/NCIT_C22188
13+
http://purl.obolibrary.org/obo/NCIT_C26548
14+
http://purl.obolibrary.org/obo/NCIT_C3910
15+
http://purl.obolibrary.org/obo/NCIT_C7057
16+
http://purl.obolibrary.org/obo/NCIT_C97325
317
http://purl.obolibrary.org/obo/bero.owl
418
http://purl.org/dc/terms/description
519
http://purl.org/dc/terms/license

src/ontology/run.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,22 @@
1111
# See README-editors.md for more details.
1212

1313
IMAGE=${IMAGE:-odkfull}
14-
14+
ODK_JAVA_OPTS=-Xmx20G
1515
ODK_DEBUG=${ODK_DEBUG:-no}
1616

1717
TIMECMD=
1818
if [ x$ODK_DEBUG = xyes ]; then
1919
# If you wish to change the format string, take care of using
2020
# non-breaking spaces (U+00A0) instead of normal spaces, to
2121
# prevent the shell from tokenizing the format string.
22+
echo "Running ${IMAGE} with ${ODK_JAVA_OPTS} of memory for ROBOT and Java-based pipeline steps."
2223
TIMECMD="/usr/bin/time -f ### DEBUG STATS ###\nElapsed time: %E\nPeak memory: %M kb"
2324
fi
2425

25-
docker run -v $PWD/../../:/work -w /work/src/ontology -e ROBOT_JAVA_ARGS='-Xmx20G' -e JAVA_OPTS='-Xmx20G' --rm -ti obolibrary/$IMAGE $TIMECMD "$@"
26+
docker run -v $PWD/../../:/work -w /work/src/ontology -e ROBOT_JAVA_ARGS="$ODK_JAVA_OPTS" -e JAVA_OPTS="$ODK_JAVA_OPTS" --rm -ti obolibrary/$IMAGE $TIMECMD "$@"
27+
28+
case "$@" in
29+
*update_repo*|*release*)
30+
echo "Please remember to update your ODK image from time to time: https://oboacademy.github.io/obook/howto/odk-update/."
31+
;;
32+
esac

src/scripts/update_repo.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ mkdir -p $ROOTDIR/.github
2828
mkdir -p $ROOTDIR/.github/workflows
2929
cp -n target/$OID/.github/workflows/qc.yml $ROOTDIR/.github/workflows/qc.yml
3030

31-
cp -n target/$OID/.github/workflows/docs.yml $ROOTDIR/.github/workflows/docs.yml
31+
32+
cp target/$OID/.github/workflows/docs.yml $ROOTDIR/.github/workflows/docs.yml
3233

3334

3435
cp -n target/$OID/mkdocs.yaml $ROOTDIR/
3536

3637
echo "WARNING: These files should be manually migrated: mkdocs.yaml, .gitignore, src/ontology/catalog.xml (if you added a new import or component)"
37-
echo "Update successfully completed."
38+
echo "WARNING: Your QC workflows have not been updated automatically. Please update the ODK version number(s) in .github/workflows/qc.yml."
39+
echo "Ontology repository update successfully completed."
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
PREFIX : <http://www.test.com/ns/test#>
2+
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
3+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
4+
5+
INSERT { ?y rdfs:subPropertyOf <http://www.geneontology.org/formats/oboInOwl#SynonymTypeProperty> . }
6+
7+
WHERE {
8+
?x <http://www.geneontology.org/formats/oboInOwl#hasSynonymType> ?y .
9+
FILTER(isIRI(?y))
10+
FILTER(regex(str(?y),"^(http://purl.obolibrary.org/obo/)") || regex(str(?y),"^(http://www.ebi.ac.uk/efo/)") || regex(str(?y),"^(https://w3id.org/biolink/)"))
11+
}

0 commit comments

Comments
 (0)