Contents
workspace$catalogs$LDblocks
LD block boundary catalog
Inventory of approximately-independent LD block boundary sets
(Berisa & Pickrell), keyed by population and genome build. Reached as
workspace$catalogs$LDblocks. These are boundary BED files, not built LD
matrices — for those see LDs.
Details
view() and get() see the union of the read-only manifest shipped as
inst/extdata/manifest.LDblocks.csv and whatever is already cached under
<workspace$config$root>/ld.block.boundaries/. add() and remove() touch
the cache only; the manifest is never written.
A set the manifest does not ship for a build can be derived by lifting the
same population over from another build, and the derived set is cached under
its own identity, so a repeated get() reads the cache and downloads nothing.
The stored form is always the same, whichever door a set arrived through: a
headerless tab-separated blocks.bed of chr/start/end, autosomes only,
sorted, and a gapless per-chromosome partition.
Methods
Public methods
LDblocks$new()LDblocks$view()LDblocks$get()LDblocks$add()LDblocks$remove()LDblocks$print()
Method new()
Read the LD block boundary manifest and build the catalog.
Usage
LDblocks$new(manifest.path = NULL)
Arguments
manifest.path — Character scalar path to a manifest CSV, or NULL
(default). NULL reads inst/extdata/manifest.LDblocks.csv from the
installed package. The CSV must carry population, build, url,
sha256 and description columns.
Returns
A new LDblocks object. Aborts when the manifest file is absent
or is missing any required column.
Method view()
List every block set that is cached locally or downloadable.
Usage
LDblocks$view()
Returns
A data.frame, one row per population + build, sorted by those
two columns, with columns population, build (as a display label from
genomeBuilds$label()), id (cache id, NA when not cached), path,
url, sha256, description, available.local, downloadable and
availability. sha256 always comes from the manifest, never from a
cache row, because the stored file is the harmonized partition and not
the published BED the checksum measured. Reads the cache index; nothing
is downloaded.
Method get()
Resolve every block set matching the filters, materializing any that is not cached yet.
Usage
LDblocks$get(
population = NULL,
build = NULL,
.execute = TRUE,
.status = polygenius.option.execution.status()
)
Arguments
population — Character scalar population code (e.g. "EUR"),
uppercased before matching, or NULL (default) to match any population.
build — Character scalar build key/name, or NULL (default) to match
any build.
.execute — Logical scalar, default TRUE. When TRUE, run the
producing rules — downloading or lifting over as needed — so each matched
set 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 and exactly one set matched, a named list
with one element, path, the cached blocks.bed; when several matched, a
list of such lists. When .execute = FALSE, a ResourceSpecSet, with
nothing downloaded. Aborts when no inventory row matches the filters, or
when the build string is unrecognized.
Method add()
Register a local block-boundary BED file as a cached set.
Usage
LDblocks$add(population, build, path, overwrite = FALSE)
Arguments
population — Character scalar population code (e.g. "EUR"),
uppercased before use.
build — Character scalar build key/name.
path — Character scalar path to an existing BED file, plain or
gzipped. A chr start stop header row and chr-prefixed names are both
accepted.
overwrite — Logical scalar, default FALSE. When FALSE, an already
cached population + build aborts the call.
Returns
A ResourceSpec, invisibly. Harmonizes the file — autosomes only,
sorted, coerced to a gapless per-chromosome partition — and writes it as
<workspace$config$root>/ld.block.boundaries/<id>/blocks.bed with a store
index entry, the same identity and stored form a downloaded set gets.
Aborts when path does not exist or is empty, when a row has fewer than
three whitespace-separated fields, when no usable autosomal block
survives, or when the result is not a non-overlapping partition.
Method remove()
Delete cached block-boundary sets matching the given filters.
Usage
LDblocks$remove(population = NULL, build = NULL)
Arguments
population — Character scalar population code, or NULL (default) to
match any population.
build — Character scalar build key/name, or NULL (default) to match
any build. An unrecognized build string aborts.
Returns
NULL, invisibly. Deletes each matching resource directory under
<workspace$config$root>/ld.block.boundaries/ and its store index rows,
and reports the count. Called with no arguments it removes every cached
block set. The manifest is untouched, so a removed downloadable set still
appears in view() and get() re-downloads it.
Method print()
Print the block-boundary inventory, one line per entry, marking cached entries against downloadable ones.
Usage
LDblocks$print(...)
Arguments
... — Unused. Present for print-method compatibility.
Returns
self, invisibly.
Examples
workspace$catalogs$LDblocks$view()
blocks <- workspace$catalogs$LDblocks$get(population = "EUR", build = "hg19")
workspace$catalogs$LDblocks$add("EUR", "hg19", path = "/data/fourier_ls-all.bed")
workspace$catalogs$LDblocks$remove(population = "EUR")See Also
Other catalogs:
GenomeBuilds,
LDs,
LiftoverChains,
ReferencePanels,
VariantSpaces,
workspace_catalogs