Learn R Programming

pedtools (version 2.8.2)

setSNPs: Attach SNP loci to a pedigree

Description

Create and attach a list of empty SNP markers with specified position and allele frequencies.

Usage

setSNPs(x, snpData)

Value

A copy of x with the indicated SNP markers attached.

Arguments

x

A ped object.

snpData

A data frame with at least 6 columns. See Details.

Details

The first 6 columns of snpData should be as follows, in order. (The column names do not matter.)

  • CHROM: Chromosome (character)

  • MARKER: Marker name (character)

  • MB: Physical position in megabases (numeric)

  • A1: First allele (single-letter character)

  • A2: Second allele (single-letter character)

  • FREQ1: Allele frequency of A1 (number in [0,1])

Each column must be of the stated type, or coercible to it. (For example, CHROM, A1 and A2 may be given as numbers, but will be internally converted to characters.)

Subsequent columns are assumed to contain genotypes. These columns must be named with the IDs matching individuals in x. The genotypes must use the alleles given in A1 and A2, and can be formatted with or without separator, e.g. A/C or AC.

Examples

Run this code

snps = data.frame(
  CHROM  = 1:2,
  MARKER = c("M1", "M2"),
  MB     = c(1.23, 2.34),
  A1     = c("A", "G"),
  A2     = c("C", "C"),
  FREQ1  = c(0.7, 0.12),
  `2`    = c("A/C", "G/C"),
  check.names = FALSE)       # Note: `check.names = FALSE`!

x = setSNPs(nuclearPed(), snpData = snps)
x

# Inspect the results:
getMap(x)
getFreqDatabase(x)

Run the code above in your browser using DataLab