File: HDF5ArraySeed-class.Rd

package info (click to toggle)
r-bioc-hdf5array 1.34.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,736 kB
  • sloc: ansic: 5,815; makefile: 4
file content (166 lines) | stat: -rw-r--r-- 4,869 bytes parent folder | download
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
\name{HDF5ArraySeed-class}
\docType{class}

\alias{class:HDF5ArraySeed}
\alias{HDF5ArraySeed-class}
\alias{HDF5ArraySeed}

\alias{path,HDF5ArraySeed-method}
\alias{path<-,HDF5ArraySeed-method}
\alias{type,HDF5ArraySeed-method}
\alias{dim,HDF5ArraySeed-method}
\alias{dimnames,HDF5ArraySeed-method}
\alias{extract_array,HDF5ArraySeed-method}
\alias{is_sparse,HDF5ArraySeed-method}
\alias{is_sparse<-,HDF5ArraySeed-method}
\alias{extract_sparse_array,HDF5ArraySeed-method}
\alias{OLD_extract_sparse_array,HDF5ArraySeed-method}
\alias{chunkdim,HDF5ArraySeed-method}

\alias{updateObject,HDF5ArraySeed-method}

\title{HDF5ArraySeed objects}

\description{
  HDF5ArraySeed is a low-level helper class for representing a
  pointer to an HDF5 dataset.

  Note that an HDF5ArraySeed object is not intended to be used directly.
  Most end users will typically create and manipulate a higher-level
  \link{HDF5Array} object instead. See \code{?\link{HDF5Array}} for
  more information.
}

\usage{
## --- Constructor function ---

HDF5ArraySeed(filepath, name, as.sparse=FALSE, type=NA)

## --- Accessors --------------

\S4method{path}{HDF5ArraySeed}(object)

\S4method{path}{HDF5ArraySeed}(object) <- value

\S4method{dim}{HDF5ArraySeed}(x)

\S4method{dimnames}{HDF5ArraySeed}(x)

\S4method{type}{HDF5ArraySeed}(x)

\S4method{is_sparse}{HDF5ArraySeed}(x)

\S4method{is_sparse}{HDF5ArraySeed}(x) <- value

\S4method{chunkdim}{HDF5ArraySeed}(x)

## --- Data extraction --------

\S4method{extract_array}{HDF5ArraySeed}(x, index)

\S4method{extract_sparse_array}{HDF5ArraySeed}(x, index)
}

\arguments{
  \item{filepath, name, as.sparse, type}{
    See \code{?\link{HDF5Array}} for a description of these arguments.
  }
  \item{object, x}{
    An HDF5ArraySeed object or derivative.
  }
  \item{value}{
    For the \code{path()} setter: The new path (as a single string) to the
    HDF5 file where the dataset is located.

    For the \code{is_sparse()} setter: \code{TRUE} or \code{FALSE}.
  }
  \item{index}{
    See \code{?\link[S4Arrays]{extract_array}} in the \pkg{S4Arrays}
    package.
  }
}

\details{
  The HDF5ArraySeed class has one direct subclass: \link{Dense_H5ADMatrixSeed}.
  See \code{?\link{Dense_H5ADMatrixSeed}} for more information.

  Note that the implementation of HDF5ArraySeed objects follows the widely
  adopted convention of transposing HDF5 matrices when they get loaded into R.

  Finally note that an HDF5ArraySeed object supports a very limited set
  of methods:
  \itemize{
    \item \code{path()}: Returns the path to the HDF5 file where the dataset
          is located.
    \item \code{dim()}, \code{dimnames()}.
    \item \code{type()}, \code{extract_array()}, \code{is_sparse()},
          \code{extract_sparse_array()}, \code{chunkdim()}:
          These generics are defined and documented in other packages e.g.
          in \pkg{S4Arrays} for \code{\link[S4Arrays]{extract_array}()}
          and \code{\link[S4Arrays]{is_sparse}()}, in \pkg{SparseArray}
          for \code{\link[SparseArray]{extract_sparse_array}()}, and in
          \pkg{DelayedArray} for \code{\link[DelayedArray]{chunkdim}()}.
  }
}

\value{
  \code{HDF5ArraySeed()} returns an HDF5ArraySeed object.
}

\section{HDF5ArraySeed vs HDF5Array objects}{
  In order to have access to the full set of operations that are available
  for \link[DelayedArray]{DelayedArray} objects, an HDF5ArraySeed object
  first needs to be wrapped in a \link[DelayedArray]{DelayedArray} object,
  typically by calling the \code{\link[DelayedArray]{DelayedArray}()}
  constructor on it.

  This is what the \code{\link{HDF5Array}()} constructor function does.

  Note that the result of this wrapping is an \link{HDF5Array} object,
  which is just an HDF5ArraySeed object wrapped in a
  \link[DelayedArray]{DelayedArray} object.
}

\seealso{
  \itemize{
    \item \link{HDF5Array} objects.

    \item \code{\link[S4Arrays]{type}}, \code{\link[S4Arrays]{extract_array}},
          and \code{\link[S4Arrays]{is_sparse}}, in the the \pkg{S4Arrays}
          package.

    \item \code{\link[SparseArray]{extract_sparse_array}} in the
          \pkg{SparseArray} package.

    \item \code{\link[DelayedArray]{chunkdim}} in the \pkg{DelayedArray}
          package.

    \item \code{\link{h5ls}} to list the content of an HDF5 file.
  }
}

\examples{
library(h5vcData)
tally_file <- system.file("extdata", "example.tally.hfs5",
                          package="h5vcData")
h5ls(tally_file)

name <- "/ExampleStudy/16/Coverages"  # name of the dataset of interest
seed1 <- HDF5ArraySeed(tally_file, name)
seed1
path(seed1)
dim(seed1)
chunkdim(seed1)

seed2 <- HDF5ArraySeed(tally_file, name, as.sparse=TRUE)
seed2

## Alternatively:
is_sparse(seed1) <- TRUE
seed1  # same as 'seed2'

DelayedArray(seed1)
stopifnot(class(DelayedArray(seed1)) == "HDF5Array")
}
\keyword{classes}
\keyword{methods}