File: validateObject.Rd

package info (click to toggle)
r-bioc-alabaster.base 1.6.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 1,652 kB
  • sloc: cpp: 11,377; sh: 29; makefile: 2
file content (90 lines) | stat: -rw-r--r-- 3,885 bytes parent folder | download | duplicates (2)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/validateObject.R
\name{validateObject}
\alias{validateObject}
\alias{registerValidateObjectFunction}
\alias{registerValidateObjectHeightFunction}
\alias{registerValidateObjectDimensionsFunction}
\alias{registerValidateObjectSatisfiesInterface}
\alias{registerValidateObjectDerivedFrom}
\title{Validate an object's on-disk representation}
\usage{
validateObject(path, metadata = NULL)

registerValidateObjectFunction(type, fun, existing = c("old", "new", "error"))

registerValidateObjectHeightFunction(
  type,
  fun,
  existing = c("old", "new", "error")
)

registerValidateObjectDimensionsFunction(
  type,
  fun,
  existing = c("old", "new", "error")
)

registerValidateObjectSatisfiesInterface(
  type,
  interface,
  action = c("add", "remove")
)

registerValidateObjectDerivedFrom(type, parent, action = c("add", "remove"))
}
\arguments{
\item{path}{String containing a path to a directory, itself created with a \code{\link{saveObject}} method.}

\item{metadata}{List containing metadata for the object.
If this is not supplied, it is automatically read from the \code{OBJECT} file inside \code{path}.}

\item{type}{String specifying the name of type of the object.}

\item{fun}{For \code{registerValidateObjectFunction}, a function that accepts \code{path} and \code{metadata}, and raises an error if the object at \code{path} is invalid.
It can be assumed that \code{metadata} is a list created by reading \code{OBJECT}.

For \code{registerValidateObjectHeightFunction}, a function that accepts \code{path} and \code{metadata}, and returns an integer specifying the \dQuote{height} of the object.
This is usually the length for vector-like or 1-dimensional objects, and the extent of the first dimension for higher-dimensional objects.

For \code{registerValidateObjectDimensionsFunction}, a function that accepts \code{path} and \code{metadata}, and returns an integer vector specifying the dimensions of the object.

This may also be \code{NULL} to delete an existing registry from any of the functions mentioned above.}

\item{existing}{Logical scalar indicating the action to take if a function has already been registered for \code{type} -
keep the old or new function, or throw an error.}

\item{interface}{String specifying the name of the interface that is represented by \code{type}.}

\item{action}{String specifying whether to add or remove \code{type} from the list of types that implements \code{interface} or is derived from \code{parent}.}

\item{parent}{String specifying the parent object from which \code{type} is derived.}
}
\value{
For \code{validateObject}, \code{NULL} is returned invisibly upon success, otherwise an error is raised.

For the \code{registerValidObject*Function} functions, the supplied \code{fun} is added to the corresponding registry for \code{type}.
If \code{fun = NULL}, any existing entry for \code{type} is removed; a logical scalar is returned indicating whether removal was performed.

For the \code{registerValidateObjectSatisfiesInterface} and \code{registerValidateObjectDerivedFrom} functions, \code{type} is added to or removed from relevant list of types.
A logical scalar is returned indicating whether the \code{type} was added or removed - this may be \code{FALSE} if \code{type} was already present or absent, respectively.
}
\description{
Validate an object's on-disk representation against the \pkg{takane} specifications.
This is done by dispatching to an appropriate validation function based on the type in the \code{OBJECT} file.
}
\examples{
library(S4Vectors)
df <- DataFrame(A=1:10, B=LETTERS[1:10])

tmp <- tempfile()
saveObject(df, tmp)
validateObject(tmp)

}
\seealso{
\url{https://github.com/ArtifactDB/takane}, for detailed specifications of the on-disk representation for various Bioconductor objects.
}
\author{
Aaron Lun
}