createHapMat: Create an object of class 'hapMat'

Description Usage Arguments Value Examples

View source: R/create_HapMat.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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)

perfectphyloR documentation built on March 8, 2021, 9:06 a.m.