Skip to content

Commit

Permalink
remove a function
Browse files Browse the repository at this point in the history
  • Loading branch information
frahik committed Aug 21, 2018
1 parent ec7c207 commit 676e4a2
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 317 deletions.
4 changes: 1 addition & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: GFR
Title: GFR (Genomic Functional Regression)
Version: 0.9-15
Version: 0.9-16
Date: 2018-02-16
Authors@R: c(person("Francisco Javier", "Luna-Vazquez", email = "frahik@gmail.com", role = c("aut", "cre")),
person("Osval Antonio", "Montesinos-Lopez", email= "oamontes1@ucol.mx", role = "aut"),
Expand Down Expand Up @@ -34,7 +34,6 @@ Collate:
Information.R
Interface.R
Maize_GFR.R
MTME.R
Utils.R
Wheat_GFR.R
WheatI_GFR.R
Expand All @@ -49,7 +48,6 @@ Imports:
truncnorm,
tidyr,
dplyr,
BMTME,
IBCF.MTME,
doParallel,
foreach,
Expand Down
4 changes: 0 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
# Generated by roxygen2: do not edit by hand

S3method(boxplot,BFRCV)
S3method(boxplot,MTMECV)
S3method(plot,BFR)
S3method(plot,BFRCV)
S3method(plot,MTMECV)
S3method(predict,BFR)
S3method(print,BFRCV)
S3method(residuals,BFR)
S3method(summary,BFR)
S3method(summary,BFRCV)
S3method(summary,MTMECV)
export(BFR)
export(Bspline.Basis)
export(CV.KFold)
Expand All @@ -20,7 +17,6 @@ export(CV.StratifiedByFrac)
export(ETAGenerate)
export(FFR)
export(Fourier.Basis)
export(MTME)
export(cholesky)
export(cleanDat)
export(detectCores)
Expand Down
10 changes: 0 additions & 10 deletions R/CrossValidation.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@
NULL


#' Cross-validation with K Folds
#'
#' @name CV.KFold
#' @rdname CV.KFold
#' @keywords internal
#' @export
#' @importFrom BMTME CV.KFold
#' @usage CV.KFold(data, DataSetID = 'Line', K = 5, set_seed = 123)
NULL

#' Cross-validation with K Folds
#'
#' @name CV.KFold
Expand Down
124 changes: 0 additions & 124 deletions R/Generic_Methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,49 +66,6 @@ summary.BFR <- function(object,...){
}


#' @title Summary.MTMECV
#'
#' @description Solo es una prueba
#'
#' @param object \code{MTMECV object} Objeto MTMECV, resultado de ejecutar MTME()
#' @param ... Further arguments passed to or from other methods.
#' @param information compact, extended, complete
#'
#' @importFrom stats cor
#' @importFrom dplyr summarise group_by select '%>%' mutate_if funs
#'
#' @export
summary.MTMECV <- function(object, information = 'compact', digits = 4, ...){
if (!inherits(object, "MTMECV")) Stop("This function only works for objects of class 'MTMECV'")

object$results %>%
group_by(Environment, Trait, Partition) %>%
summarise(Pearson = cor(Predicted, Observed, use = 'pairwise.complete.obs'),
MSEP = mean((Predicted - Observed)^2, na.rm = T)) %>%
select(Environment, Trait, Partition, Pearson, MSEP) %>%
mutate_if(is.numeric, funs(round(., digits))) %>%
as.data.frame() -> presum

presum %>% group_by(Environment, Trait) %>%
summarise(SE_MSEP = sd(MSEP, na.rm = T)/sqrt(n()), MSEP = mean(MSEP, na.rm = T),
SE_Pearson = sd(Pearson, na.rm = T)/sqrt(n()), Pearson = mean(Pearson, na.rm = T)) %>%
select(Environment, Trait, Pearson, SE_Pearson, MSEP, SE_MSEP) %>%
mutate_if(is.numeric, funs(round(., digits))) %>%
as.data.frame() -> finalSum

out <- switch(information,
compact = finalSum,
complete = presum,
extended = {
finalSum$Partition <- 'All'
presum$Partition <- as.character(presum$Partition)
presum$SE_Pearson <- NA
presum$SE_MSEP <- NA
rbind(presum, finalSum)
}
)
return(out)
}


#' @title Summary.BFRCV
Expand Down Expand Up @@ -335,84 +292,3 @@ boxplot.BFRCV <- function(x, select = 'Pearson', ordered = TRUE, ...){
boxplot(plot.y, col = "grey", ylab = ylab, ...)
}
}

