CompEpigen / MeDeCom

Decomposition of heterogeneous DNA methylomes
22 stars 16 forks source link

allRMSE is null #11

Open shashwatsahay opened 6 years ago

shashwatsahay commented 6 years ago

Upon passing the command

MeDeCom:::plot.K.selection(medecom.result, statistic = "maeA", Ks = as.numeric(c(2,3,4,5)),lambdas = c(0e+00, 1e-04, 1e-03, 1e-02), cg_subset = 1, sample_subset = NULL,cg_subsets = c(1),, KvsRMSElambdaLegend = TRUE)

error is thrown at line 632 that allRMSE is null which should not possible because at line 631 if(is.null(dim(allRMSE)) condition is checked which should be if(!is.null(dim(allRMSE))

Also just for easy readability allRMSE should be defined for each type of statistics that could be plotted with plot.K.Selection.

Secondly on thorough examination it is found that mae does not exist as a stat in the getstatisitc setMethod("getStatistics", signature(object="MeDeComSet"), function(object, Ks=object@parameters$Ks, lambdas=object@parameters$lambdas, cg_subset=1, statistic="cve"){ check_inputs(object, cg_subset, Ks, lambda=lambdas) elt<-c( "objective"="Fval", "Fval"="Fval", "rmse"="rmse", "RMSE"="rmse", "CVE"="cve", "cve"="cve" )[statistic] return(object@outputs[[cg_subset]][[elt]][match(Ks, object@parameters$Ks), match(lambdas, object@parameters$lambdas)]) })

owing to null return hence could be that the if condition checks for the null return and tries to initalise it as an empty matrix in which case instead of

allRMSE<-matrix(allRMSE, nrow=length(Ks), ncol=length(lambdas))

at line 631 of plotting.R allRMSE should be defined as

allRMSE<-matrix(, nrow=length(Ks), ncol=length(lambdas))

shashwatsahay commented 6 years ago

same is the case for dist2c that is the MDC option of factorViz