ConesaLab / MultiPower

Statistical power studies for multi-omics experiments.
29 stars 10 forks source link

Error MultiPower function #6

Closed Stabilo12 closed 7 months ago

Stabilo12 commented 3 years ago

Hai,

Since the repository is currently not updated/maintained I try to use the Multipower function, by uploading the function. but it doesnt work (I also loaded the function paramEst).

This is the error: Error in data[[i]] : object of type 'closure' is not subsettable? Suggestions to fix this?

MultiPower = function(data, groups, type, d0 = 0.8, p1 = 0.2, omicPower = 0.6, averagePower = 0.85, dispPerc = 75, fdr = 0.05, alpha = 0.05,cost = 1, equalSize = TRUE, max.size = 200, omicCol = NULL, powerPlots = TRUE) { if (length(p1) == 1) p1 = rep(p1, length(data)) if (length(d0) == 1) d0 = rep(d0, length(data)) parameters = lapply(1:length(data), function (i) { cat(paste0("Estimating parameters for omic: ", names(data)[i], " \n")) paramEst(data[[i]], groups[[i]], type[i], d0[i], p1[i], dispPerc = dispPerc)}) names(parameters) = names(data)
cat("Computing optimal sample size... \n") optimalSampleSize = optimalRep(parameters, omicPower, averagePower, fdr, alpha, cost, equalSize, max.size)
resum = powerSummary(parameters, optimalSampleSize)
if (powerPlots) { cat("Generating power plots... \n") data2plot = powerPlot(parameters, optimalSampleSize, omicCol) } else { data2plot = NULL }
return(list("parameters" = parameters, "optimalSampleSize" = optimalSampleSize, "summary" = resum, "data2plot" = data2plot)) }

MultiPower(data, groups, type, d0 = 0.8, p1 = 0.2, omicPower = 0.6, averagePower = 0.85, dispPerc = 75, fdr = 0.05, alpha = 0.05, cost = 1, equalSize = TRUE, max.size = 200, omicCol = NULL, powerPlots = TRUE)

Estimating parameters for omic:
Error in data[[i]] : object of type 'closure' is not subsettable

soniatarazona commented 1 year ago

Sorry for the delay. MultiPower has been updated recently since we had problems with deprecated dependencies. Now it should work!