Learn R Programming

gtx (version 0.0.7)

hapmap.read.haplotypes: Read hapmap haplotypes.

Description

Reads HapMap haplotypes and legend and stores in format expected by functions in gtx package.

Usage

hapmap.read.haplotypes(chr, path, sample = "CEU", release = 22)

Arguments

chr
chromosome to read
path
path to local mirror of ftp://ftp.ncbi.nlm.nih.gov/hapmap
sample
a HapMap sample, e.g. CEU or YRI
release
a HapMap release version, currently must be 21 or 22

Details

You need a local mirror of HapMap data. To build this use e.g. a shell command rsync ftp://ftp.ncbi.nlm.nih.gov/hapmap ~ then use an argument path="~/hapmap" for this function call.

Technically the local mirror only needs the contents of ftp://ftp.ncbi.nlm.nih.gov/hapmap/phasing/2006-07_phaseII/phased/ and ftp://ftp.ncbi.nlm.nih.gov/hapmap/phasing/2007-08_rel22/phased/

Other gtx functions expect to be passed a list with 22 elements; one for each chromosome. See the examples.

Examples

Run this code
## chromosomes 1-22
hapmap <- lapply(1:22, hapmap.read.haplotypes, path = "~/hapmap")

## selected chromosomes only
hapmap <- lapply(1:22, function() return(NULL))
for (chr in c(1, 11, 17)) {
  hapmap[[chr]] <- hapmap.read.haplotypes(chr, path = "~/hapmap")
}

Run the code above in your browser using DataLab