make_bim: Create a Plink BIM tibble

Description Usage Arguments Details Value See Also Examples

View source: R/make_bim.R

Description

This function simplifies the creation of Plink BIM-formatted tibbles, which autocompletes missing information if a partial tibble is provided, or generates a completely made up tibble if the number of individuals is provided. The default values are most useful for simulated genotypes, where IDs can be made up but must be unique, and there are no chromosomes, positions, or particular reference or alternative alleles.

Usage

1
make_bim(tib, n = NA)

Arguments

tib

The input tibble (optional). Missing columns will be autocompleted with reasonable values that are accepted by Plink and other external software. If missing, all will be autocompleted, but n is required.

n

The desired number of loci (rows). Required if tib is missing; otherwise it is ignored.

Details

Autocompleted column values:

Note that n is either given directly or obtained from the input tibble.

Value

The input tibble with autocompleted columns and columns in default order, or the made up tibble if only the number of individuals was provided. The output begins with the standard columns in standard order: chr, id, posg, pos, ref, alt. Additional columns in the input tibble are preserved but placed after the standard columns.

See Also

Plink BIM format reference: https://www.cog-genomics.org/plink/1.9/formats#bim

Examples

1
2
3
4
5
6
7
8
9
# create a synthetic tibble for 10 loci
# (most common use case)
bim <- make_bim(n = 10)

# manually create a partial tibble with only chromosomes defined
library(tibble)
bim <- tibble(chr = 0:2)
# autocomplete the rest of the columns
bim <- make_bim(bim)

genio documentation built on June 11, 2021, 5:12 p.m.