Description Usage Arguments Objects from the Class Slots Extends Methods Methods Author(s) Examples
CVParam
objects instantiate controlled vocabulary entries.
1 |
label |
A |
name |
A |
accession |
A |
value |
A |
exact |
A |
Objects can be created with the CVParam
constructor.
label
:Object of class "character"
that defines
the label of the instance, i.e the ontology
abbreviation/prefix. See Ontologies
to generate a
list of available ontologies and olsPrefix
for
existing labels.
accession
:Object of class "character"
with the
parameter's valid label
ontology accession number. See
below for validity constrains.
name
: Object of class "character"
with the
instance's valid name, i.e matching with the
accession
. name
and accession
must follow
term(accession, label) == name
for the instance to be
valid.
value
:Object of class "character"
with the
CVParams
value, if applicable, of empty string ("")
otherwise.
user
:Object of class "logical"
defining if the
instance is a user-defined parameter (also called User params).
.__classVersion__
:Object of class
"Versions"
describing the instance's class
definition version. For development use.
Class "Versioned"
, directly.
Checks if x
, a character of the form
"[ONTO, ACCESSION, NAME, VALUE]"
, is a valid (possibly
user-defined) CVParam
. "ONTO"
is the ontology label
(prefi), "ACCESSION"
is the term accession number,
"NAME"
is the term's name and "VALUE"
is the
value. Note that only syntax validity is verified, not semantics.
See example below.
signature(from = "CVParam", to = "character")
:
Coerces CVParam
from
to a character
of the
following form: [label, accession, name,
value]
. as.character
is also defined.
signature(from = "character", to = "CVParam")
:
Coerces character
from
to a
CVParam
. as.CVParam
is also defined. If a
label
is absent, the character
is converted to a
User param, else, the label
and accession
are used
to query the Ontology Lookup Service (see
OlsSearch
)). If a name
is provided and does
not match the retrieved name, a warning is thrown.
This function is vectorised; if the from
character is of
length greater than 1, then a list of CVParam
is
returned. The queries to the OLS are processed one-by-one, though.
signature(object = "CVParam")
: Prints the
CVParam
instance as text.
signature(x = "CVParam", times = "numeric")
:
Replicates the CVParam
x
times
times.
Laurent Gatto <lg390@cam.ac.uk>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## a user param
CVParam(name = "A user param", value = "the value")
## a CVParam from PSI's Mass Spectrometry ontology
term("MS", "MS:1000073")
CVParam(label = "MS", accession = "MS:1000073")
CVParam(label = "MS", name ="electrospray ionization")
CVParam(label = "MS", name ="ESI") ## using a synonym
## From a CVParam object to a character
cv <- as(CVParam(label = "MS", accession = "MS:1000073"), "character")
cv
## From a character object to a CVParam
as(cv, "CVParam")
as("[MS, MS:1000073, , ]", "CVParam") ## no name
as("[MS, MS:1000073, ESI, ]", "CVParam") ## name does not match
as(c(cv, cv), "CVParam") ## more than 1 character
x <- c("[MS, MS:1000073, , ]", ## valid CV param
"[, , Hello, world]", ## valid User param
"[this, one is, not, valid]", ## not valid
"[ , , , ]") ## not valid
stopifnot(charIsCVParam(x) == c(TRUE, TRUE, FALSE, FALSE))
## A list of expected valid and non-valid entries
rols:::validCVchars
rols:::notvalidCVchars
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.