segBreedComp: Calculates the Segment-Based Breed Composition of Individuals

Description Usage Arguments Details Value Author(s) Examples

Description

Calculates the segment based Breed Composition: For every individual the breed composition is estimated, including the genetic contribution from native ancestors.

Usage

1
segBreedComp(Native, map, unitP="Mb")

Arguments

Native

This parameter is either

(1) Mx(2N) logical matrix, with TRUE, if the segment containing the SNP is considered native, and FALSE otherwise. The row names are the marker names, and the non-unique column names are the IDs of the individuals. The matrix is typically computed from component freq of the output from function haplofreq.

or

(2) Mx(2N) character matrix, with components being the first characters of the names of the breeds in which the respective segment has maximum frequency. Segments considered native are coded as '1'. The row names are the marker names, and the non-unique column names are the IDs of the individuals. The matrix is typically component match from the output of function haplofreq.

or

(3) Vector with file names. The files contain for every SNP and for each haplotype 1 if the segment containing the SNP is considered native. Otherwise it is the first letter of the name of the breed in which the segment has maximum frequency. These files are typically created by function haplofreq. There is one file per chromosome and file names must contain the chromosome name as specified in the map in the form "ChrNAME.", e.g. "Breed2.Chr1.nat".

map

Data frame providing the marker map with columns including marker name 'Name', chromosome number 'Chr', and possibly the position on the chromosome in Mega base pairs 'Mb', and the position in centimorgan 'cM'. The markers must be in the same order as in in Native.

unitP

The unit for measuring the proportion of the genome included in native segments. Possible units are the number of marker SNPs included in shared segments ('SNP'), the number of Mega base pairs ('Mb'), and the total length of the shared segments in centimorgan ('cM'). In the last two cases the map must include columns with the respective names.

Details

For every individual the breed composition is computed, including the genetic contribution from native ancestors (native contribution). The native contribution is the proportion of the genome belonging to segments whose frequency is smaller than a predefined value in all other breeds.

Additionally, for each introgressed breed, the proportion of the genome of each individual is computed that is non-native and has maximum frequency in the respective breed (not if option (1) is used).

Value

Data frame with the number of rows being the number of individuals. The columns are

Indiv

IDs of the individuals,

native

Genetic contributions from native ancestors,

...

Contributions from other breeds.

Author(s)

Robin Wellmann

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
data(map)
data(Cattle)
dir     <- system.file("extdata", package = "optiSel")
GTfiles <- file.path(dir, paste("Chr", unique(map$Chr), ".phased", sep=""))
Haplo   <- haplofreq(GTfiles, Cattle, map, thisBreed="Angler", minSNP=20, minL=1.0)
Comp    <- segBreedComp(Haplo$freq<0.01, map)
mean(Comp$native)
#[1] 0.3853432

Comp <- segBreedComp(Haplo$match, map)
apply(Comp[, -1], 2, mean)

## Reading native segments from files:
## Not run: 
wdir <- file.path(tempdir(), "HaplotypeEval")
file <- haplofreq(GTfiles, Cattle, map, thisBreed="Angler", minSNP=20, 
           minL=1.0, ubFreq=0.01, what="match", w.dir=wdir)
Comp <- segBreedComp(file$match, map)
head(Comp)

apply(Comp[, -1], 2, mean)
#    native          F          H          R 
#0.38534317 0.05503451 0.25986508 0.29975724 

#unlink(wdir, recursive = TRUE)

## End(Not run)

Example output

Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 
Using  skip = 2 
Using cskip = 2 
Reading chromosome  1 ...  M=400, Reference breeds: Holstein Fleckvieh Rotbunt
Reading chromosome  2 ...  M=400, Reference breeds: Holstein Fleckvieh Rotbunt
[1] 0.3853432
    native          F          H          R 
0.38534317 0.05503451 0.25986508 0.29975724 
Using  skip = 2 
Using cskip = 2 
Reading chromosome  1 ...  M=400, Reference breeds: Holstein Fleckvieh Rotbunt
Reading chromosome  2 ...  M=400, Reference breeds: Holstein Fleckvieh Rotbunt
                          Indiv    native          F          H          R
276000101676415 276000101676415 0.5805690 0.04350355 0.09210077 0.28382667
276000108612636 276000108612636 0.5687157 0.05422010 0.23299123 0.14407301
276000102372349 276000102372349 0.7418098 0.11696660 0.08176129 0.05946229
276000102379430 276000102379430 0.4045441 0.07099278 0.22897425 0.29548890
276000108826036 276000108826036 0.2239983 0.03464184 0.24507315 0.49628674
276000111902076 276000111902076 0.2458519 0.05072812 0.25124139 0.45217861
    native          F          H          R 
0.38534317 0.05503451 0.25986508 0.29975724 
Warning message:
system call failed: Cannot allocate memory 

optiSel documentation built on Jan. 16, 2021, 5:30 p.m.