Learn R Programming

synbreed (version 0.10-2)

discard.markers: Subsets for objects of class gpData

Description

Both functions could be used to get subsets from an object of class gpData. Use function discard.markers to discard markers from elements geno and map of an object of class gpData. Use function discard.individuals to discard individuals from elements covar, pheno, geno and pedigree of an object of class gpData.

Usage

discard.markers(gpData, which)
discard.individuals(gpData, which, keepPedigree = FALSE)

Arguments

gpData
object of class gpData
which
character vector either identifying the colnames of markers in geno to discard (function discard.markers) or the rownames of individuals to discard (function discard.individuals).
keepPedigree
logical. Should the individual only be removed from elements geno and pheno but kept in the pedigree?

Value

  • Object of class gpData

See Also

create.gpData

Examples

Run this code
# example data
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)

# remove unmapped SNP M5 (which has no postion in the map)
gp2 <- discard.markers(gp,"M5")
summary(gp2)

# discard genotypes with missing values in the marker matrix
gp3 <- discard.individuals(gp,names(which(rowSums(is.na(gp$geno))>0)))
summary(gp3)

Run the code above in your browser using DataLab