Contents
workspace$catalogs$referencePanels
Reference panel catalog
Inventory of the reference panels available to PolyGenius, and the entry point
that resolves one into the workspace cache. Reached as
workspace$catalogs$referencePanels.
Details
view() and get() see the union of two sources: the read-only manifest
shipped as inst/extdata/manifest.referencePanels.csv, and whatever is already
cached under <workspace$config$root>/reference.panel/. Rows are keyed by
name + build + format, and a cached row's own fields win over the manifest's.
add() and remove() touch the cache only; the manifest is never written.
A panel that is not directly downloadable at the requested build and format is
derived — downloaded at its native build/format, then converted, lifted over,
or restricted to a variant space — and every step is cached as a resource of
its own. get() is therefore idempotent: a repeated call for the same panel
reads the cache and downloads nothing.
Methods
Public methods
ReferencePanels$new()ReferencePanels$view()ReferencePanels$get()ReferencePanels$add()ReferencePanels$remove()ReferencePanels$key()ReferencePanels$assert.unrestricted()ReferencePanels$print()
Method new()
Read the reference-panel manifest and build the catalog.
Usage
ReferencePanels$new(manifest.path = NULL)
Arguments
manifest.path — Character scalar path to a manifest CSV, or NULL
(default). NULL reads inst/extdata/manifest.referencePanels.csv from
the installed package.
Returns
A new ReferencePanels object. Aborts when the manifest file is
absent, or is missing any of the columns name, build, format,
files, description, url, sha256, source.reference.panel,
variant.space.
Method view()
List every panel that is cached locally or downloadable.
Usage
ReferencePanels$view()
Returns
A data.frame, one row per name + build + format, sorted by
those three columns, with columns key, name, build (as a display
label from genomeBuilds$label()), format, id (cache id, NA when
not cached), files, description, path, url, sha256,
source.reference.panel, variant.space, available.local,
available.download, downloadable and availability. sha256 always
comes from the manifest, never from a cache row, because the stored
panel is the unpacked and tidied fileset and not the .tar.gz the
checksum measured. Reads the cache index; nothing is downloaded.
Method get()
Resolve one reference panel, materializing it into the cache when it is not there yet.
Usage
ReferencePanels$get(
name,
build = NULL,
format = NULL,
variant.space = NULL,
.execute = TRUE,
.status = polygenius.option.execution.status()
)
Arguments
name — Character scalar. Panel display name or internal key.
build — Character scalar build key/name, or NULL (default). NULL
accepts whichever build the inventory match supplies.
format — One of "pfile", "bfile", "vcf", or NULL (default).
NULL accepts whichever format the inventory match supplies.
variant.space — Character scalar variant-space name, or NULL
(default). When supplied, resolves the panel restricted to that variant
space, defaulting the target format to "pfile"; name must then be an
unrestricted panel and build must be given.
.execute — Logical scalar, default TRUE. When TRUE, run the
producing rules — downloading, converting, lifting over or restricting as
needed — so the panel is present in the cache before returning.
.status — One of "auto", "yes", "no"; default
polygenius.option.execution.status(), which is "yes". Execution-status
display mode for this call.
Returns
When .execute = TRUE, a GenotypeSource pointing at the cached
panel. When .execute = FALSE, a ResourceSpecSet describing what would
be produced, with nothing downloaded. Aborts when name is unknown and
build and format are not both given, when the filters match several
inventory rows and build and format are not both given, and — with
variant.space — when build is missing or name is already restricted.
Method add()
Register local genotype filesets as cached reference panels.
Usage
ReferencePanels$add(..., overwrite = FALSE)
Arguments
... — One or more GenotypeSource objects. A named argument uses its
name as the panel name; an unnamed one uses GenotypeSource$name.
overwrite — Logical scalar, default FALSE. When FALSE, an input
whose name + build + format is already cached aborts the whole call.
Returns
Invisibly, a ResourceSpec when one panel was added, otherwise a
list of them. Each panel is merged into a single fileset, tidied to its
own format with standardized variant IDs and chromosome format 26, and
written under <workspace$config$root>/reference.panel/<id>/ with a
store index entry. Aborts when no object is given, when an entry is not a
GenotypeSource, when a panel name is empty, or when two inputs share one
name + build + format.
Method remove()
Delete cached reference panels matching the given filters.
Usage
ReferencePanels$remove(name = NULL, build = NULL, format = NULL)
Arguments
name — Character scalar panel name or key, or NULL (default) to
match any name.
build — Character scalar build key/name, or NULL (default) to match
any build. An unrecognized build string aborts.
format — Character scalar format, or NULL (default) to match any
format.
Returns
NULL, invisibly. Deletes each matching resource directory under
<workspace$config$root>/reference.panel/ and its store index rows, and
reports the count. Called with no arguments it removes every cached
reference panel. The manifest is untouched, so a removed downloadable
panel still appears in view() and get() re-downloads it.
Method key()
Resolve a panel display name to its internal key.
Usage
ReferencePanels$key(name)
Arguments
name — Character scalar. Panel display name or internal key.
Returns
Character scalar internal key. Aborts when name matches no
inventory row and is not a well-formed restricted-panel key.
Method assert.unrestricted()
Assert that a panel is not already restricted to a variant space, the precondition for restricting it.
Usage
ReferencePanels$assert.unrestricted(name)
Arguments
name — Character scalar. Panel display name or internal key.
Returns
TRUE, invisibly. Aborts when name parses as a restricted-panel
key or its inventory row carries a source.reference.panel.
Method print()
Print the panel inventory, one line per entry, marking cached entries against downloadable ones.
Usage
ReferencePanels$print(...)
Arguments
... — Unused. Present for print-method compatibility.
Returns
self, invisibly.
Examples
workspace$catalogs$referencePanels$view()
panel <- workspace$catalogs$referencePanels$get("EUR", build = "hg19", format = "pfile")
workspace$catalogs$referencePanels$add(
my.panel = GenotypeSource(name = "eur", path = "/data/eur", format = "pfile", build = "hg19")
)
workspace$catalogs$referencePanels$remove(name = "my.panel")See Also
Other catalogs:
GenomeBuilds,
LDblocks,
LDs,
LiftoverChains,
VariantSpaces,
workspace_catalogs