Contents
workspace$catalogs$liftoverChains
Liftover chain catalog
Inventory of the UCSC-style chain files used to convert coordinates between
genome builds, keyed by (from, to) build pair. Reached as
workspace$catalogs$liftoverChains.
Details
view() and get() see the union of the read-only manifest shipped as
inst/extdata/manifest.liftoverChains.csv and whatever is already cached under
<workspace$config$root>/liftover.chain/. add() and remove() touch the
cache only; the manifest is never written.
A chain is never derived from another chain — a pair the manifest does not
ship has no producing rule and cannot be resolved unless it is added locally.
The stored form is always a plain, uncompressed chain.chain, whichever door
it arrived through, so a repeated get() reads the cache and downloads
nothing.
Methods
Public methods
LiftoverChains$new()LiftoverChains$view()LiftoverChains$get()LiftoverChains$add()LiftoverChains$remove()LiftoverChains$print()
Method new()
Read the liftover-chain manifest and build the catalog.
Usage
LiftoverChains$new(manifest.path = NULL)
Arguments
manifest.path — Character scalar path to a manifest CSV, or NULL
(default). NULL reads inst/extdata/manifest.liftoverChains.csv from
the installed package. The CSV must carry from, to, url and
sha256 columns.
Returns
A new LiftoverChains object. Aborts when the manifest file is
absent or is missing any required column.
Method view()
List every chain that is cached locally or downloadable.
Usage
LiftoverChains$view()
Returns
A data.frame, one row per from + to pair, sorted by those two
columns, with columns from and to (as display labels from
genomeBuilds$label()), id (cache id, NA when not cached), path,
url, sha256, available.local, downloadable and availability.
sha256 always comes from the manifest, never from a cache row, because
the stored chain is the decompressed file and not the .chain.gz the
checksum measured. Reads the cache index; nothing is downloaded.
Method get()
Resolve every chain matching the filters, downloading any that is not cached yet.
Usage
LiftoverChains$get(
from = NULL,
to = NULL,
.execute = TRUE,
.status = polygenius.option.execution.status()
)
Arguments
from — Character scalar source build key/name, or NULL (default) to
match any source build.
to — Character scalar target build key/name, or NULL (default) to
match any target build.
.execute — Logical scalar, default TRUE. When TRUE, run the
download rule so each matched chain 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 chain matched, a named list
with one element, path, the cached uncompressed chain.chain; 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 a build string is unrecognized.
Method add()
Register a local chain file as a cached chain.
Usage
LiftoverChains$add(from, to, path, overwrite = FALSE)
Arguments
from — Character scalar source build key/name.
to — Character scalar target build key/name.
path — Character scalar path to an existing chain file, plain or
gzipped.
overwrite — Logical scalar, default FALSE. When FALSE, an already
cached from + to pair aborts the call.
Returns
A ResourceSpec, invisibly. Decompresses the file if needed and
writes it atomically as
<workspace$config$root>/liftover.chain/<id>/chain.chain with a store
index entry — the same identity and the same stored form a downloaded
chain gets. Aborts when path does not exist, when the stored file is
empty, or when it carries no chain header line.
Method remove()
Delete cached liftover chains matching the given filters.
Usage
LiftoverChains$remove(from = NULL, to = NULL)
Arguments
from — Character scalar source build key/name, or NULL (default) to
match any source build. An unrecognized build string aborts.
to — Character scalar target build key/name, or NULL (default) to
match any target build.
Returns
NULL, invisibly. Deletes each matching resource directory under
<workspace$config$root>/liftover.chain/ and its store index rows, and
reports the count. Called with no arguments it removes every cached
chain. The manifest is untouched, so a removed downloadable chain still
appears in view() and get() re-downloads it.
Method print()
Print the chain inventory, one line per pair, marking cached entries against downloadable ones.
Usage
LiftoverChains$print(...)
Arguments
... — Unused. Present for print-method compatibility.
Returns
self, invisibly.
Examples
workspace$catalogs$liftoverChains$view()
chain <- workspace$catalogs$liftoverChains$get(from = "hg19", to = "hg38")
workspace$catalogs$liftoverChains$add("hg19", "hg38", path = "/data/hg19ToHg38.over.chain.gz")
workspace$catalogs$liftoverChains$remove(from = "hg19", to = "hg38")See Also
Other catalogs:
GenomeBuilds,
LDblocks,
LDs,
ReferencePanels,
VariantSpaces,
workspace_catalogs