To scan a huge BED one varant at time without reading it into the memoty, see
scanBED
instead.
A BED (binary biallelic genotype table) is comprised of three files
(usually) sharing identical prefix:
pfx.fam: table of N typed individuals
pfx.bim: table of P typed genomic variants (i.e., SNPs);
pfx.bed: genotype matrix of N rows and P columns stored in condensed
binary format.
The three files are commonly referred by their common prefix, e.g.:
chrX.bed, chrX.fam, and chrX.bim, are jointly specified by "chrX".