geno: Manipulating Compressed Matrices

Description Usage Arguments Value See Also Examples

Description

copyGeno copies a coded SNP matrix zeroNthGeno writes zeros into selected rows of a coded SNP matrix fillGeno allows to fill (or replace) colums of a compressed (snps \times indiv) matrix.

Usage

1
2
3
4
fillGeno(SNPxIndiv, indiv, values, IndividualsPerColumn=TRUE,
         DoubledIndividuals=TRUE)
copyGeno(SNPxIndiv)
zeroNthGeno(SNPxIndiv, snps)

Arguments

SNPxIndiv

a compressed SNP (genotype) vector or matrix, obtained from genomicmatrix or haplomatrix

indiv

integer vector. It gives the columns of the (SNP \times Indiv) matrix that has to be filled with values

values

coded or uncoded vector or matrix of haplotype or genotypes.

snps

vector of integers, which gives the selected rows. If missing all rows are selected.

IndividualsPerColumn \ipc
DoubledIndividuals \dindiv

Value

All functions return a compressed SNP matrix of class genomicmatrix.

See Also

genomicmatrix-class

vectorGeno for multiplying a vector from the left

genoVector for multiplying a vector from the right

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
 
require(RandomFieldsUtils)
set.seed(0)

indiv <- sample(1000, 1)
snps <- indiv * 2^sample(7,1)
M <- matrix(nrow = snps, sample(0:2, snps * indiv, replace=TRUE))
storage.mode(M) <- sample(c("integer", "double"), 1)
CM <- genomicmatrix(M)
str(CM)
Z <- as.matrix(CM)
Print(M, CM, Z)
stopifnot(all(M == Z))

N <- sample(snps, snps / 4)
Z1 <- as.matrix(CM, snps=N)
stopifnot(all(M[N, ] == Z1))

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

Related to geno in miraculix...