add.individuals: Add new individuals to objects of class gpData

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

View source: R/add.individuals.r

Description

This function extends an object of class gpData by adding new phenotypes, genotypes and pedigree.

Usage

1
2
add.individuals(gpData, pheno = NULL, geno = NULL,
                pedigree = NULL, covar = NULL, repl=NULL)

Arguments

gpData

object of class gpData to be updated

pheno

data.frame with new rows for phenotypes with rownames indicating individuals. For repeated values the ID should be stored in a column with name "ID".

geno

matrix with new rows for genotypic data with rownames indicating individuals

pedigree

data.frame with new rows for pedigree data

covar

data.frame with new rows for covar information with rownames indicating individuals

repl

The column of the pheno data.frame for the replicated measures. If the values are not repeated or this column is named "repl" this argument is not needed.

Details

colnames in geno, pheno and pedigree must match existing names in gpData object.

Value

object of class gpData with new individuals

Author(s)

Valentin Wimmer

See Also

add.markers, discard.individuals

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
set.seed(311)
pheno <- data.frame(Yield = rnorm(10,200,5),Height=rnorm(10,100,1))
rownames(pheno) <- letters[1:10]
geno <- matrix(sample(c("A","A/B","B",NA),size=120,replace=TRUE,
prob=c(0.6,0.2,0.1,0.1)),nrow=10)
rownames(geno) <-  letters[1:10]
colnames(geno) <- paste("M",1:12,sep="")
# one SNP is not mapped (M5)
map <- data.frame(chr=rep(1:3,each=4),pos=rep(1:12))
map  <- map[-5,]
rownames(map) <- paste("M",c(1:4,6:12),sep="")
gp <- create.gpData(pheno=pheno,geno=geno,map=map)
summary(gp)

#new phenotypic data
newPheno <- data.frame(Yield=200,Height=100,row.names="newLine")
# simulating genotypic data
newGeno <- matrix(sample(c("A","A/B","B"),ncol(gp$geno),replace=TRUE),nrow=1)
rownames(newGeno) <- "newLine"
# new pedigree
newPedigree <- create.pedigree(ID="newLine",Par1=0,Par2=0,gener=0)

gp2 <- add.individuals(gp,pheno=newPheno,geno=newGeno,pedigree=newPedigree)


## Not run: 
# add one new DH line to maize data
library(synbreedData)
data(maize)
newDHpheno <- data.frame(Trait=1000,row.names="newDH")
# simulating genotypic data
newDHgeno <- matrix(sample(c(0,1),ncol(maize$geno),replace=TRUE),nrow=1)
rownames(newDHgeno) <- "newDH"
# new pedigree
newDHpedigree <-  create.pedigree(ID="newDH",Par1=0,Par2=0,gener=0)
# new covar information
newDHcovar <- data.frame(family=NA,DH=1,tbv=1000,row.names="newDH")

# add individual
maize2 <- add.individuals(maize,newDHpheno,newDHgeno,newDHpedigree,newDHcovar)
summary(maize2)

## End(Not run)

Example output

sh: 1: cannot create /dev/null: Permission denied
Warning message:
In create.gpData(pheno = pheno, geno = geno, map = map) :
  not all markers in 'geno' mapped in 'map'. gaps filled with 'NA' 

object of class 'gpData' 
covar 
	 No. of individuals 10 
	         phenotyped 10 
	          genotyped 10 
pheno 
	 No. of traits:		   2 

     Yield           Height      
 Min.   :191.6   Min.   : 98.66  
 1st Qu.:197.9   1st Qu.: 98.95  
 Median :201.7   Median : 99.67  
 Mean   :201.5   Mean   : 99.90  
 3rd Qu.:205.6   3rd Qu.:100.63  
 Max.   :208.5   Max.   :102.16  

geno 
	 No. of markers 12 
	 genotypes A A/B B 
	 frequencies 0.5666667 0.2583333 0.1166667 
	 NA's 5.833 %
map 
	 No. of mapped markers  11 
	 No. of chromosomes     3 

	 markers per chromosome 
	
1 2 3 
4 3 4 

pedigree 
NULL
sh: 1: cannot create /dev/null: Permission denied
sh: 1: cannot create /dev/null: Permission denied
Warning message:
In add.individuals(maize, newDHpheno, newDHgeno, newDHpedigree,  :
  Not all traits and covariates are available in the new data!
object of class 'gpData' 
covar 
	 No. of individuals 1611 
	         phenotyped 1251 
	          genotyped 1251 
pheno 
	 No. of traits:		   1 

    IDTrait     
 Min.   :120.7  
 1st Qu.:142.8  
 Median :148.9  
 Mean   :148.9  
 3rd Qu.:154.9  
 Max.   :181.8  
 NA's   :1      

geno 
	 No. of markers 1117 
	 genotypes 0 1 
	 frequencies 0.3401368 0.6598632 
	 NA's 0.000 %
map 
	 No. of mapped markers  1117 
	 No. of chromosomes     10 

	 markers per chromosome 
	
  1   2   3   4   5   6   7   8   9  10 
 76  96  99 122  85 106 154 130 121 128 

pedigree 
Number of 
	 individuals  1611 
	 Par 1        219 
	 Par 2        221 
	 generations  15 

synbreed documentation built on May 2, 2019, 5:47 p.m.