Type: Package
Title: From 'PLINK' to 'HIrisPlex'
Version: 0.1.0
Maintainer: Andrea Giardina <andrea.giardina1@open.ac.uk>
Description: Read 'PLINK' 1.9 binary datasets (BED/BIM/FAM) and generate the CSV files required by the Erasmus MC 'HIrisPlex' / 'HIrisPlex-S' webtool https://hirisplex.erasmusmc.nl/. 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.
License: MIT + file LICENSE
URL: https://github.com/adhikari-statgen-lab/hirisplexr
BugReports: https://github.com/adhikari-statgen-lab/hirisplexr/issues
Depends: R (≥ 3.6)
Imports: BEDMatrix, data.table, utils
Suggests: testthat (≥ 3.0.0), knitr, rmarkdown
Config/testthat/edition: 3
Encoding: UTF-8
RoxygenNote: 7.3.2
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2025-10-28 10:46:01 UTC; agiardina
Author: Andrea Giardina ORCID iD [aut, cre]
Repository: CRAN
Date/Publication: 2025-10-31 18:20:17 UTC

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,
  out,
  panel = c("hirisplexs", "hirisplex", "irisplex"),
  sample_id = c("IID", "FID_IID"),
  allow_strand_flip = TRUE
)

Arguments

prefix

Character. Path prefix to PLINK files, without extension.

out

Character. Output CSV path.

panel

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

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", tempfile(fileext = ".csv"), panel = "hirisplexs")

## End(Not run)

mirror server hosted at Truenetwork, Russian Federation.