Learn R Programming

perfectphyloR (version 0.2.1)

createHapMat: Create an object of class hapMat

Description

This function creates a hapMat data object, a required input for reconstructPP.

Usage

createHapMat(hapmat, snvNames, hapNames, posns)

Arguments

hapmat

A matrix of 0's and 1's, with rows representing haplotypes and columns representing single-nucleotide variants (SNVs).

snvNames

A vector of names of SNVs for the columns of hapmat.

hapNames

A vector of names of haplotypes for the rows of hapmat.

posns

A numeric vector specifying the genomic positions (e.g. in base pairs) of SNVs in the columns of hapmat.

Value

An object of class hapMat.

Examples

Run this code
# NOT RUN {
hapmat = matrix(c(1,1,1,0,
                  0,0,0,0,
                  1,1,1,1,
                  1,0,0,0,
                  1,1,0,0,
                  1,0,0,1,
                  1,0,0,1), byrow = TRUE, ncol = 4)
snvnames = c(paste("SNV", 1:4, sep = ""))
allhaps = c("h1", "h2", "h3", "h4", "h5", "h6", "h7")
# Physical positions
posns = c(1000, 2000, 3000, 4000)

# Create hapMat data object
ex_hapMat <- createHapMat(hapmat = hapmat,
                               snvNames = snvnames,
                               hapNames = allhaps,
                               posns = posns)


# }

Run the code above in your browser using DataLab