Skip to content

Retrieve MeSH mappings from EFO ID, via oxo and OLS. Mappings are candidate equivalent terms.

Notifications You must be signed in to change notification settings

warrenread/efo-mesh-mapping

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EFO->MeSH mappings

EFO to MeSH term mapping scripts from SPOT at EBI.

Overview

This project is an attempt to bring together EFO terms stored in the GWAS catalogue, with equivalent terms from MeSH, and potentially other external ontologies too. At its core is a small set of Python scripts using the OxO and OLS APIs to find (respectively) X-refs, and lexical similarity between term labels. Ultimately we want to enhance the curation tools, offering curators the ability to select appropriate MeSH terms with which to enrich entries in the GWAS catalogue.

Installation

The initial release of this software comprises 5 files: 4 Python scripts (including two — grab_gwas.py and spotilities.py — serving as modules) and an additional configuration file. The full file list is:

grab_gwas.py
spotilities.py
ols_blaster.py
oxonator2.py
oxoconfig.ini

Create a new directory, set default to it, and check out all files in this project. You will need Python 3 with virtualenv: read the Dependencies section below for full details.

Function

The two principal scripts to run are ols_blaster.py and oxonator2.py. The former returns MeSH hits from the OLS API, based on text matching to EFO label; the latter returns Mesh hits from the OxO API, based on xrefs. Output in both cases is in tsv format.

Dependencies

The scripts are written in Python 3, and expect to be invoked with the appropriate command—e.g.:

$ python3 scriptname.py

… although they are all configured with the appropriate shebangs, so you can of course simply enable execution rights on the scripts and invoke them with:

$ ./scriptname.py

There are further dependencies on a couple of packages, which do not come as default with a standard Python 3 installation. Therefore, you need to add the following packages:

requests
configparser

You may—and probably should—do this within a virtual environment; the virtualenv package itself may come pre-installed with Python 3, but you can check for all such pre-installed system-wide packages using the default package manager (pip3) by entering:

$ pip3 list

If virtualenv is absent, install it (system-wide) using the following command:

$ sudo pip3 install virtualenv

You will then be able to set up local, virtual spaces in which any add-on packages to Python can be retained at stable version nubers which are known to work with the existing code base. If, for example, you want to create a virtual space called ”myvirtenv”, enter (from the directory in which you have chosen to store your virtual environments):

$ virtualenv myvirtenv

This will create a ./myvirtenv subdirectory beneath the default directory where the command was executed; the subdirectory itself contains furhter subdirectories, including ./myvirtenv/bin, wherein lies a script called ”activate”; to activate the virtual environment therefore, you need to enter:

$ ./myvirtenv/bin/activate

Thereafter, when you run any Python 3 script, or type any pip3 command, it will execute in the context of your active virtual environment, not the system-wide (default) Python 3 environment. This applies to the installation of Python 3 packages too, which are now installed locally (within the virtual environment)—including the pip3 package. (There is no point in installing virtualenv itself within a virtual environment.) Of course, this means that a single user can implement multiple virtual environments! To deactivate a current Python 3 virtual environment and return to the system default packages, simply type:

$ deactivate

In regard to EFO->MeSH mappings, you will probably want to run them within a virtual environment, where you can install the necessary dependencies without affecting any other code. For the present, once you have activated your virtual environment, you can simply install the requisite packages thus:

$ pip3 install requests
$ pip3 install configparser

Within the same environment, you are now ready to run the scripts themselves. oxonator2.py depends on grab_gwas.py, spotilities.py and oxoconfig.ini, while ols_blaster.py currently depends only on the two modules, but not the ini file. All need to be in the current default direcory; ensure that you have set execute privs on all 4 .py scripts by entering:

$ chmod a+x *.py

Usage

With all dependencies in place, invoke the aforementioned two main scripts respectively with:

$ ./oxonator2.py oxoconfig.ini
$ ./ols_blaster.py

About

Retrieve MeSH mappings from EFO ID, via oxo and OLS. Mappings are candidate equivalent terms.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages