importHaplo {AlphaSimR}R Documentation

Import haplotypes

Description

Formats haplotype in a matrix format to an AlphaSimR population that can be used to initialize a simulation. This function serves as wrapper for newMapPop that utilizes a more user friendly input format.

Usage

importHaplo(haplo, genMap, ploidy = 2L, ped = NULL)

Arguments

haplo

a matrix of haplotypes

genMap

genetic map as a data.frame. The first three columns must be: marker name, chromosome, and map position (Morgans). Marker name and chromosome are coerced using as.character. See importGenMap

ploidy

ploidy level of the organism

ped

an optional pedigree for the supplied genotypes. The first three columns must be: id, mother, and father. All values are coerced using as.character.

Value

a MapPop-class if ped is NULL, otherwise a NamedMapPop-class

Examples

haplo = rbind(c(1,1,0,1,0),
              c(1,1,0,1,0),
              c(0,1,1,0,0),
              c(0,1,1,0,0))
colnames(haplo) = letters[1:5]

genMap = data.frame(markerName=letters[1:5],
                    chromosome=c(1,1,1,2,2),
                    position=c(0,0.5,1,0.15,0.4))

ped = data.frame(id=c("a","b"),
                 mother=c(0,0),
                 father=c(0,0))

founderPop = importHaplo(haplo=haplo, 
                         genMap=genMap,
                         ploidy=2L,
                         ped=ped)


[Package AlphaSimR version 1.3.2 Index]