| bed_to_rasbin | R Documentation |
Converts a PLINK 1 binary fileset directly into the chunked .rasbin
format, without ever materializing a dense genotype matrix in R. Both the
read from .bed and the write to .rasbin are done in fixed-size
SNP chunks in C (see src/plink_io.c), so peak memory is
O(\text{n\_samples} \times \text{chunk\_snps}) regardless of how many
samples or SNPs the fileset contains.
bed_to_rasbin(bed_path, out_path, chunk_snps = 2000)
bed_path |
Character. Path to the |
out_path |
Character. Destination path for the |
chunk_snps |
Integer. Number of SNPs read from |
Only SNP-major .bed files are supported (the only mode any current
PLINK version writes). Genotype dosage counts copies of the A1 allele (the
fourth column of .bim), matching PLINK's own --recode A /
plink2's --export A convention: 2 = homozygous A1, 1 =
heterozygous, 0 = homozygous A2, NA = missing.
Unlike geno_to_rasbin (dtype 0, double, 8 bytes/genotype),
this writes dtype 1 (int8, 1 byte/genotype) – 8x smaller on disk, though
still ~4x larger than .bed's 2-bit packing (see src/rasbin.h
for why byte-per-genotype was chosen over bit-packing). Both dtypes are
read transparently by rasbin_read_chunk and every
_fast pipeline function.
Invisibly, the out_path that was written.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.