Package 'hirisplexr'

Title: From PLINK to HIrisPlex
Description: Read PLINK 1.9 binary datasets (BED/BIM/FAM) and generate the CSV files required by the Erasmus MC HIrisPlex / HIrisPlex-S webtool. It maps PLINK alleles to the webtool's required 'rsID_Allele' columns (0/1/2/NA). No external tools (e.g., PLINK CLI) are required.
Authors: Andrea Giardina [aut, cre]
Maintainer: Andrea Giardina <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2026-06-07 06:36:27 UTC
Source: https://github.com/adhikari-statgen-lab/hirisplexr

Help Index


Write HIrisPlex / HIrisPlex-S CSV from a PLINK BED/BIM/FAM prefix

Description

Given a PLINK 1.9 binary dataset (prefix.bed/.bim/.fam), this function produces a CSV ready to upload to the HIrisPlex(-S) webtool.

Usage

write_hirisplex_csv(
  prefix,
  panel = c("hirisplexs", "hirisplex", "irisplex"),
  out = NULL,
  sample_id = c("IID", "FID_IID"),
  allow_strand_flip = TRUE
)

Arguments

prefix

Character. Path prefix to PLINK files, without extension.

panel

Character. One of "hirisplexs" (default), "hirisplex", "irisplex".

out

Character. Output CSV path. Defaults to ⁠<panel>.csv⁠ in the working directory.

sample_id

Character. How to form 'SampleID': "IID" or "FID_IID". Default is "IID".

allow_strand_flip

Logical. If TRUE, attempt to match the required allele by allowing strand complements.

Details

Columns are 'SampleID' followed by one column per required SNP in the form rsID_Allele (e.g., rs12203592_T). Each cell contains 0/1/2 (count of the input allele) or NA when the SNP is missing. The column set and order are defined by the selected panel (IrisPlex, HIrisPlex, HIrisPlex-S).

Allele counting is based on the PLINK .bim alleles. Genotype dosage is read on demand from the .bed using BEDMatrix::BEDMatrix(), which encodes the dosage of the first allele in the .bim file (A1). If the webtool's required input allele equals A1, we use the dosage directly; if it equals A2, we use (2 - dosage). If allow_strand_flip = TRUE, we also reconcile complements (A<->T, C<->G) to account for strand orientation differences.

Value

(Invisibly) the output file path.

Examples

## Not run: 
write_hirisplex_csv("/path/to/prefix", panel = "hirisplexs")

## End(Not run)