Learn R Programming

rols (version 2.0.2)

CVParam-class: Class "CVParam"

Description

CVParam objects instantiate controlled vocabulary entries.

Usage

CVParam(label, name, accession, value, exact = TRUE)

Arguments

label
A character with the ontology label. If missing, a user-defined parameter is created.
name
A character with the name of the CVParam to be constructed. This argument can be omitted if accession is used and label is not missing.
accession
A character with the accession of the CVParam to be constructed. This argument can be omitted if name is used. Ignored for user-defined instances.
value
A character with the value of the CVParam to be constructed. This argument is optional.
exact
A logical defining whether the query to retrieve the accession (when name is used) should be an exact match.

Objects from the Class

Objects can be created with the CVParam constructor.

Extends

Class "Versioned", directly.

Examples

Run this code
## 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

Run the code above in your browser using DataLab