Mercurial > repos > tomnl > mspurity_createmsp
changeset 2:7e7223015600 draft
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit d9efa3f24732a92c2bcef5987289179e86d5c50f-dirty
| author | tomnl |
|---|---|
| date | Fri, 14 Jun 2019 07:05:18 -0400 |
| parents | 6d1312ad450c |
| children | 5dd59c833c34 |
| files | createDatabase.R |
| diffstat | 1 files changed, 23 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/createDatabase.R Tue Jun 04 10:42:27 2019 -0400 +++ b/createDatabase.R Fri Jun 14 07:05:18 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' )
