Contents
as.PGS
Materialize a PGSLibraryView (or a PGS, as a no-op) into a real, portable PGS
Crosses from the shared-backbone side back to the owned side, explicitly: no code path
materializes a view implicitly, so a caller always knows when it is paying for a copy of a
model's variant table. The result owns that table and is safe to saveRDS(), mutate, or pass
to any PGS method.
One thing the result does not carry over: the model's original row order, which is not
recorded anywhere -- rows come back in genomic order. It does carry name, build, gwas,
generation, every extra field mutate.models() attached, and every source- and model-plane
column the view materializes.
Usage
as.PGS(x)S3 method for class 'PGS'
as.PGS(x)S3 method for class 'PGSLibraryView'
as.PGS(x)Arguments
| Argument | Description |
|---|---|
x | A PGSLibraryView, or a [PGS](/reference/pgs/). |
Value
A PGS. Given a PGSLibraryView, a new one owning its materialized variant
table; given a PGS, x itself, unchanged and not copied. Aborts on a view whose backbone
is not registered in this session -- one read back with readRDS() on its own, for
instance.
Examples
set <- generate$models(sources = src, algorithms = ct)
# A cheap pointer: reads no variant data.
view <- set$models[[1]]
view$name
# An owned model: materializes the variant table.
model <- as.PGS(view)
nrow(model)