sim_bim: Construct a variant table in plink BIM format with several...

View source: R/sim_bim.R

sim_bimR Documentation

Construct a variant table in plink BIM format with several chromosomes.

Description

Purpose is to build an artificial BIM table with several chromosomes, which some methods require, such as leave-one-chromosome-out (LOCO) estimation. This function produces chromosomes with approximately equal numbers of variants. Positions are spaced uniformly by a given size.

Usage

sim_bim(m_loci = 1e+05, n_chr = 22, pos_gap = 1000)

Arguments

m_loci

The number of loci.

n_chr

Number of chromosomes to simulate. Chromosome assignments are not biologically meaningful, as all loci are drawn independently (no LD).

pos_gap

The number of basepairs to space variants.

Value

A tibble with these columns:

  • chr: The constructed chromosome positions.

  • id: Locus ID values (autocompleted by genio::make_bim() to match row numbers).

  • posg: Genetic distance (autocompleted by genio::make_bim() to 0, all missing).

  • pos: locus positions, starting at pos_gap for each chromosome and increasing in increments of pos_gap.

  • ref: Reference allele (autocompleted by genio::make_bim() to 1).

  • alt: Alternative allele (autocompleted by genio::make_bim() to 2).

Examples

# simulate a small table
m_loci <- 100
bim <- sim_bim( m_loci )


OchoaLab/simgenphen documentation built on Feb. 10, 2023, 3:32 p.m.