Contents
FetchPGSCatalogRule
Fetch PGS Catalog Rule
For each requested pgs.catalog.model spec the rule:
- fetches full score metadata from
GET /rest/score/{pgs_id}/; - selects the best available scoring file (GRCh38 harmonised -> GRCh37 harmonised -> original) and downloads it via
pg.download(); - parses the gzipped TSV, normalising column names for both harmonised and original file layouts;
- splits REST metadata into
$gwas(discovery phenotype / sample info) and$generation(PRS method / publication provenance); - returns a
PGSwhosebuildis the canonical name (genomeBuilds$name()) of the downloaded file's build; a file written from it declaresGRCh37orGRCh38.
Details
Reactive rule that materialises one pgs.catalog.model resource from the
PGS Catalog REST API.
Super class
PolyGenius::Rule -> FetchPGSCatalogRule
Methods
Public methods
FetchPGSCatalogRule$new()FetchPGSCatalogRule$matches()FetchPGSCatalogRule$inputs()FetchPGSCatalogRule$requirements()FetchPGSCatalogRule$run()FetchPGSCatalogRule$clone()
Method new()
Register this rule under the name "fetch.pgs.catalog".
Usage
FetchPGSCatalogRule$new()
Method matches()
Accept only pgs.catalog.model output specs.
Usage
FetchPGSCatalogRule$matches(output.spec)
Arguments
output.spec — Resource output spec list with a $type field.
Returns
TRUE when type is resources.type$pgs.catalog.model.
Method inputs()
This rule has no upstream dependencies -- PGS Catalog is fetched directly.
Usage
FetchPGSCatalogRule$inputs(output.spec)
Arguments
output.spec — Resource output spec (unused; kept for interface parity).
Returns
Empty list.
Method requirements()
Declare lightweight resource requirements. Scoring files can be large (>50 MB harmonised) but processing is single-threaded and memory-light.
Usage
FetchPGSCatalogRule$requirements(output.spec, inputs)
Arguments
output.spec — Resource output spec (unused).
inputs — Empty list from inputs() (unused).
Returns
Named list: cores = 1, memory = 1.
Method run()
Orchestrate metadata fetch, scoring file download, parsing, and PGS construction for one PGS Catalog accession.
Usage
FetchPGSCatalogRule$run(output.spec, inputs, logger = pg.logger())
Arguments
output.spec — Resource output spec; $params$pgs.id gives the accession.
inputs — Empty list (no upstream resources required).
logger — Rule-scoped logger for trace/info messages.
Returns
Named list: spec, data (PGS), meta, logs.
Method clone()
The objects of this class are cloneable with this method.
Usage
FetchPGSCatalogRule$clone(deep = FALSE)
Arguments
deep — Whether to make a deep clone.
See Also
Other source-rules:
FetchGWASCatalogRule,
FetchOpenGWASRule,
LoadLocalGWASRule