Expanding the Orthologous Matrix (OMA) programmatic interfaces: REST API and the OmaDB packages for R and Python

The Orthologous Matrix (OMA) is a well-established resource to identify orthologs among many genomes. Here, we present two recent additions to its programmatic interface, namely a REST API, and user-friendly R and Python packages called OmaDB. These should further facilitate the incorporation of OMA data into computational scripts and pipelines. The REST API can be freely accessed at https://omabrowser.org/api. The R OmaDB package is available as part of Bioconductor at http://bioconductor.org/packages/OmaDB/, and the omadb Python package is available from the Python Package Index (PyPI) at https://pypi.org/project/omadb/.


Introduction
Orthologs are pairs of protein coding genes that have common ancestry and have diverged due to speciation events 1 . The detection of orthologs is of fundamental importance in many fields in biology, such as comparative genomics, as it allows us to propagate existing biological knowledge to ever growing newly sequenced data 2,3 .
The Orthologous Matrix (OMA) is a method and resource for the inference of orthologs among complete genomes 4 . The OMA database (https://omabrowser.org) features broad scope and size with currently over 2,100 species from all three domains of life.
The OMA browser has supported multiple ways of exporting the underlying data from its beginning. Users can download data either via bulk archives or interactively through the browser-using where possible standard file formats, such as FASTA, OrthoXML 5 , or PhyloXML 6 . For programmatic access, early OMA database releases offered an Application Programming Interface (API) in the form of the Simple Object Access Protocol (SOAP). However, the complexity and limited adoption of SOAP has prompted us to recently switch to the simpler, faster, and more widely used Representational State Transfer (REST) protocol for the OMA API 4 . Here, we provide a description of this new OMA REST API.
Furthermore, the R environment is widely used in bioinformatics due to its flexibility as a high-level scripting language, statistical capabilities, and numerous bioinformatics libraries. In particular, the Bioconductor open source framework contains over 2,000 packages to facilitate either access to or manipulation of biological data 7 . This motivated us to develop the OmaDB Bioconductor package which provides a more idiomatic and user-friendly access to OMA data in R implemented on top of the REST API.
Finally, to also enable Python users to easily interact with the database, we have developed a similar package in that language, compliant with the conventions and with support of typical complementary Python packages as outlined below.

Methods
We start by describing the OMA REST API, before moving on to detail the OmaDB Bioconductor package, and finally outline the omadb Python package.

OMA REST API
The REST framework is an API architectural style that is based on URLs and HTTP protocol methods. It was designed to be stateless and thus is context independent. That is, it does not save data internally between the HTTP requests which minimises server-side application state, thus easing parallelism. The combination of the HTTP and JSON data formats makes it particularly suitable for web applications and easily supported by most programming languages.
Since the backend of the OMA browser is almost fully based on Python and its frontend is supported by the Django web framework 8 , we have opted to use the Django Rest Framework (DRF) to implement a REST API in our latest release 4 . Most API calls require querying the OMA database, stored in HDF5 9 , using a custom Python library ("pyoma"). The query results are serialised in the format requested by the user -typically JSON.
Most data available through the OMA browser is now also accessible via the API, with the exception of the local synteny data. This includes individual genes and their attributes such as protein or cDNA sequences, cross-references, pairwise orthologs, hierarchical orthologous groups 10 , as well as species trees and the corresponding taxonomy. The API documentation as well as the interactive interface can be found at https://omabrowser.org/api/docs ( Figure 1).

Amendments from Version 1
Version 2 of our manuscript addresses the points from the peer-reviewers, whom we thank for their constructive feedback.
We clarified the installation procedure for the package, which is currently in the development version of Bioconductor, due to be released in Spring 2019. Furthermore, we corrected typos, improved the documentation, and clarified potential differences in the output of the code examples that can arise due to updates of the OMA database.

REVISED
OmaDB Bioconductor package To facilitate simplified access to the API and downstream analyses in the R environment, we have also developed an API wrapper package in R, now available in Bioconductor 7 (http://bioconductor.org/packages/OmaDB/). This allowed for abstraction of the server interface, eliminating the need to know structure of the database or the URL endpoints to access the required data.
The package consists of a collection of functions that import OMA data into R objects, the type of which depends on the query supplied. Due to the volume of the data available, some selected object attributes are at first given as URL endpoints. However, these are automatically loaded upon accession. OmaDB also facilitates further downstream analyses with other Bioconductor packages, such as GO enrichment analysis with topGO 11 , sequence analysis with BioStrings 12 , phylogenetic analyses using ggtree 13 or gene locus analyses with the help of GenomicRanges 14 .
The open source code is hosted at https://github.com/DessimozLab/OmaDB/. In the results section we showcase usage of the latest version of the package (v2.0), which requires R version >= 3.6 and Bioconductor version >= 3.9. Note that as of the time of publication, this is in the Bioconductor development version. For details, see the Software Availability section.

Package Installation
install.packages("BiocManager") BiocManager::install("OmaDB") # Load the package library(OmaDB) omadb Python package For Python users, we provide an analogous package named omadb. Results are supplied to users as a hybrid attribute-dictionary object. As such, both attribute and key-based access is possible. Where the URL of a further API call is listed in a response, this has been designed to be automatically requested for the user.
For data that can be represented as a table, the pandas package 15 is supported. HOGs can be analysed or displayed using the pyham library 16 . Trees are retrievable as DendroPy 17 or ETE3 18 Tree objects. Gene Ontology enrichment analyses are possible through the use of the goatools package 19 . The open source code is hosted at https://github.com/DessimozLab/pyomadb/. The package requires Python >=3.6, as well as a stable internet connection. It is also available to download from PyPI, installable using pip.

Results
We provide six illustrative examples in R. The first shows a direct call to the REST API, while the other five showcase the OmaDB R package (version 2.0). These examples are also available as a Jupyter notebook 20 as part of the OmaDB R code repository. We have also provided analogous examples in Python, also in the form of a Jupyter notebook, included in its code repository-with the exception of Example 6, which uses a package only available in R.
Note that the results of the queries using the API and the packages may change as we continue to update the OMA database. The OMA database release of June 2018 was used to generate the examples below.
Example 1 -Simply accessing the API, in R, via URLs One way to access the API is to directly send a request using httr 21 in R. This approach requires the user to know the URL of the API endpoint, as well as the URL of the API function of interest. Some additional processing steps of the resultant response is usually needed. A simple example to retrieve information on the P53_RAT protein is provided below.
Here we first formulate our URL of interest and use it to send a GET request to the API. This gives us the response JSON object, which can then be parsed into an R list.

library(OmaDB)
The identified targets can be found in the seq_annotation$targets. As the length of this object attribute is 1, in this example the sequence mapping identified a single target sequence. From this object further information can be obtained as follows: Thus, our sequence is human lactotransferrin (also known as lactoferrin). Lactotransferrin is one of four subfamilies of transferrins in mammals 22 .
To investigate the evolutionary history of genes more precisely, we turn to Hierarchical Orthologous Groups (HOGs)-sets of genes which have descended from a single common ancestral gene within a taxonomic range of interest 10 . For an introduction to HOGs, we refer the interested reader to the following short video: https:// youtu.be/5p5x5gxzhZA.
By knowing the ID of the HOG to which our sequence belongs, we can obtain a list of all the HOG members (i.e. all genes in the HOG), as follows: Note that it is also possible to access information on a HOG using the getHOG() function. A HOG can be identified by its ID or the ID of one of its member proteins. Therefore the below will produce the same output.

hog <-getHOG(id = 'TRFL_HUMAN', members = TRUE, level = 'Mammalia')
We can easily retrieve the Gene Ontology (GO) terms 23 that are associated to each of the members using OmaDB.
go_annotations <-getProtein(hog$members$omaid, attribute = 'gene_ontology') The resultant list of GO terms per gene is in the "geneID2GO" format by default, which is used by the topGO 11 package.
To compare the function of lactotransferrins with their paralogous counterparts, we can retrieve a background set consisting of all members of the transferring HOG defined at the root of the eukaryotes bgHOG <-getHOG(id = 'TRFL_HUMAN', members = TRUE, level = 'Eukaryota') bgAnnnot <-getProtein(bgHOG$members$omaid, attribute = 'gene_ontology') We can now construct a topGO object using the getTopGO function as seen below. Note that the background set of terms is set by getTopGO to all terms appearing in the list of annotations. This may not be appropriate in all cases-the choice of background set requires careful consideration 24 . bgAnnnotFormatted = formatTopGO(bgAnnnot, format = 'geneID2GO') library(topGO) myGO <-getTopGO(annotations = bgAnnnotFormatted, format = 'geneID2GO', foregroundGenes = hog$members$entry_nr, ontology = 'BP') myRes <-runTest(myGO, algorithm = 'classic', statistic = 'fisher') print(GenTable(myGO, myRes)) As the output in Table 1 indicates, several enriched terms in the mammalian lactotransferrin are related to bone formation, consistent with previous reports in the literature (e.g. 25). So is the role of lactotransferrin in antimicrobial activity (e.g. 26). Example 3 -Taxonomic tree visualisation The taxonomic data obtained using the OmaDB package can easily be plugged into ggtree 13 for phylogenetic tree visualisation. First, the tree is obtained using the getTaxonomy() function. In this example, the tree is rooted at the Hominoidea taxonomic level. The default format of the object returned is newick.
tax <-getTaxonomy(root = 'Hominoidea') The resultant object can directly be used to build a phylogenetic tree using the ggtree package as below: The tree can be further annotated using species silhouettes from PhyloPic (http://phylopic.org/). This functionality is already enabled within the ggtree package and just requires obtaining the relevant image codes. The workflow to produce Figure 2 is below.
Example 5 -Annotating protein sequences not present in OMA Although the OMA database currently analyses over 2,100 genomes, many more have been sequenced, and the gap keeps on widening. It is nevertheless possible to use OMA to infer the function of custom protein sequences through a fast approximate search against all sequences in OMA 4 . Among the tissues in which lactotransferrin is expressed according to Bgee (Table 2), we note the bone marrow and the palpebral conjunctiva (the eyelid inner surface). This is consistent with the aforementioned involvement of lactotransferrin in bone formation and anti-microbial activity.
Further tutorials on the OmaDB package can be found in the accompanying vignettes:

Discussion and outlook
Orthology is used for various purposes, such as species tree inference, gene evolution dynamic, or protein function prediction. The retrieval of orthologs is thus typically just the starting point of a larger analysis. Therefore, this overhaul and expansion of the OMA programmatic interface will facilitate the incorporation of OMA data in such larger analyses Our R package will continue to be maintained in line with the biannual Bioconductor releases. Further work to improve the package includes improvement in performance. For example, the responses are currently fully loaded into an R object of choice which, depending on the response size, may create some time lag in the response. We will also continue to update the package and the API in sync with the OMA browser to incorporate new functionalities of OMA.
Likewise, we will also maintain and further develop the Python package. In particular, we will explore the possibility of further integration with the BioPython library 32 .
More generally, in OMA we will keep supporting the various ways of accessing the underlying data, including the interactive web browser and flat files in a variety of formats. The REST API is also complemented by a new SPARQL interface that enables highly specific queries, as well as federated queries over multiple resources 4 . However, the query language is more complex.
We very much welcome feedback and questions from the community. We also highly appreciate contributions to the code in the form of pull requests. Our preferred channel for support is the BioStar website 33 , where we monitor all posts with keyword "oma".

Software availability
Please note that this manuscript uses version 2.0 of the OmaDB R package, which is in the development version  In the Bioconductor package section, the authors explain that data is provided in 'R friendly objects, namely S3 objects and data frames'. I would suggest to rephrase this and only refer to objects, as S4 objects are also returned and the nature of the technical class system is probably not necessary in the frame of this document. Regarding the R package, I would suggest to add URL and BugReports fields in the packages DESCRIPTION file. This helps users find the GitHub repository and report issues. I also noted that in the 'getting started' vignette, it looks like some section a missing a space after the section markup. I have send a pull request fixing these and some other minor issue. Note that the html and R version of the vignette shouldn't be included in the package source.
In the python package section, the authors mention that this package is named 'omadb'. I also would argue that the packages have different names, as programming languages are case sensitive and suggest to drop the also to avoid any confusion. In the first sentence of the result section, authors should replace R library by R package, as they are referring to their package, not the location where the package is being installed (the library). In general, it would be very useful for the authors to describe the different outputs they have. I am not expecting the authors to provide full details of the REST API responses, but describing how the results match the text would be important. For example, in example 1, they only show how to produce the `response_content_list` response. Here, it would be useful to explain that this R list directly maps the REST json message, and point to the specific documentation entry point. Such an explanation motivates the example in the text and helps users, that aren't familiar with REST, to understand the relation between the server and the package. Similarly in example 2, the authors create the `seq_annotation` variable and mention that only one target sequence was identified. Here, it would be useful to show that length(seq_annotation$targets)` is equal to 1, to back their claim, to indicate how users can verify the number of targets, and motivate the use of the first list index in later code chunks.
Still in example 2, the authors query and extract the hog members. These data are however Still in example 2, the authors query and extract the hog members. These data are however already present in the first output of that example, under seq_annotation$targets[ [1]]$oma_hog_members`. It would be useful to explain why the authors send a second query to obtain that data and clarify whether `oma_hog_members` is always equivalent to calling `getHOG` and `getProtein`. When trying to reproduce the code, I first failed to run the code chunks calling `getProtein`. Later, the authors clarify the software requirements in more details. It would however be useful to briefly mention, early on in the Results section, what version was used for the examples. In example 5, I would suggest to update to new function name, as `getAnnotations` is expected to be deprecated in the next release, especially as the new version of the package is anyway required for the `getProtein` function.`> myAnnotations <-getAnnotation(mysterySeq) Warning message: 'getAnnotation' is deprecated. Use 'annotateSequence' instead. See help("Deprecated")``A nother example where an explanation of the output is important is example 5. The authors call myAnnotation <-getAnnotations(mysterySeq)` and then refer to 54 GO annotation results. In repeating their analysis, I obtain a data frame with 55 observations (see below). It is this unclear whether I have a different result, if one observation should be dropped, or if my output is completely wrong (was I even expecting a data frame?).`> dim(myAnnotations) [1] 55 13``I n general, given the nature of the package, i.e. that it accesses an online repository that is (or can be) updated regularly, results may change, this also explaining why I may have different results.

Is sufficient information provided to allow interpretation of the expected output datasets and any results generated using the tool? Partly
Are the conclusions about the tool and its performance adequately supported by the findings presented in the article? Yes No competing interests were disclosed.

Competing Interests:
No competing interests were disclosed. RESPONSE: As mentioned in the Discussion, the package currently lacks availability of the data on local synteny, mainly due to the complexity of the data representation in the API format. We aim to bridge this gap in the next release. We have now amended the Methods section to reflect the difference between OMA browser and the API more explicitly, as well as the discussion to reassure the users the API and OMA browser will be kept in sync with further OMA developments. Both R and Python packages use the same API and supply the same data.
I didn't see mention of the R and python packages on the OmaDB web page. This would be a useful addition for visitors. RESPONSE: We already had a link to the R package in the /api/docs, but we have now also included link directly from the "compute" menu.
In the Bioconductor package section, the authors explain that data is provided in 'R friendly objects, namely S3 objects and data frames'. I would suggest to rephrase this and only refer to objects, as S4 objects are also returned and the nature of the technical class system is probably not necessary in the frame of this document.

RESPONSE: This has now been amended.
Regarding the R package, I would suggest to add URL and BugReports fields in the packages DESCRIPTION file. This helps users find the GitHub repository and report issues. I also noted that in the 'getting started' vignette, it looks like some section a missing a space after the section markup. I have send a pull request fixing these and some other minor issue. markup. I have send a pull request fixing these and some other minor issue.
RESPONSE: Thank you for the pull request, this has now been merged with OmaDB version 2.0.

Note that the html and R version of the vignette shouldn't be included in the package source.
RESPONSE: This has now been amended.
In the python package section, the authors mention that this package is also named 'omadb'. I would argue that the packages have different names, as programming languages are case sensitive and suggest to drop the also to avoid any confusion.

RESPONSE: Amended as requested.
In the first sentence of the result section, authors should replace R library by R package, as they are referring to their package, not the location where the package is being installed (the library).

RESPONSE: This has now been amended.
In general, it would be very useful for the authors to describe the different outputs they have. I am not expecting the authors to provide full details of the REST API responses, but describing how the results match the text would be important. For example, in example 1, they only show how to produce the `response_content_list` response. Here, it would be useful to explain that this R list directly maps the REST json message, and point to the specific documentation entry point. Such an explanation motivates the example in the text and helps users, that aren't familiar with REST, to understand the relation between the server and the package.

RESPONSE:
We agree, and further information on the output generated in the manuscript has now been added to example 1.
Similarly in example 2, the authors create the `seq_annotation` variable and mention that only one target sequence was identified. Here, it would be useful to show that length(seq_annotation$targets)` is equal to 1, to back their claim, to indicate how users can verify the number of targets, and motivate the use of the first list index in later code chunks.
RESPONSE: This has now been updated.
Still in example 2, the authors query and extract the hog members. These data are however already present in the first output of that example, under seq_annotation$targets[ [1]]$oma_hog_members`. It would be useful to explain why the authors send a second query to obtain that data and clarify whether `oma_hog_members` is always equivalent to calling `getHOG` and `getProtein`. RESPONSE: It is true that the hog members can also be directly accessed via the oma_hog_members attribute. However, the members are only loaded once the attribute is accessed, so we do not add unnecessary requests. Even more importantly, if we would load the hog members via the oma_hog_members attribute, it is not obvious for which taxonomic level the members are loaded. We therefore prefer to keep the current slightly more verbose way to access the data.
When trying to reproduce the code, I first failed to run the code chunks calling `getProtein`. Later, 1.

1.
Being somewhat "ahead of its time", the R package as described in the manuscript requires both the development version of R (v3.6) and Bioconductor (v3.9). The package installation instructions at the beginning of the manuscript only glances over it, more complete instructions are only found in the Software availability section at the end.
We recommend including more explicit warnings/instructions about the required versions at the beginning, otherwise potential users might be confused when trying to follow along with the examples given in the manuscript (As happened to us and it took us some time to figure out what's going on). RESPONSE: We agree that this might cause confusion and we have now updated the OmaDB package section in Methods to mention explicitly that the package version used in the manuscript is 2.0, which until April 2019 is in the development version of Bioconductor. We also point the readers to the Software Availability section where further instructions for package installation are provided. We are hesitant to amend the package installation instructions at the beginning of the manuscript to reflect this as it will change shortly.
While the Python package is not extensively discussed in this manuscript, the authors provide a Binder that can be used to reproduce the same analyses using Python. We recommend putting a link to it (https://mybinder.org/v2/gh/DessimozLab/pyomadb/master?filepath=examples%2Fpyomadb-examples.ipynb in the manuscript, to help users with taking up the Python library.
RESPONSE: This has now been added.
No competing interests were disclosed.

Competing Interests:
The benefits of publishing with F1000Research: Your article is published within days, with no editorial bias You can publish traditional articles, null/negative results, case reports, data notes and more The peer review process is transparent and collaborative Your article is indexed in PubMed after passing peer review Dedicated customer support at every stage For pre-submission enquiries, contact research@f1000.com