Skip to content

Commit

Permalink
Merge pull request #40 from lgatto/ols4
Browse files Browse the repository at this point in the history
Merge branch ols4
  • Loading branch information
lgatto authored Feb 11, 2024
2 parents 5b84348 + 7bcf65d commit 8bbf281
Show file tree
Hide file tree
Showing 41 changed files with 2,870 additions and 2,662 deletions.
15 changes: 8 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rols
Type: Package
Title: An R interface to the Ontology Lookup Service
Version: 2.31.0
Version: 2.99.0
Authors@R: c(person(given = "Laurent", family = "Gatto",
email = "[email protected]",
role = c("aut","cre")),
Expand All @@ -13,8 +13,8 @@ Description: The rols package is an interface to the Ontology Lookup
Service (OLS) to access and query hundred of ontolgies
directly from R.
Depends: methods
Imports: httr, progress, jsonlite, utils, Biobase,
BiocGenerics (>= 0.23.1)
Imports: httr2, jsonlite,
utils, Biobase, BiocGenerics (>= 0.23.1)
Suggests: GO.db, knitr (>= 1.1.0), BiocStyle (>= 2.5.19),
testthat, lubridate, DT, rmarkdown,
biocViews: ImmunoOncology, Software, Annotation, MassSpectrometry, GO
Expand All @@ -23,7 +23,8 @@ License: GPL-2
Encoding: UTF-8
URL: http://lgatto.github.io/rols/
BugReports: https://github.com/lgatto/rols/issues
Collate: AllClasses.R AllGenerics.R utils.R cvparam.R
methods-OlsSearch.R methods-Ontologies.R methods-Terms.R
methods-Properties.R zzz.R
RoxygenNote: 6.1.0
Collate: AllClasses.R AllGenerics.R utils.R
Ontologies.R Terms.R
cvparam.R OlsSearch.R
Properties.R zzz.R
RoxygenNote: 7.3.0
120 changes: 60 additions & 60 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
import(methods)
import(utils)
import(httr)
import(jsonlite)
import(progress)
importFrom(Biobase, validMsg)
importFrom(BiocGenerics, Ontology)
importClassesFrom(Biobase, Versioned)

exportClasses(CVParam,
Term, Terms,
Ontology, Ontologies,
OlsSearch,
Property, Properties)

S3method(as.data.frame, OlsSearch)
# Generated by roxygen2: do not edit by hand

exportMethods(show,
"[", "[[", lapply,
coerce,
length,
unique,
## Ontology/ies
Ontology, Ontologies,
olsRoot,
olsPrefix,
olsDesc,
olsTitle,
olsStatus,
olsNamespace,
## Term/s
all.equal,
termLabel,
termPrefix,
termNamespace,
termOntology,
termDesc,
term, terms,
termId,
## Property/ies
properties)


export(charIsCVParam, CVParam,
## Ontology/ies
olsVersion,
olsLoaded,
olsUpdated,
## Term/s
isObsolete,
isRoot,
termSynonym,
children, parents,
ancestors, descendants,
derivesFrom, partOf,
as.Term.data.frame,
as.Terms.data.frame,
## Search/select
OlsSearch,
olsSearch,
olsRows, "olsRows<-", allRows)
S3method(as.character,CVParam)
S3method(as.data.frame,OlsSearch)
S3method(as.data.frame,Ontologies)
export("olsRows<-")
export(CVParam)
export(OlsSearch)
export(allRows)
export(ancestors)
export(as.Term.data.frame)
export(as.Terms.data.frame)
export(charIsCVParam)
export(children)
export(cvCharToCVPar)
export(descendants)
export(olsRows)
export(olsSearch)
export(parents)
exportMethods("[")
exportMethods("[[")
exportMethods(Ontologies)
exportMethods(Ontology)
exportMethods(Properties)
exportMethods(Term)
exportMethods(Terms)
exportMethods(isObsolete)
exportMethods(isRoot)
exportMethods(lapply)
exportMethods(length)
exportMethods(olsConfig)
exportMethods(olsDesc)
exportMethods(olsLinks)
exportMethods(olsLoaded)
exportMethods(olsNamespace)
exportMethods(olsPrefix)
exportMethods(olsStatus)
exportMethods(olsTitle)
exportMethods(olsUpdated)
exportMethods(olsVersion)
exportMethods(ontologyUrl)
exportMethods(rep)
exportMethods(show)
exportMethods(termDesc)
exportMethods(termId)
exportMethods(termLabel)
exportMethods(termLinks)
exportMethods(termNamespace)
exportMethods(termOntology)
exportMethods(termPrefix)
exportMethods(termSynonym)
exportMethods(unique)
import(httr2)
import(methods)
importFrom(Biobase,validMsg)
importFrom(jsonlite,fromJSON)
importFrom(utils,URLencode)
importFrom(utils,head)
importFrom(utils,packageVersion)
importFrom(utils,tail)
importMethodsFrom(BiocGenerics,Ontology)
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# rols 2.99

## CHANGES IN VERSION 2.99.0

- Refactoring to use REST API for OLS4.

# rols 2.29

## CHANGES IN VERSION 2.29.1
Expand Down
90 changes: 1 addition & 89 deletions R/AllClasses.R
Original file line number Diff line number Diff line change
@@ -1,91 +1,3 @@
setClassUnion("NullOrChar", c("NULL", "character"))
setClassUnion("NullOrList", c("NULL", "list"))

## a param is [CV label, accession, name|synonym, value]
.CVParam <- setClass("CVParam",
representation = representation(
label = "character",
accession = "character",
name = "character",
value = "character",
user = "logical"),
contains = "Versioned",
prototype = prototype(
user = FALSE,
new("Versioned", versions=c(CVParam="0.2.0"))),
validity = function(object) {
msg <- validMsg(NULL, NULL)
if (object@user) {
if (!all(c(object@label, object@accession) == ""))
msg <- "Label and accession must be empty in UserParams."
} else {
x <- c(object@label, object@accession,
object@name, object@value) == ""
if (!all(x)) {
._term <- term(object@label, object@accession)
._label <- termLabel(._term)
._synonyms <- termSynonym(._term)
if (!(object@name %in% c(._label, ._synonyms)))
msg <- paste0("CVParam accession and name/synomyms do not match. Got [",
paste(c(._label, ._synonyms), collapse = ", "),
"], expected '", object@name, "'.")
}
}
if (is.null(msg)) TRUE else msg
})


.Ontology <- setClass("Ontology",
slots = c(loaded = "NullOrChar",
updated = "NullOrChar",
status = "NullOrChar",
message = "NullOrChar",
version = "NullOrChar",
numberOfTerms = "integer",
numberOfProperties = "integer",
numberOfIndividuals = "integer",
config = "list"
))

.Ontologies <- setClass("Ontologies", slots = c(x = "list"))

.Term <- setClass("Term",
slots = c(iri = "character",
label = "character",
description = "NullOrList",
annotation = "list",
synonym = "NullOrList",
ontology_name = "character",
ontology_prefix = "character",
ontology_iri = "character",
is_obsolete = "logical",
is_defining_ontology = "logical",
has_children = "logical",
is_root = "logical",
short_form = "character",
obo_id = "NullOrChar",
links = "list"))

Terms <- setClass("Terms", slots = c(x = "list"))

.OlsSearch <- setClass("OlsSearch",
slots = c(q = "character",
ontology = "character",
type = "character",
slim = "character",
fieldList = "character",
queryFields = "character",
exact = "logical",
groupField = "logical",
obsoletes = "logical",
local = "character",
childrenOf = "character",
rows = "integer",
start = "integer",
url = "character",
numFound = "integer",
response = "data.frame"))

.Property <- setClass("Property",
contains = "Term")
Properties <- setClass("Properties", contains = "Terms")
setClassUnion("NullOrLogical", c("NULL", "logical"))
10 changes: 6 additions & 4 deletions R/AllGenerics.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
setGeneric("Ontologies", function(object) standardGeneric("Ontologies"))
## setGeneric("Ontology", function(object) standardGeneric("Ontology"))
setGeneric("Terms", function(object, ...) standardGeneric("Terms"))
setGeneric("Term", function(object, ...) standardGeneric("Term"))

setGeneric("olsPrefix", function(object, ...) standardGeneric("olsPrefix"))
setGeneric("olsDesc", function(object, ...) standardGeneric("olsDesc"))
Expand All @@ -10,11 +11,12 @@ setGeneric("olsLoaded", function(object, ...) standardGeneric("olsLoaded"))
setGeneric("olsUpdated", function(object, ...) standardGeneric("olsUpdated"))
setGeneric("olsStatus", function(object, ...) standardGeneric("olsStatus"))
setGeneric("olsNamespace", function(object, ...) standardGeneric("olsNamespace"))
setGeneric("olsLinks", function(object, ...) standardGeneric("olsLinks"))
setGeneric("olsConfig", function(object, ...) standardGeneric("olsConfig"))

setGeneric("termLinks", function(object, ...) standardGeneric("termLinks"))
setGeneric("termLabel", function(object, ...) standardGeneric("termLabel"))
setGeneric("termPrefix", function(object, ...) standardGeneric("termPrefix"))
setGeneric("terms", function(x, ...) standardGeneric("terms"))
setGeneric("term", function(object, id, ...) standardGeneric("term"))
setGeneric("termId", function(object, ...) standardGeneric("termId"))
setGeneric("isObsolete", function(object, ...) standardGeneric("isObsolete"))
setGeneric("isRoot", function(object, ...) standardGeneric("isRoot"))
Expand All @@ -23,7 +25,7 @@ setGeneric("termDesc", function(object, ...) standardGeneric("termDesc"))
setGeneric("termNamespace", function(object, ...) standardGeneric("termNamespace"))
setGeneric("termOntology", function(object, ...) standardGeneric("termOntology"))

setGeneric("properties", function(object, ...) standardGeneric("properties"))
setGeneric("Properties", function(object, ...) standardGeneric("Properties"))

## private
setGeneric("ontologyUrl", function(object, ...) standardGeneric("ontologyUrl"))
Expand Down
Loading

0 comments on commit 8bbf281

Please sign in to comment.