#' @title chromatoplotsgui
#' @param dir path to directory where experiment is located
#' @param fly perform data calculations on the fly or instantiate with complete data pipeline?
#' @param guidata output from another instance of cpgui
#' @param ... passed to cgui.meta$new()
#' @return environment containing QWidgets and ChromPlotGUIProperties
#' @export
#' @author Marie Vendettuoli \email{mariecv26@@gmail.com}
chromatoplotsgui <- function(dir = NULL, fly = TRUE, guidata = NULL,...){
.cguienv <- mutalist(w = NULL, cpdata = NULL)
# if a working dir is not given, open empty dashboard,
# otherwise use dir contents to start an instance.
if(is.null(dir)){
.openemptygui(.cguienv)
if(!is.null(guidata)){
.cguienv$cpdata <- guidata
print(class(.cguienv$cpdata))
.drawfigs(.cguienv)
}
}else{
.checkdirargs(dir)
.openemptygui(.cguienv)
.popgui(.cguienv, dir, fly,...)
}
return( cgui.meta$new(dirloc = NULL,
loadstep = .cguienv$cpdata$loadstep,
loadmethod = .cguienv$cpdata$loadmethod,
loadparam = .cguienv$cpdata$loadparam,
includeMSn = .cguienv$cpdata$includeMSn,
loaddata = .cguienv$cpdata$loaddata,
loadplot = lapply(1:length(.cguienv$cpdata$loadplot),
FUN = function(x){return(qdata(strip_mf_df(.cguienv$cpdata$loadplot[[x]]),
size = .5,
color = log(intensity)))}),
## end loadSample params
## params for genProfile
step = .cguienv$cpdata$step,
baselevel = .cguienv$cpdata$baselevel,
basespace = .cguienv$cpdata$basespace,
integrate = .cguienv$cpdata$integrate,
# profMethod = "character",
genprofdata = .cguienv$cpdata$genprofdata,
genprofplot = lapply(1:length(.cguienv$cpdata$genprofplot),
FUN = function(x){return(qdata(strip_mf_df(.cguienv$cpdata$loadplot[[x]]),
size = .5,
color = log(intensity)))}),
## end genProfile
## params for removeBaseline
rmbaseMethod = .cguienv$cpdata$rmbaseMethod,
mzrad = .cguienv$cpdata$mzrad,
scanrad = .cguienv$cpdata$scanrad,
span = .cguienv$cpdata$span,
runs = .cguienv$cpdata$runs,
b = .cguienv$cpdata$b,
rmbasedata = .cguienv$cpdata$rmbasedata,
rmbaseplot = lapply(1:length(.cguienv$cpdata$rmbaseplot),
FUN = function(x){return(qdata(strip_mf_df(.cguienv$cpdata$rmbaseplot[[x]])))})))
}
# check that ...
# 1. dir contains dir (expdesign) or .cdf files (no exp design)
.checkdirargs <- function(dir){
# save the current working directory location
# curwd <- getwd()
#
# setwd(dir)
# fileinfos <- file.info(dir)$isdir
# if(!length(fileinfos[fileinfos]) %in% c(0, length(dir()))){
# stop('chromatoplotsgui: dir argument must be exp design or CDF files!!')
# } else {
# if(length(fileinfos[fileinfos]) == 0){
# sapply(dir(), FUN = function(x){.checkCDF})
# }
# }
# navigate back to current working directory
# setwd(curwd)
}
## check that file is of type .CDF
.checkCDF <- function(x){
if(strsplit(x, "\\.")[[2]] != "CDF"){
stop('chromatoplotsgui: indiv files must be of type .CDF !!')
}
}
## populate the gui
.popgui <- function(.cguienv, dir, fly,...){
message('instantiating chromatoplotsgui: this may take some time...')
# instantiate new cgui item
.cguienv$cpdata <- cgui.meta$new(dirloc = dir,...)
# calculate the loadSample objects
.poploadsamples(.cguienv, fly, dir)
# calculate the genProfile objects
.popgenprofile(.cguienv, fly)
# calculate the removeBaseline objects
.popremovebase(.cguienv, fly)
# calculate qdata objects
.calcqdata(.cguienv, fly)
# draw the cranvas elements
print(class(.cguienv$cpdata))
.drawfigs(.cguienv)
message('chromatoplotsgui ready to use!!')
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.