#' @title boxplot.MTMECV
#'
#' @description Solo es una prueba
#'
#' @param x \code{MTMECV object} Objeto MTMECV, resultado de ejecutar MTME()
#' @param select \code{string} Pearson or MSEP
#' @param ordered \code{logic} TRUE or FALSE
#' @param ... Further arguments passed to or from other methods.
#'
#' @importFrom graphics boxplot
#' @export
boxplot.MTMECV <- function(x, select = 'Pearson', ordered = TRUE, ...){
### Check that object is compatible
if (!inherits(x, "MTMECV")) Error("This function only works for objects of class 'MTMECV'")

results <- summary(x, 'complete')

switch (select,
Pearson = {
plot.y <- results$Pearson
ylab <- "Pearson's Correlation"
}, MSEP = {
plot.y <- results$MSEP
ylab <- "MSEP Average"
}, CC = {
plot.y <- results$CC
ylab <- "Classification correct average"
},
Error('Error in select parameter.')
)

if (length(unique(results$Env)) > 1) {
results$TxE <- paste0(results$Trait, '_', results$Env)

if (ordered && select != 'MSEP') {
results$TxE <- with(results, reorder(TxE , Pearson, median, na.rm = T))
} else if (ordered && select == 'MSEP') {
results$TxE <- with(results, reorder(TxE , MSEP, median, na.rm = T))
}

boxplot(plot.y ~ results$TxE, col = "grey", ylab = ylab, ...)
}else{
boxplot(plot.y, col = "grey", ylab = ylab, ...)
}
}


#' @title Plot MTMECV graph
#'
#' @description Plot from MTMECV object
#'
#' @param x \code{MTMECV object} MTMECV object, result of use the MTME() function
#' @param select \code{character} By default ('Pearson'), plot the Pearson Correlations of the MTME Object, else ('MSEP'), plot the MSEP of the MTMECV Object.
#' @param ... Further arguments passed to or from other methods.
#'
#' @importFrom graphics arrows axis plot
#' @export
plot.MTMECV <- function(x, select = 'Pearson', ...){
### Check that object is compatible
if (!inherits(x, "MTMECV")) Error("This function only works for objects of class 'MTMECV'")

results <- summary(x)
results <- results[order(results[, select]),]

if (select == "Pearson") {
results$SE <- 1.96 * results$SE_Pearson
ylab <- "Pearson's Correlation"
} else if (select == "MSEP") {

results$SE <- 1.96 * results$SE_MSEP[which(results$Fold == 'Average_all')]
ylab <- select
}
x.labels <- paste0(results$Trait, '_', results$Env)
plot.x <- 1:length(x.labels)
plot(plot.x, results[, select], ylim = range(c(results[, select] - results$SE, results[, select] + results$SE)),
type = 'p', ylab = ylab, xlab = '', xaxt = "n", ...)
axis(1, at = plot.x, labels = x.labels, las = 2)
arrows(plot.x, results[, select] - results$SE, plot.x, results[, select] + results$SE, code = 3, length = 0.02, angle = 90)
}

81 changes: 0 additions & 81 deletions R/MTME.R

This file was deleted.

39 changes: 0 additions & 39 deletions man/MTME.Rd

This file was deleted.

20 changes: 0 additions & 20 deletions man/boxplot.MTMECV.Rd

This file was deleted.

18 changes: 0 additions & 18 deletions man/plot.MTMECV.Rd

This file was deleted.

18 changes: 0 additions & 18 deletions man/summary.MTMECV.Rd

This file was deleted.

0 comments on commit 676e4a2

Please sign in to comment.