Tuesday, March 19, 2013

Welcome to plantbreeding - R package


plantbreeding - Analysis and visualization of data from plant breeding and genetics experiments


This adds-on package contains functionality for analysis and visualization data from plant breeding experiments. Analysis includes both conventional quantitative genetics as well as molecular breeding tools. The library also consists of example datasets and codes to perform different analysis relevant to plant breeders depending upon other R packages.

Details

Package:plantbreeding
Type:Package
Version:1.0
Date:2012-04-21
License:GPL (>= 2)
The package contains different functiolities relevant to analysis of data from both conventional and molecular plant breeding and genetics experiments. The functionalities include analysis of designs specific to plant breeding needs such as Augmented block designs, Genotype x Environment and stability , variance component and combining ability estimations (eg. Diallel analysis, North Carolina designs, LinexTester), Heritability and Genetic correlation estimation, selection index. Beside classical breeding tools functionalities and examples provide different molecular analysis tools such as genetic map construction, - QTL mapping, association mapping and genomic selection. There are other relevant utilities relevant to handling of moderate to large datasets. Also the package includes functions for visualization of population and genetic gain under selection as well as genome or chromosome wide visualization tools fitted to needs of molecular breeding tools. General R functions are also integrated with to guide new user who have limited experience of using R.

Examples:

# load the package 
library(plantbreeding)
require (plantbreeding)

# seek help about the package 
help(plantbreeding)
library(help = plantbreeding)

# list of dataset in the package 
data(package="plantbreeding") 

# list all objects in the package 
ls("package:plantbreeding")

# load a dataset from the library - for example dataset nassociation  
data (nassociation)

# seek help on particular function, example map.plot  
help (map.plot)
?map.plot 

# example of applying a function 


# Example 1 : Diallele analysis 
require(plantbreeding)
data(fulldial) 
 out <-diallele1(dataframe = fulldial, male = "MALE", female = "FEMALE",  
 progeny = "TRT", replication = "REP", yvar = "YIELD" )
print(out) 
out$anvout # analysis of variance 
out$anova.mod1 # analysis of variance for GCA and SCA effects 
out$components.model1 # model1 GCA, SCA and reciprocal components 
out$gca.effmat # GCA effects
out$sca.effmat # SCA effect matrix
heatmap(out$sca.effmat, labRow = rownames(out$sca.effmat) ,
labCol = colnames(out$sca.effmat)) # heatmap plot of SCA matrix 
out$reciprocal.effmat # reciprocal effect matrix 


# Example 2: Stability, AMMI analysis and heatmap plot   
# stability analysis 
require(plantbreeding)
data(multienv)
out <- stability (dataframe = multienv , yvar = "yield", genotypes = "genotypes", 
environments = "environments", replication =  "replication")
out
# AMMI analysis 
results <- ammi.full(dataframe = multienv , environment = "environments", genotype = "genotypes", 
replication = "replication", yvar = "yield")
results

# heatmap plot 
heatmap (results$means, col = cm.colors (10))



# Example 3 : Analysis of Augumented row column block designs 
data(rowcoldata)
outp <- aug.rowcol(dataframe = rowcoldata, rows = "rows", columns = "columns",
 genotypes = "genotypes", yield = "yield")
outp$ANOVA # analysis of variance 
outp$Adjustment # adjusted values



#### Example 4: Mahattan plots for association mapping results 
set.seed (1234) 
data12 <- data.frame (snp = 1: 2000*20 , chr = c(rep(1:20, each = 2000)), pos= rep(1:2000, 20), 
pval= rnorm(2000*20, 0.001, 0.005))

manhatton.circos(dataframe = data12, SNPname = "snp", chromosome = "chr", position = "pos",
 pvcol = "pval",ymax = "maximum", ymin = 0, gapbp = 500,
 type = "polar", colour = "multicolor", geom = "area")
 
manhatton.circos(dataframe = data12, SNPname = "snp", chromosome = "chr", position = "pos", 
pvcol = "pval",ymax = "maximum", ymin = 0, gapbp = 1000,
 type = "polar", colour = "multicolor" , geom = "point")
 
 manhatton.circos(dataframe = data12, SNPname = "snp", chromosome = "chr", position = "pos",
  pvcol = "pval",ymax = "maximum", ymin = 0, gapbp = 1000,
 type = "regular", colour = "multicolor" , geom = c("line","point"))
 
manhatton.plot(dataframe = data12, SNPname = "snp", chromosome = "chr", position = "pos",
 pvcol = "pval",ymax = "maximum", ymin = 0, gapbp = 500, color=c("hotpink3","dodgerblue4"), 
 line1 = 3, line2 = 5, pch = c(1,20) ) 



### Example 5: plot maps with additional informations 
lab1 <- paste("SNP_", 1:30, sep = "")
mapdat <- data.frame (chr = rep(1:3, each = length (lab1)/3), label= lab1, 
position= c(0, 1, 4, 5, 6, 8, 10,  11, 12,  13,
            0, 4, 5, 9, 12, 18, 20, 21, 22,  33,
            0, 2, 6, 9, 12, 14, 18,  21, 24,  28 ))
# positions must start from zero 
 # data 2 filling avariable data 
set.seed (1234)
fillcol <-rnorm(3*(length(lab1)-1), 0.5, 0.2)
filld <- data.frame(chr1 = rep(1:3, each = length(fillcol)/3), fillcol)
 
   
 mapbar.plot (mapdat = mapdat, chr = "chr" ,position = "position",label = "label",
  colorpalvec = heat.colors, size = 10,  filld = filld, chr1 = "chr1") 
# Brewing own color palette 
 colvec1 <- colorRampPalette(c("red", "yellow", "green")) 
  mapbar.plot (mapdat = mapdat, chr = "chr" ,position = "position",label = "label", 
  colorpalvec = colvec1, size = 10, filld = filld, chr1 = "chr1") 


Suggestions for improvement are welcome !!

R-forge website: https://r-forge.r-project.org/projects/plantbreeding/