check_bed_table: Check if a '.bed' table is valid.

View source: R/check_bed_table.R

check_bed_tableR Documentation

Check if a .bed table is valid.

Description

Check if a .bed table is valid. Will stop if not

Usage

check_bed_table(bed_table)

Arguments

bed_table

a table that maps the SNPs to the individuals, of which the column names are the names of the individuals, the row names are the names of the SNPs, and the values are the SNP variant. Use get_test_bed_table to get a .bed table as used in testing. Use read_plink_bed_file to read a PLINK .bed file. Use check_bed_table to test if a .bed table is valid. See also the bed file format reference at https://www.cog-genomics.org/plink2/formats#bed

Details

The class of a bed_table must be:

  • matrix: on older versions of R, probably before v4.0

  • c(matrix, array): on newer versions of R, probably from v4.0

Value

a checked bed_table, now of class bed_table

Author(s)

Richèl J.C. Bilderbeek

Examples

# Simple .bed table
check_bed_table(get_test_bed_table())

# Read a .bed table from file, one needs a .bim and .fam for that as well
bim_table <- read_plink_bim_file(get_plinkr_filename("toy_data.bim"))
fam_table <- read_plink_fam_file(get_plinkr_filename("toy_data.fam"))
bed_table <- read_plink_bed_file(
  bed_filename = get_plinkr_filename("toy_data.bed"),
  names_loci = bim_table$id,
  names_ind = fam_table$id
)
check_bed_table(bed_table)

richelbilderbeek/plinkr documentation built on March 25, 2024, 3:18 p.m.