MoBPS: Functions designed for the R package 'MoBPS'

Description Usage Arguments Value Examples

Description

The functions below have been written mainly for use in the package MoBPS written by Torsten Pook.

codeOrigins compresses information about generation of introduced new genes, sex, number of individuals and haplotype in a single 32 Bit integer value.

decodeOrigins make the compressed data human readable again.

computeSNPS extracts from a coded, complete breeding scheme an individuum defined by its generation, sex and number within its cohort.

compute essentially concatenates (efficiently) the three commands computeSNPS, relationshipMatrix, solveRelMat

Usage

1
2
3
4
5
6
codeOrigins(M)
decodeOrigins(CM, row)
computeSNPS(population, gen, sex, nr, from_p = 1, to_p = Inf,
           output_compressed=FALSE, select = NULL, what = c("geno", "haplo"))
compute(population, gen, sex, nr, tau, vec, betahat, select = NULL,
        matrix.return=FALSE)

Arguments

M

matrix with information on generation of introduced new genes, sex, number of individual and haplotype on each line. the generation takes values in 1...2^6, sex values in 1...2^1, individual values in 1...2^22 and the haplotype values in 1...2^3

CM

a vector obtained from coding a matrix by codeOrigins

row

integer. Row number of the matrix M or CM to be decoded.

population

list of list, as described in package MoBPs, which contains the whole information of all generations of a breeding scheme

gen,sex,nr

information specifying an individuum; instead of the three argument, only gen might be given, which is matrix of three columns then.

from_p, to_p

loci between which the genomic information of the specified individuum is extracted. Default: whole genomic information

output_compressed

logical. If FALSE the output is human readable

select

integer vector. List of loci that should be returned; the loci might be further restricted by from_P and to_p.

what

The type of information that should be extracted and returned

tau,vec,betahat

see solveRelMat

matrix.return

logical. If TRUE also the relationship matrix is returned.

Value

codeOrigins : a vector with length equal to the number of rows of M.

decodeOrigins : an integer vector of 4 components.

computeSNPS : vector of integers with either human readable values or compressed data depending on the argument what.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
 
set.seed(0)
n <- sample(1000, 1)
M <- cbind(sample(1:2^6, n, replace=TRUE),
           sample(1:2^1, n, replace=TRUE),
           sample(1:2^22, n, replace=TRUE),
           sample(1:2^3, n, replace=TRUE))
print(head(M))
Z <- matrix(NA, ncol=ncol(M), nrow=nrow(M))
CM <- codeOrigins(M)
print(head(CM))
for (i in 1:nrow(M))  Z[i, ] <- decodeOrigins(CM, i)
stopifnot(all(M == Z))

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

Related to MoBPS in miraculix...