segIBDatN {optiSel} | R Documentation |
Segment-Based Kinship at Native Alleles.
Description
Calculates the kinship at native alleles, which is the segment based probability of native alleles to be IBD.
Usage
segIBDatN(files, phen, map, thisBreed, refBreeds="others", ubFreq=0.01, minSNP=20,
unitP="Mb", minL=1.0, unitL="Mb", a=0.0, keep=NULL, lowMem=TRUE,
skip=NA, cskip=NA, cores=1, quiet=FALSE)
Arguments
files |
This can be a character vector with names of the phased marker files, one file for each chromosome.
Alternatively a) b) c) File names must contain the chromosome name as specified in the |
phen |
Data frame containing the ID (column |
map |
Data frame providing the marker map with columns including marker name |
thisBreed |
Breed name: Results will be computed for individuals from |
refBreeds |
Vector containing names of genotyped breeds. A segment is considered native if its frequency is smaller than |
ubFreq |
A segment is considered native if its frequency is smaller than |
minSNP |
Minimum number of marker SNPs included in a segment. |
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 ( |
minL |
Minimum length of a segment in |
unitL |
The unit for measuring the length of a segment. Possible units are the number of marker SNPs included in the segment ( |
a |
The function providing the weighting factor for each segment is w(x)=x*x/(a+x*x). The parameter of the function is the length of the segment in |
keep |
Subset of the IDs of the individuals from data frame |
lowMem |
If |
skip |
Take line |
cskip |
Take column |
cores |
Number of cores to be used for parallel processing of chromosomes. By default one core is used. For |
quiet |
Should console output be suppressed? |
Details
Calculates a list containing matrices needed to compute segment based kinships at native alleles, defined as the conditional probability that two randomly chosen alleles are IBD, given that both originate from native ancestors. An allele is considered to originate from a native ancesor if the segment containing the allele has low frequency in all reference breeds.
The kinship at native alleles between individuals i and j is Q1[i,j]/Q2[i,j]
.
The mean kinship at native alleles in the offspring is (x'Q1x+d1)/(x'Q2x+d2)
, where x
is the vector with genetic contributions of the selection candidates.
Genotype file format: Each file containing phased genotypes has a header and no row names. Cells are separated by blank spaces. The number of rows is equal to the number of markers from the respective chromosome and the markers are in the same order as in the map
. The first cskip
columns are ignored. The remaining columns contain genotypes of individuals written as two alleles separated by a character, e.g. A/B, 0/1, A|B, A B, or 0 1. The same two symbols must be used for all markers. Column names are the IDs of the individuals. If the blank space is used as separator then the ID of each individual should repeated in the header to get a regular delimited file. The columns to be skipped and the individual IDs must have no white spaces. The name of each file must contain the chromosome name as specified in the map
in the form "ChrNAME."
, e.g. "Breed2.Chr1.phased"
.
Value
A list of class ratioFun
including components:
Q1 |
matrix with |
Q2 |
matrix with |
d1 |
The value by which the probability that two alleles chosen from the offspring are IBD and native increases due to genetic drift. |
d2 |
The value by which the probability that two alleles chosen from the offspring are native increases due to genetic drift. |
id |
IDs of the individuals for which the probabilites have been computed. |
mean |
Mean kinship at native alleles of the specified individuals. Note that |
Author(s)
Robin Wellmann
Examples
data(map)
data(Cattle)
dir <- system.file("extdata", package = "optiSel")
files <- paste(dir, "/Chr", 1:2, ".phased", sep="")
sKinatN <- segIBDatN(files, Cattle, map, thisBreed="Angler",
ubFreq=0.01, minL=1.0, lowMem=FALSE)
## Mean kinship at native segments:
sKinatN$mean
#[1] 0.06695171
## Note that this can not be computed as mean(sKinatN$of).
## Results for individuals:
sKinatN$of <- sKinatN$Q1/sKinatN$Q2
sKinatN$of["Angler1","Angler5"]
#[1] 0.4394066
## Use temporary files to reduce working memory:
sKinatN <- segIBDatN(files, Cattle, map, thisBreed="Angler", ubFreq=0.01, minL=1.0)
## Mean kinship at native segments:
sKinatN$mean
#[1] 0.06695171