Contents
PGSLibraryView
A read-only view of one model in a PGSLibrary
A PGSLibraryView is a non-owning (backbone, position) pointer to one model in a shared
PolyGeniusBackbone, handed out by PGSLibrary$models. It never serializes the backbone.
Apart from $variants, no accessor reads a variant column, so they are safe to call in a
loop over set$models: every value comes from the backbone's registry or the owning set's
overlay. $variants materializes a fresh copy of the model's variant table on every call.
Usage
S3 method for class 'PGSLibraryView'
nrow(x)S3 method for class 'PGSLibraryView'
ncol(x)S3 method for class 'PGSLibraryView'
dim(x)S3 method for class 'PGSLibraryView'
length(x)S3 method for class 'PGSLibraryView'
colnames(x, ...)S3 method for class 'PGSLibraryView'
dimnames(x)S3 method for class 'PGSLibraryView'
print(x, ...)S3 method for class 'PGSLibraryView'
format(x, ...)S3 method for class 'PGSLibraryView'
.DollarNames(x, pattern = "")S3 method for class 'PGSLibraryView'
x$nameS3 method for class 'PGSLibraryView'
$(x, name) <- valueS3 method for class 'PGSLibraryView'
x[...]S3 method for class 'PGSLibraryView'
filter(.data, ...)S3 method for class 'PGSLibraryView'
select(.data, ...)S3 method for class 'PGSLibraryView'
mutate(.data, ...)S3 method for class 'PGSLibraryView'
arrange(.data, ...)S3 method for class 'PGSLibraryView'
slice(.data, ...)S3 method for class 'PGSLibraryView'
rename(.data, ...)S3 method for class 'PGSLibraryView'
transmute(.data, ...)S3 method for class 'PGSLibraryView'
group_by(.data, ...)S3 method for class 'PGSLibraryView'
ungroup(.data, ...)S3 method for class 'PGSLibraryView'
summarise(.data, ...)Arguments
| Argument | Description |
|---|---|
x | A PGSLibraryView. |
... | Unused. Present for S3 method compatibility. |
pattern | Character scalar, default "". Regular expression filtering the completion candidates; "" keeps all of them. |
name | Character scalar. For $ the field to extract; for $<- the field being assigned, where anything but "name" aborts. |
value | Character scalar. The model's new name. |
.data | A PGSLibraryView. |
Value
nrow(), ncol() and length() return an integer scalar; dim() an integer vector
of length 2 (variants, columns); colnames() a character vector; dimnames() the list
list(NULL, colnames(x)); .DollarNames() a character vector of candidates; format() a
one-line character scalar; print() x invisibly, called for its console output;
$<- x invisibly, called for the rename it records on the owning set. [
never returns -- it aborts. The dplyr verbs never return; they always abort.
Details
$variants materializes the model's variant table off the shared dictionary, in genomic
order, as a fresh copy safe to mutate: the five base columns, this model's own and its
source's pass-through columns, and a column per attached variant annotation, NA where a
source does not cover the variant. $backbone resolves the live PolyGeniusBackbone.
Everything else is a registry or overlay read that materializes nothing: $name (the owning
set's overlay when there is one, else the backbone's own registry), $build, $n.variants,
$generation, $gwas, and any extra field a prior mutate.models() attached. Any other
name aborts, a real variant column such as $beta included.
dplyr verbs
Every dplyr verb aborts on a view, naming two remedies: call as.PGS() to get an owned PGS
and use its verbs, or use the owning PGSLibrary's grammar (set$filter.variants()
and friends). The equivalent PGS verb deep-clones the model it operates on, which on a view
would mean copying the whole shared dictionary. Refusing keeps that cost from being paid by
accident.
Accessors
nrow(),ncol(),dim(),length(),colnames(),dimnames()-- shape, off the registry.ncol()andlength()are both the column count.print(),format()-- a one-line summary, never the variant table.print()says so and returns when the backbone is not registered in this session;format()has no such guard..DollarNames()-- tab-completion over a fixed set of view fields (variants,name,build,n.variants,generation,gwas), never the variant columns, which would cost a materialization to enumerate. Callas.PGS(m)first for full completion.$--$variantsmaterializes the variant table;$backboneresolves the live backbone. Every other allowed name is a registry or overlay read. A variant column such as$betaaborts, so no metadata access turns into a materialization unannounced.$<--- acceptsnameonly, and writes it into the owning set's registry by reference, renaming the model there and in every other view of the same row. Every other name aborts, as does a rename on a view with no owning set.[-- always aborts. A view is not a table; materialize withas.PGS()first.
See Also
Other pgs-objects:
PGS(),
PGSLibrary(),
PolyGeniusBackbone(),
PolyGeniusWeightStore