Skip to content

Import terms from other ontologies

Raissa Meyer edited this page Jun 13, 2021 · 2 revisions

NOTE:

👻 This WIKI page is intended for ENVO editors or collaborators (who can create branches).

The docker section below will be generalised and separated later on.


Create an issue & corresponding branch for your work

Please create an issue on our issue tracker to let us know what you are doing, describing which terms you would like to import.

Then, create a branch named after that issue, e.g. issue-2012 for your import activities.

Add terms to the appropriate import file

ENVO's Makefile will do most of the import routine for you. All it needs to know is which terms you want. You can add the terms to files inside the src/envo/imports/ directory (all of the [ONTOLOGY]_terms.txt files). If the ontology you want is not already there, please create an issue and ask the editors to add it for you.

Make sure you are on your branch.

You can open the [ONTOLOGY]_terms.txt file you want to edit with any text editor you like. ⚠️ Make sure the line endings are unix line endings and not windows line endings. ⚠️

Then, you can add the term IRI and the (commented out) term label [TERM_IRI] # [TERM_LABEL] of the terms you would like to be included in the import to the files. The former is for the machine to know which terms to import, while the latter is for us humans to easily know which term the IRI is referring to.

Example:

http://purl.obolibrary.org/obo/PATO_0001935 # obtuse
http://purl.obolibrary.org/obo/PATO_0000025 # composition
http://purl.obolibrary.org/obo/PATO_0000140 # position
http://purl.obolibrary.org/obo/PATO_0001997 # decreased amount

Save the changes, then git add, commit, push to your branch on ENVO.


That's all you need to do to cue the terms for import in the import release.

⬇️ However, if you would like to use the terms you've imported in further work before said release, continue reading below. ⬇️


Create the import locally

We recommend using the ODK docker container for convenience.

Boot the docker container

With the docker container we can quickly set up an OBO-compliant ontology development environment using the INCATools Ontology Development Kit (ODK).

Pull the odkfull instance from dockerhub. You only need to do this when you need a new dockerfile or you need updates.

docker pull obolibrary/odkfull

Start the docker container

How much memory and CPUs you need depends on the size of the ontology you are importing. Usually 2 - 4 GB of RAM is more than enough, but if you are dealing with large ontologies, you might need more (e.g. 16 GB for CHEBI, 2 GB for PATO).

# Run a bash terminal in the container interactively with enough memory to handle your task.
docker run --cpus 5 --memory="12g" -it obolibrary/odkfull /bin/bash

## you will now be in your docker container with all ontology software ready at hand

## the following commands will run in the docker container

Clone and work on the ontology inside your docker container

# clone github envo repo to docker and enter the specified directory
git clone https://github.com/EnvironmentOntology/envo.git && cd envo/src/envo/

# MAKE SURE YOU'RE ON THE BRANCH YOU WANT TO BE ON - You'll be on master by default.
git checkout --track origin/[BRANCH_NAME] 
git log # to check if commit history is according to branch you're on

# set credentials to the ones you use for github
git config --global user.email "[EMAIL_YOU_USE_FOR_YOUR_GITHUB_ACCOUNT]" && git config --global user.name "[GITHUB_USER_NAME]"

# safe the credential for 10 hours
git config credential.helper cache 86400
# Make the import file, now including the recently added terms
make imports/[ONTOLOGY]_import.owl

# check if import worked 
grep [TERM_ID] imports/[ONTOLOGY]_import.owl

Push the updated import file to ENVO

What you have done above only really happened in your docker container. To make sure the changes will show up on your ENVO branch, git add, commit, push the changes.

Now, pull that branch to your local machine (outside of the docker container) and check in Protégé that everything looks okay: You should see the new terms inside the envo-edit.owl file.

Once you have confirmed that the import was successful, exit the docker container (type exit to leave docker) and start a pull request.

🏆