add.individuals {synbreed} | R Documentation |
This function extends an object of class gpData
by adding new phenotypes, genotypes and pedigree.
add.individuals(gpData, pheno = NULL, geno = NULL, pedigree = NULL, covar = NULL, repl=NULL)
gpData |
object of class |
pheno |
|
geno |
|
pedigree |
|
covar |
|
repl |
The column of the pheno |
colnames
in geno
, pheno
and pedigree
must match existing names in gpData
object.
object of class gpData
with new individuals
Valentin Wimmer
add.markers
, discard.individuals
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)