haplomatrix.class: Class 'haplomatrix'

Description Usage Arguments Details See Also Examples

Description

Class representing a haplo matrix

Usage

1
2
3
4
5
6
## S3 method for class 'haplomatrix'
print(x, ...)
## S3 method for class 'haplomatrix'
str(object, ...)
## S3 method for class 'haplomatrix'
as.matrix(x, ...)

Arguments

x,object

a compressed (SNP x Individuals) matrix

...

see print, str for their options. The command as.matrix has the following options

indiv

vector of integer, indicating individuals to be extracted

sets

value 1, 2 or 1:2. Indicates the chromosome set to be returned. Default:1:2

IndividualsPerColumn
\ipc

Default: TRUE

DoubledIndividuals
\dindiv

Default: TRUE

Details

Since the haplo matrix takes only the values 0 and 1, haplomatrix uses a one bit compressed storing mode. A haplomatrix can quickly be transformed into a genomicmatrix (by exactly this command) in case of the default two-bit coding, e.g. RFoptions(snpcoding=Shuffle).

See Also

genomicmatrix-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
set.seed(0)
indiv <- 5
loci <- 4
M <- matrix(sample(0:1, 2 * indiv * loci, replace=TRUE), nrow = loci)
str(M)

GM <- haplomatrix(M)
print(GM)
str(GM)
print(as.matrix(GM))
print(as.matrix(GM, indiv=2:4, sets=1))
stopifnot(sum(abs(as.matrix(GM) - M)) == 0)

miraculix documentation built on Sept. 22, 2021, 5:07 p.m.