FetchOpenGWASRule

OpenGWAS Fetch Rule

Description

FetchOpenGWASRule implements end-to-end OpenGWAS retrieval for gwas.sumstats outputs.

The rule:

  • validates runtime requirements (ieugwasr, JWT token, p-value threshold);

  • fetches and normalizes study metadata via ieugwasr::gwasinfo();

  • selects retrieval mode by threshold:

    • pval < 0.1: ieugwasr::tophits() (unclumped);

    • pval >= 0.1: ieugwasr::gwasinfo_files() + GWAS VCF download;

  • retries allowance-limited OpenGWAS calls when configured;

  • normalizes variants into PolyGenius canonical GWAS columns;

  • returns a PolyGeniusModel plus metadata required for cache matching.

Details

Reactive rule that materializes one gwas.sumstats resource from one OpenGWAS request.

Public methods provide rule integration points (matches, inputs, requirements, run). Retrieval, API handling, parsing, and normalization logic is implemented in ordered private helper methods to keep orchestration and parsing behavior explicit and testable.

Super class

PolyGenius::Rule -> FetchOpenGWASRule

Methods

Public methods

Inherited methods

Method new()

Initialize the OpenGWAS fetch rule instance.

Usage
FetchOpenGWASRule$new()
Returns

Invisible NULL.


Method matches()

Determine whether this rule can produce the requested output.

Usage
FetchOpenGWASRule$matches(output.spec)
Arguments
output.spec

Resource specification for the output candidate.

Returns

TRUE when output.spec is an OpenGWAS gwas.sumstats resource, otherwise FALSE.


Method inputs()

Build rule input specifications for one output.

Usage
FetchOpenGWASRule$inputs(output.spec)
Arguments
output.spec

Resource specification for the output candidate.

Returns

Named list with a single request input of type gwas.request.


Method requirements()

Report compute requirements for this rule.

Usage
FetchOpenGWASRule$requirements(output.spec, inputs)
Arguments
output.spec

Resource specification for the output candidate.

inputs

Bound input specs/values passed by the execution engine.

Returns

Named list with scheduler requirements (cores, memory).


Method run()

Execute OpenGWAS retrieval and return a normalized model.

Usage
FetchOpenGWASRule$run(output.spec, inputs, logger)
Arguments
output.spec

Resource specification for the output candidate.

inputs

Named list of bound rule inputs.

logger

Rule-scoped logger.

Returns

Rule result list containing data, meta, and logs.


Method clone()

The objects of this class are cloneable with this method.

Usage
FetchOpenGWASRule$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.