create.pedigree: Create pedigree object

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/create.pedigree.r

Description

This function can be used to create a pedigree object.

Usage

1
create.pedigree(ID, Par1, Par2, gener=NULL,sex=NULL,add.ancestors=FALSE,unknown=0)

Arguments

ID

vector of unique IDs identifying individuals

Par1

vector of IDs identifying parent 1 (with animals: sire)

Par2

vector of IDs identifying parent 2 (with animals: dam)

gener

vector identifying the generation. If NULL gener will be 0 for unknown parents and max(gener(Par1),gener(Par2))+1 for generations 1,... .

sex

vector identifying the sex (female=0 and male=1).

add.ancestors

logical. Add ancestors which do not occur in ID to the pedigree.

unknown

value for unknown or missing ancestors.

Details

Missing values for parents in the pedigree should be coded NA. 0 is treaded as unknown, too.

Value

An object of class pedigree. Column gener starts from 0 and pedigree is sorted by generation.

Author(s)

Valentin Wimmer

See Also

plot.pedigree, add.pedigree

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# example with 9 individuals
id <- paste("ID", 1:9, sep="0")
par1 <- paste("ID", c(0,0,0,0,1,1,1,4,7), sep="")
par2 <- paste("ID", c("","","","",2,3,2,5,8), sep="")
gener <- c(0,0,0,0,1,1,1,2,3)

# create pedigree object (using argument gener)
ped <- create.pedigree(id,par1,par2,gener,unknown=c("ID0", "ID"))
ped
plot(ped)

# create pedigree object (without using argument gener)
ped2 <- create.pedigree(id,par1,par2,unknown=c("ID0", "ID"))
ped2

Example output

    ID Par1 Par2 gener
1 ID01    0    0     0
2 ID02    0    0     0
3 ID03    0    0     0
4 ID04    0    0     0
5 ID05  ID1  ID2     1
6 ID06  ID1  ID3     1
7 ID07  ID1  ID2     1
8 ID08  ID4  ID5     2
9 ID09  ID7  ID8     3
IGRAPH 5b952a0 DN-- 9 0 -- 
+ attr: name (v/c), Par1 (v/c), Par2 (v/c), gener (v/n)
+ edges from 5b952a0 (vertex names):
    ID Par1 Par2 gener
1 ID01    0    0     0
2 ID02    0    0     0
3 ID03    0    0     0
4 ID04    0    0     0
5 ID05  ID1  ID2     1
6 ID06  ID1  ID3     1
7 ID07  ID1  ID2     1
8 ID08  ID4  ID5     1
9 ID09  ID7  ID8     1

synbreed documentation built on March 19, 2018, 3 p.m.