Skip to contents

Writes a site profile (output of fitOutcomeModel) to human-readable CSV files: one for the profile log-likelihood grid, one for site metadata, a pair of allele-score definition files (weights plus the aggregate score association), and optionally one for per-SNP estimates. These CSV files are the artifacts shared between sites and the coordinator in a federated Medusa analysis.

CSV is used instead of binary formats so that every value leaving a site is human-readable and auditable.

Usage

exportSiteProfile(profile, outputDir = ".", prefix = "medusa")

Arguments

profile

A site profile object (output of fitOutcomeModel).

outputDir

Character. Directory to write files to. Default is current working directory.

prefix

Character. Filename prefix. Default is "medusa".

Value

A named character vector with the paths to the written files (invisibly).

Examples

simData <- simulateMRData(n = 500, nSnps = 3, trueEffect = 0.3)
profile <- fitOutcomeModel(
  cohortData = simData$data,
  covariateData = NULL,
  instrumentTable = simData$instrumentTable,
  betaGrid = seq(-2, 2, by = 0.1),
  siteId = "example_site"
)
#> Fitting outcome model at site 'example_site' (281 cases, 219 controls)...
#> Site 'example_site': beta_ZY_hat = 0.3486 (SE = 0.2158).
if (FALSE) { # \dontrun{
exportSiteProfile(profile, outputDir = tempdir())
} # }