| Title: | R wrapper for the OMA REST API |
|---|---|
| Description: | A package for the orthology prediction data download from the OMA browser database (https://omabrowser.org). It provides access to proteins, genomes, Hierarchical Orthologous Groups (HOGs), OMA Groups, pairwise orthologs, the taxonomy and (ancestral) synteny via the OMA REST API. The results are returned as data.frames or objects using standard Bioconductor classes such as GRanges and AAString, and can be used for downstream analyses, e.g. Gene Ontology enrichment with topGO. Responses are cached in memory and optionally on disk. |
| Authors: | Klara Kaleb [aut], Adrian Altenhoff [aut, cre] (ORCID: <https://orcid.org/0000-0001-7492-1273>) |
| Maintainer: | Adrian Altenhoff <[email protected]> |
| License: | GPL-3 |
| Version: | 2.31.0 |
| Built: | 2026-11-24 04:32:11 UTC |
| Source: | https://github.com/bioc/OmaDB |
This function obtain Gene Ontology annotation for a given sequence that does not need to exist in the OMA Browser so far. The query sequence will analysed and a fast homology detection approach based on kmers will be used to detect the closest sequences in OMA. GO annotations for these top hits will be used to annotated the query sequence.
annotateSequence(query)annotateSequence(query)
query |
the sequence to be annotated, it can be either a string or an AAString object from the Biostrings package |
a data.frame containing the GO annotations (in GAF format columns) of the most similar protein to the query sequence
seq <- paste0("MNDPSLLGYPNVGPQQQQQQQQQQHAGLLGKGTPNALQQQLHMNQLTGIPPPGLMN", "NSDVHTSSNNNSRQLLDQLANGNANMLNMNMDNNNNNNNNNNNNNNNGGGSGVMMNASTAAVNSIGM") go <- annotateSequence(query = seq) head(go[, c("GO_ID", "GO_name", "Aspect")])seq <- paste0("MNDPSLLGYPNVGPQQQQQQQQQQHAGLLGKGTPNALQQQLHMNQLTGIPPPGLMN", "NSDVHTSSNNNSRQLLDQLANGNANMLNMNMDNNNNNNNNNNNNNNNGGGSGVMMNASTAAVNSIGM") go <- annotateSequence(query = seq) head(go[, c("GO_ID", "GO_name", "Aspect")])
The function creates a list of GO annotations that is compatible with topGO from proteins or GO annotations retrieved from the OMA Browser.
formatTopGO(geneList, format)formatTopGO(geneList, format)
geneList |
either a list of protein objects (as returned by
|
format |
format for the data to be returned in - either 'GO2geneID' or 'geneID2GO' |
a named list containing the GO2geneID or geneID2GO information
geneList <- getProtein(id = c("YEAST00001", "YEAST00003")) annotations <- formatTopGO(geneList, format = "geneID2GO") lengths(annotations)geneList <- getProtein(id = c("YEAST00001", "YEAST00003")) annotations <- formatTopGO(geneList, format = "geneID2GO") lengths(annotations)
Returns the value of an attribute of an object returned by the package.
If the attribute is a url pointing to the OMA Browser API, the data
behind the url is loaded and returned. This is equivalent to
obj$attribute.
getAttribute(obj, attribute)getAttribute(obj, attribute)
obj |
an object of class |
attribute |
the name of the attribute |
the value of the attribute
members <- getAttribute(getOMAGroup(id = "YEAST58"), "members") head(members$omaid)members <- getAttribute(getOMAGroup(id = "YEAST58"), "members") head(members$omaid)
This function obtains the basic information for one specific genome available on the OMA Browser, or - if no id is provided - a data.frame with all available genomes.
getGenome(id = NULL, attribute = NULL)getGenome(id = NULL, attribute = NULL)
id |
A genome identifier. By default, all available genomes will be returned. |
attribute |
An extra attribute to be returned ('proteins' or 'genes'). |
Ids can be either the scientific name of a species, the NCBI taxonomy id or the UniProtKB mnemonic species code.
The optional argument attribute can be used to directly load the proteins
(all proteins, including alternative splicing isoforms) or the genes
(only the main isoform of each gene) of the genome. Alternatively, you can
access the proteins attribute of the result which will
transparently load the proteins from the OMA Browser.
If no id is given, a data.frame with all genomes. Otherwise an
omadb_obj with the genome's attributes, or - if
attribute is given - a data.frame with the proteins or genes of
the genome.
genomes <- getGenome() head(genomes[, c("code", "taxon_id", "species")]) getGenome(id = "HUMAN") getGenome(id = 9606) prots <- getGenome(id = "ASHGO", attribute = "proteins") nrow(prots)genomes <- getGenome() head(genomes[, c("code", "taxon_id", "species")]) getGenome(id = "HUMAN") getGenome(id = 9606) prots <- getGenome(id = "ASHGO", attribute = "proteins") nrow(prots)
This function retrieves the pairwise relations among two genomes from the OMA Browser database. The relations are orthologs in case the genomes are different and "close paralogs" and "homeologs" in case they are the same.
getGenomePairs( genome_id1, genome_id2, chr1 = NULL, chr2 = NULL, rel_type = NULL, ... )getGenomePairs( genome_id1, genome_id2, chr1 = NULL, chr2 = NULL, rel_type = NULL, ... )
genome_id1 |
an identifier for the first genome, which can be either its taxon id or UniProt species code |
genome_id2 |
an identifier for the second genome, which can be either its taxon id or UniProt species code |
chr1 |
the chromosome of interest for the first genome |
chr2 |
the chromosome of interest for the second genome |
rel_type |
the pairs relationship type |
... |
ignored; kept for backwards compatibility. |
By using the parameters chr1 and chr2, one can limit the relations
to a certain chromosome for one or both genomes. The id of the
chromosome corresponds to the chromosome ids from the
getGenome result.
The rel_type parameter further limits the returned relations to a specific subtype of orthologs (i.e. "1:1", "1:n", "m:1", "m:n") or - within a genome to either "close paralogs" or "homeologs".
a data.frame containing information about both the entries in
the pair (columns starting with entry_1. and entry_2.)
and their relationship.
pairs <- getGenomePairs(genome_id1 = "YEAST", genome_id2 = "ASHGO", chr2 = "I", rel_type = "1:1") head(pairs[, c("entry_1.omaid", "entry_2.omaid", "rel_type")])pairs <- getGenomePairs(genome_id1 = "YEAST", genome_id2 = "ASHGO", chr2 = "I", rel_type = "1:1") head(pairs[, c("entry_1.omaid", "entry_2.omaid", "rel_type")])
The function retrieves a specific Hierarchical Orthologous Group (HOG) from the OMA Browser database. A HOG is a set of genes that have all descended from a single ancestral gene at a specific taxonomic level.
getHOG(id, level = NULL, members = FALSE, attribute = NULL, max_results = NULL)getHOG(id, level = NULL, members = FALSE, attribute = NULL, max_results = NULL)
id |
an identifier for the HOG to be returned - either its HOG ID or a protein id. |
level |
a specific level for the HOG to be restricted to. level can either be 'root', or the name of a taxonomic level that is part of the HOG, e.g. 'Fungi'. By default it will retrieve the deepest level of the most specific subhog for the given ID. |
members |
logical, if |
attribute |
an extra attribute of the HOG to be returned, see details. |
max_results |
for |
A HOG can be identified by its member proteins and a taxonomic level, or a HOG ID. As a taxonomic level, you can use either 'root' to retrieve the HOG at its deepest level, or the name of NCBI taxonomy level, or leave it out in which case the deepest level that doesn't include a duplication node is used.
The optional argument attribute can be used to directly retrieve
the member proteins of the HOG at the given level
the Gene Ontology annotations of the HOG, i.e. of the ancestral gene at the given level, with a score
HOGs with a similar phylogenetic profile, i.e. similar pattern of gene losses and duplications
Without attribute, a data.frame with one row per HOG
matching the query (a HOG ID can refer to several sub-HOGs at a given
level), each with information on the HOG at the given level. With
attribute (or members = TRUE), a data.frame with the
requested data.
getHOG(id = "YEAST00001") getHOG(id = "YEAST00001", level = "root")[, c("hog_id", "level")] members <- getHOG(id = "HOG:F0411479", level = "Saccharomycetaceae", members = TRUE) head(members$omaid) getHOG(id = "HOG:F0411479", attribute = "gene_ontology")getHOG(id = "YEAST00001") getHOG(id = "YEAST00001", level = "root")[, c("hog_id", "level")] members <- getHOG(id = "HOG:F0411479", level = "Saccharomycetaceae", members = TRUE) head(members$omaid) getHOG(id = "HOG:F0411479", attribute = "gene_ontology")
The function retrieves all Hierarchical Orthologous Groups (HOGs) that are defined at a given taxonomic level. Each HOG corresponds to an ancestral gene of the ancestral genome at that level, so this function can be used to retrieve the gene content of an ancestral genome.
getHOGs(level, compare_with = NULL)getHOGs(level, compare_with = NULL)
level |
the taxonomic level of interest (scientific name or NCBI taxon id). |
compare_with |
optional, a more ancestral taxonomic level to compare with. |
If compare_with is set to a more ancestral taxonomic level, each
HOG is annotated with the evolutionary event that happened to the
corresponding ancestral gene between the two levels: whether it was
retained, duplicated, gained (i.e. it originated between the levels) or
lost.
a data.frame with one row per HOG. The column members_url
can be used with resolveURL to retrieve the members of a
HOG. If compare_with is given, the column event contains
the evolutionary event.
hogs <- getHOGs(level = "Saccharomycetaceae") nrow(hogs) head(hogs[, c("hog_id", "completeness_score", "nr_genes")])hogs <- getHOGs(level = "Saccharomycetaceae") nrow(hogs) head(hogs[, c("hog_id", "completeness_score", "nr_genes")])
Function to obtain the genomic loci of a set of proteins as a GRanges object.
getLocus(proteins)getLocus(proteins)
proteins |
the proteins of interest. Either a character vector of
protein ids, a data.frame with protein data (e.g. the members of an
OMA group or HOG, which have the columns |
a GRanges object with the loci of the
proteins. The seqnames are the chromosomes, the names are the OMA ids
of the proteins.
loci <- getLocus(proteins = getOMAGroup("YEAST58")$members) loci getLocus(c("YEAST00001", "YEAST00002"))loci <- getLocus(proteins = getOMAGroup("YEAST58")$members) loci getLocus(c("YEAST00001", "YEAST00002"))
Lists the attributes of an object returned by the package and their data types. Attributes of type "url" are loaded from the OMA Browser when they are accessed.
getObjectAttributes(obj)getObjectAttributes(obj)
obj |
an object of class |
a named character vector with the data type of each attribute
getObjectAttributes(getOMAGroup(id = "YEAST58"))getObjectAttributes(getOMAGroup(id = "YEAST58"))
This function obtains an OMA Group from the OMA Browser database. An OMA Group is defined to be a clique of proteins that are all orthologous to each other, i.e. they are all related through speciation events only. An OMA Group can thus by definition not contain any inparalogs. It is a very stringent orthology grouping approach. OMA Groups are mostly useful to infer phylogenetic species tree where they can be used as marker genes.
getOMAGroup(id, attribute = NULL)getOMAGroup(id, attribute = NULL)
id |
An identifier for the group. See above for possible types of IDs. |
attribute |
an extra attribute to be returned ('close_groups', the sorted list of closely related groups). |
Retrieving an OMA Group can be done using a group nr as id, its fingerprint (a 7mer AA sequence which is unique to proteins in that group), a member protein id or any sequence pattern that is unique to the group.
an omadb_obj with the group's attributes (the
members are a data.frame), or a data.frame with the closely related
groups.
grp <- getOMAGroup(id = "YEAST58") grp$fingerprint head(grp$members[, c("omaid", "canonicalid")]) getOMAGroup(id = "ACCQRNQ")$group_nrgrp <- getOMAGroup(id = "YEAST58") grp$fingerprint head(grp$members[, c("omaid", "canonicalid")]) getOMAGroup(id = "ACCQRNQ")$group_nr
The function retrieves a Hierarchical Orthologous Group (HOG) in the OrthoXML format (https://orthoxml.org), which contains the full nested structure of the HOG including all duplication and speciation events. The result can for example be analysed with dedicated tools for HOGs such as pyHam.
getOrthoXML(id, augmented = FALSE)getOrthoXML(id, augmented = FALSE)
id |
the root HOG ID (e.g. "HOG:F0411479") or the id of a member protein, in which case the root HOG of the protein is returned. |
augmented |
logical, whether to return an augmented version of the OrthoXML that contains more information (e.g. the taxonomic level of each group), but which does not strictly follow the OrthoXML schema. |
a character string with the OrthoXML document.
xml <- getOrthoXML("HOG:F0411479") substr(xml, 1, 200)xml <- getOrthoXML("HOG:F0411479") substr(xml, 1, 200)
This function enables to retrieve information on one or several proteins from the OMA Browser database.
getProtein(id, attribute = NULL, rel_type = NULL)getProtein(id, attribute = NULL, rel_type = NULL)
id |
Identifier(s) for the entry or entries to be returned. A character string for a single entry or a vector for several entries. |
attribute |
Instead of the protein, return the attribute property of the protein. See details for the available attributes. 'homeologs' is accepted as an alias for 'homoeologs'. |
rel_type |
For |
In its simplest form the function returns the base data of the query protein. The query protein can be selected with any unique id, for example with a UniProtKB accession (P12345), an OMA id (YEAST00012), or a RefSeq id (NP_001226). To retrieve more than one protein, pass a vector of IDs.
Non-scalar properties of proteins such as their domains, GO annotations, orthologs or homoeologs are loaded upon accessing them, or - if you only need this information - you can set the attribute parameter to the property name and retrieve this information directly:
the orthologs of the protein, optionally restricted to
a type of relationship with rel_type
the orthologs of the protein derived from its hierarchical orthologous groups
the homoeologs of the protein (only for proteins of polyploid genomes)
the Gene Ontology annotations of the protein
the domain annotations of the protein
the cross-references of the protein to other databases
the splicing isoforms of the protein's gene
the genomic locus of the protein as a GRanges object
For a single id, an omadb_obj with the protein's
attributes. For several ids, a named list of such objects (with
NULL for ids that are not found). If attribute is given,
a data.frame with the requested data (combined for all ids, with a
column query_id), except for 'locus' which returns a GRanges
object and 'domains' which returns an omadb_obj for a single id
and a list of them for several ids.
For non-unique IDs or partial ID lookup, use
searchProtein instead.
getProtein(id = "YEAST00001") head(getProtein(id = "YEAST00001", attribute = "orthologs")) prots <- getProtein(id = c("YEAST00001", "YEAST00002", "YEAST00012")) names(prots) go <- getProtein(id = c("YEAST00001", "YEAST00002"), attribute = "gene_ontology") table(go$query_id)getProtein(id = "YEAST00001") head(getProtein(id = "YEAST00001", attribute = "orthologs")) prots <- getProtein(id = c("YEAST00001", "YEAST00002", "YEAST00012")) names(prots) go <- getProtein(id = c("YEAST00001", "YEAST00002"), attribute = "gene_ontology") table(go$query_id)
The function retrieves the (ancestral) synteny graph, i.e. the gene order, at a given taxonomic level. Nodes of the graph are genes (HOGs for ancestral levels, proteins for extant genomes), edges connect genes that are (inferred to be) neighbours on a chromosome.
getSynteny( level, id = NULL, evidence = c("linearized", "parsimonious", "any"), context = 2L, break_circular_contigs = TRUE )getSynteny( level, id = NULL, evidence = c("linearized", "parsimonious", "any"), context = 2L, break_circular_contigs = TRUE )
level |
the taxonomic level of interest. Ancestral levels accept the scientific name or the NCBI taxon id, extant genomes also accept the UniProt species code. |
id |
optional, a HOG ID (for ancestral levels) or protein id (for extant genomes) to retrieve its neighbourhood. |
evidence |
the minimum evidence of the edges of the ancestral synteny graph: 'linearized' (default), 'parsimonious' or 'any'. |
context |
the size of the neighbourhood around |
break_circular_contigs |
logical, whether to break circular ancestral contigs at their weakest edge. Only used if evidence is 'linearized'. |
If id is given, only the neighbourhood of the given HOG or
protein is returned, otherwise the synteny graph of the whole (ancestral)
genome.
The result can easily be converted into a graph object, e.g. with
igraph::graph_from_data_frame(res$links, directed = FALSE). Note
that for a neighbourhood, the links of the outermost nodes may point to
nodes that are not included in nodes.
a list with two data.frames: nodes with one row per gene
(the first column id identifies the gene) and links with
one row per edge (the first columns source and target,
followed by weight and further information on the edge).
syn <- getSynteny(level = "Saccharomycetaceae", id = "HOG:F0411479", context = 2) syn$nodes syn$links[, c("source", "target", "weight")]syn <- getSynteny(level = "Saccharomycetaceae", id = "HOG:F0411479", context = 2) syn$nodes syn$links[, c("source", "target", "weight")]
The function obtains the taxonomic tree of the genomes in the OMA
Browser, either as a newick string (that can for example be converted into
a phylo object with getTree) or as a nested
object.
getTaxonomy(root = NULL, members = NULL, newick = TRUE, collapse = TRUE)getTaxonomy(root = NULL, members = NULL, newick = TRUE, collapse = TRUE)
root |
optional parameter, the root of the subtree of interest, i.e. a taxonomic level, a taxon id or a UniProt species code. |
members |
optional parameter, vector (or comma-separated string) of NCBI taxon ids, species codes or taxonomic levels that should be included in the induced taxonomy. |
newick |
logical, whether to return the taxonomy in newick format (default) or as a nested object. |
collapse |
logical, whether levels with a single child should be collapsed (default TRUE). |
The taxonomy can be restricted to a subtree by specifying its root, or
to the taxonomy induced by a set of member genomes or taxonomic levels.
Only one of root and members can be specified.
an omadb_obj. If newick = TRUE, it contains
the attributes newick (labels containing special characters
are quoted) and root_taxon. Otherwise it contains the attributes
name, id and children, a data.frame with one row
per child taxon, where a list column children again contains
the children of internal nodes and the column code the species
code of leaves.
getTaxonomy(members = c("YEAST", "ASHGO"))$newick tax <- getTaxonomy(root = "Alveolata", newick = FALSE) tax$namegetTaxonomy(members = c("YEAST", "ASHGO"))$newick tax <- getTaxonomy(root = "Alveolata", newick = FALSE) tax$name
The function creates a topGOdata object containing the GO
annotations for the given genes, which can be used to perform a GO
enrichment analysis with the topGO package.
getTopGO(annotations, format, foregroundGenes, ontology)getTopGO(annotations, format, foregroundGenes, ontology)
annotations |
list of GO annotations obtained from
|
format |
Format of the annotations - either 'GO2geneID' or 'geneID2GO' |
foregroundGenes |
identifiers of the foreground genes, i.e. the genes
of interest. Either a character vector or a data.frame with a column
|
ontology |
The ontology for which the enrichment should be done ('BP', 'MF' or 'CC'). This parameter is passed directly to the topGOdata constructor. |
The topGO package must be attached with library(topGO) before
calling this function, as topGO requires it to find its GO term
environments.
a topGOdata object
library(topGO) members <- getHOG("HOG:F0411479", level = "Saccharomycetaceae", members = TRUE) go <- getProtein(members$omaid, attribute = "gene_ontology") annotations <- formatTopGO(go, format = "geneID2GO") GOdata <- getTopGO(annotations, foregroundGenes = head(members$omaid, 3), format = "geneID2GO", ontology = "BP") GOdatalibrary(topGO) members <- getHOG("HOG:F0411479", level = "Saccharomycetaceae", members = TRUE) go <- getProtein(members$omaid, attribute = "gene_ontology") annotations <- formatTopGO(go, format = "geneID2GO") GOdata <- getTopGO(annotations, foregroundGenes = head(members$omaid, 3), format = "geneID2GO", ontology = "BP") GOdata
A convenience function to obtain a tree object from a newick tree,
essentially wraps read.tree from the ape package.
getTree(newick)getTree(newick)
newick |
The newick tree to be instantiated, or the result of
|
a tree object of class phylo
taxonomy <- getTaxonomy(root = "Alveolata") tree <- getTree(newick = taxonomy) head(tree$tip.label)taxonomy <- getTaxonomy(root = "Alveolata") tree <- getTree(newick = taxonomy) head(tree$tip.label)
The function obtains the version of the OMA Browser database release and of the REST API that the package is using.
getVersion()getVersion()
an omadb_obj with the attributes
oma_version and api_version
getVersion()getVersion()
The function identifies the protein(s) in the OMA Browser that match a query sequence, either exactly or approximately.
mapSequence(query, search = NULL, full_length = FALSE)mapSequence(query, search = NULL, full_length = FALSE)
query |
the sequence to be searched, it can be either a string or an AAString object from the Biostrings package |
search |
argument to choose search strategy. Can be set to 'exact', 'approximate' or 'mixed'. Defaults to 'mixed', meaning first tries to find exact match. If no target can be found, uses approximate search strategy to identify query sequence in database. |
full_length |
a logical indicating whether or not for exact matches, the query sequence must be matching the full target sequence. By default, a partial exact match is also reported as exact match. |
an omadb_obj with the attributes query,
identified_by (the type of match) and targets, a
data.frame with the matching proteins.
seq <- paste0("MNDPSLLGYPNVGPQQQQQQQQQQHAGLLGKGTPNALQQQLHMNQLTGIPPPGLMN", "NSDVHTSSNNNSRQLLDQLANGNANMLNMNMDNNNNNNNNNNNNNNNGGGSGVMMNASTAAVNSIGM") res <- mapSequence(query = seq) res$identified_by res$targets[, c("omaid", "canonicalid")]seq <- paste0("MNDPSLLGYPNVGPQQQQQQQQQQHAGLLGKGTPNALQQQLHMNQLTGIPPPGLMN", "NSDVHTSSNNNSRQLLDQLANGNANMLNMNMDNNNNNNNNNNNNNNNGGGSGVMMNASTAAVNSIGM") res <- mapSequence(query = seq) res$identified_by res$targets[, c("omaid", "canonicalid")]
Functions that retrieve a single entity from the OMA Browser (e.g. a
protein, a genome, an OMA group or a HOG) return an object of class
omadb_obj. It is a named list with one element per attribute of the
entity. Attributes that hold a list of entities (e.g. the members of an
OMA group) are data.frames, protein and cDNA sequences are
AAString and DNAString
objects and genomic loci are GRanges objects.
## S3 method for class 'omadb_obj' x$name ## S3 method for class 'omadb_obj' as.data.frame(x, row.names = NULL, optional = FALSE, ...) ## S3 method for class 'omadb_obj' print(x, ...)## S3 method for class 'omadb_obj' x$name ## S3 method for class 'omadb_obj' as.data.frame(x, row.names = NULL, optional = FALSE, ...) ## S3 method for class 'omadb_obj' print(x, ...)
x |
an object of class |
name |
the name of the attribute |
row.names, optional, ...
|
passed on to/ignored as for
|
Some attributes are not included in the response from the OMA Browser,
but are given as a url pointing to the API endpoint that provides the
data. Accessing such an attribute with $ (or
getAttribute) loads the data transparently. The responses
are cached (see setOmaCache), so accessing an attribute
repeatedly does not query the server again. Use [[ to access the
url itself.
as.data.frame converts an object into a data.frame with a single
row. Nested attributes are flattened into columns named
<attribute>.<subattribute>; attributes that are not scalars
(vectors, data.frames, sequences, ...) become list columns.
$ returns the value of the attribute, loading it from the
OMA Browser if necessary. as.data.frame returns a data.frame
with one row. print returns x invisibly.
prot <- getProtein("YEAST00001") prot$omaid ## the orthologs are loaded on access head(prot$orthologs[, c("omaid", "rel_type")]) as.data.frame(prot)[, c("omaid", "species.code", "oma_group")]prot <- getProtein("YEAST00001") prot$omaid ## the orthologs are loaded on access head(prot$orthologs[, c("omaid", "rel_type")]) as.data.frame(prot)[, c("omaid", "species.code", "oma_group")]
Example responses of the OMA Browser REST API, as returned by the
functions of this package. They were retrieved from the OMA Browser
release All.May2026 with the script
system.file("scripts", "make-data.R", package = "OmaDB").
see the description of the corresponding function.
getProtein("YEAST00001"): an
omadb_obj with the data of a protein.
getProtein("YEAST00001", attribute =
"orthologs"): a data.frame with the orthologs of the protein.
getOMAGroup("YEAST00058"): an
omadb_obj with the OMA Group of protein YEAST00058,
including its members.
getHOG("YEAST00001"): a data.frame with the HOG of
protein YEAST00001.
head(getGenomePairs("YEAST", "ASHGO", chr1 = "I"),
100): a data.frame with orthologous pairs between the genomes of
Saccharomyces cerevisiae and Ashbya gossypii.
getTaxonomy(members = c("YEAST", "ASHGO",
"SCHPO")): an omadb_obj with the taxonomy of three
yeast species in newick format.
searchProtein("P53_RAT"): a data.frame with the
cross-references matching the query.
mapSequence(seq): an omadb_obj
with the proteins matching a query sequence.
annotateSequence(seq): a data.frame
with the predicted GO annotations of a query sequence.
data(protein, package = "OmaDB") protein$omaid data(pairs, package = "OmaDB") table(pairs$rel_type)data(protein, package = "OmaDB") protein$omaid data(pairs, package = "OmaDB") table(pairs$rel_type)
Loads the data behind a url of the OMA Browser API. This is usually not
needed, as attributes containing a url are loaded automatically when
accessed with $. It is useful for urls that are stored in a
data.frame, e.g. the members_url column of the result of
getHOGs.
resolveURL(url)resolveURL(url)
url |
the url of interest |
The type of the result depends only on the type of data provided by the
endpoint: endpoints that provide a single entity return an
omadb_obj, endpoints that provide a list of entities always
return a data.frame (also if the list contains a single or no element).
Paginated endpoints are loaded completely.
an omadb_obj or a data.frame
go <- resolveURL(paste0("https://omabrowser.org/api/protein/YEAST00001/", "gene_ontology/")) head(go)go <- resolveURL(paste0("https://omabrowser.org/api/protein/YEAST00001/", "gene_ontology/")) head(go)
The function lists all the cross-references to other databases (e.g. UniProtKB, RefSeq, Ensembl) of proteins in the OMA Browser that match a pattern.
searchProtein(pattern)searchProtein(pattern)
pattern |
the pattern to query the OMA database with - needs to be at least 3 characters long. If the pattern matches too many cross-references, an error is raised. |
a data.frame containing information on the cross references
matching the pattern, including the OMA id of the protein (column
omaid).
res <- searchProtein(pattern = "P53_RAT") res[, c("xref", "source", "omaid")]res <- searchProtein(pattern = "P53_RAT") res[, c("xref", "source", "omaid")]
Sets the base url of the OMA Browser REST API used by all functions of the package. If no url is given, the default OMA Browser API (https://omabrowser.org/api/) is used. This can be used to access other instances of the OMA Browser, e.g. the Corona OMA Browser at https://corona.omabrowser.org/api/.
setAPI(url)setAPI(url)
url |
Base url to the API |
Changing the API url does not invalidate cached responses, as the url is part of the cache key.
The previously used API url, invisibly.
old <- setAPI("https://corona.omabrowser.org/api/") setAPI(old)old <- setAPI("https://corona.omabrowser.org/api/") setAPI(old)
All responses from the OMA Browser API are cached in memory for the duration of the R session, so repeated queries (including accessing attributes of objects that are loaded lazily) do not hit the server again. Optionally, responses can also be stored in a persistent cache on disk, which is reused across R sessions.
setOmaCache( persistent = TRUE, dir = tools::R_user_dir("OmaDB", which = "cache"), max_size = 1024^3 ) clearOmaCache()setOmaCache( persistent = TRUE, dir = tools::R_user_dir("OmaDB", which = "cache"), max_size = 1024^3 ) clearOmaCache()
persistent |
logical, whether responses should also be cached on disk. |
dir |
directory of the persistent cache. |
max_size |
maximum size of the persistent cache in bytes. |
The persistent cache is stored by default in the user cache directory
given by tools::R_user_dir("OmaDB", which = "cache"). As the data
in the OMA Browser only changes with a new release, the persistent cache
is cleared automatically if the OMA release or the API version of the
server differ from those of the cached data.
The persistent cache can also be enabled by setting the option
OmaDB.persistentCache to TRUE before the first request,
e.g. in the .Rprofile file. The option OmaDB.cacheDir can
then be used to set its directory.
setOmaCache returns the directory of the persistent cache
(or NULL if it is disabled) invisibly. clearOmaCache
returns NULL invisibly.
## use a temporary directory for the persistent cache setOmaCache(persistent = TRUE, dir = file.path(tempdir(), "omadb")) clearOmaCache() setOmaCache(persistent = FALSE)## use a temporary directory for the persistent cache setOmaCache(persistent = TRUE, dir = file.path(tempdir(), "omadb")) clearOmaCache() setOmaCache(persistent = FALSE)