# HG changeset patch # User tomnl # Date 1560510012 14400 # Node ID 250599939950a2f8967a3e496d9e0f6cf3cb5700 # Parent e4d251e0b7ebde10a8334423528d4e6a6b91e99d planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit d9efa3f24732a92c2bcef5987289179e86d5c50f-dirty diff -r e4d251e0b7eb -r 250599939950 createDatabase.R --- a/createDatabase.R Tue Jun 04 10:50:35 2019 -0400 +++ b/createDatabase.R Fri Jun 14 07:00:12 2019 -0400 @@ -68,11 +68,25 @@ print(opt) loadRData <- function(rdata_path, name){ - #loads an RData file, and returns the named xset object if it is there - load(rdata_path) - return(get(ls()[ls() == name])) +#loads an RData file, and returns the named xset object if it is there + load(rdata_path) + return(get(ls()[ls() %in% name])) } +getxcmsSetObject <- function(xobject) { + # XCMS 1.x + if (class(xobject) == "xcmsSet") + return (xobject) + # XCMS 3.x + if (class(xobject) == "XCMSnExp") { + # Get the legacy xcmsSet object + suppressWarnings(xset <- as(xobject, 'xcmsSet')) + sampclass(xset) <- xset@phenoData$sample_group + return (xset) + } +} + + print(paste('pa', opt$pa)) print(opt$xset) @@ -84,8 +98,11 @@ print(pa@fileList) + if (opt$xcms_camera_option=='xcms'){ - xset <- loadRData(opt$xset, 'xset') + + xset <- loadRData(opt$xset, c('xset','xdata')) + xset <- getxcmsSetObject(xset) fix <- xset_pa_filename_fix(opt, pa, xset) pa <- fix[[1]] xset <- fix[[2]] @@ -111,9 +128,9 @@ dbPth <- msPurity::createDatabase(pa, xset=xset, -# xsa=xa, + xsa=xa, outDir=opt$outDir, -# grpPeaklist=grpPeaklist, + grpPeaklist=grpPeaklist, dbName='createDatabase_output.sqlite' )