diff MsPeakForestDb.R @ 6:b8f70d8216b3 draft

planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit b3a4e34cf9356447ae3507cc6fe2ff6a1f24afbc-dirty
author prog
date Mon, 27 Mar 2017 06:27:29 -0400
parents 18254e8d1b72
children
line wrap: on
line diff
--- a/MsPeakForestDb.R	Thu Mar 16 08:15:11 2017 -0400
+++ b/MsPeakForestDb.R	Mon Mar 27 06:27:29 2017 -0400
@@ -2,7 +2,7 @@
 
 	library(methods)
 	source('MsDb.R')
-	source(file.path('UrlRequestScheduler.R'))
+	source('UrlRequestScheduler.R')
 
 	#####################
 	# CLASS DECLARATION #
@@ -47,7 +47,6 @@
 		# Add token
 		if ( ! is.na(.self$.token))
 			params <- c(params, token = .self$.token)
-				param.str <- if (is.null(params)) '' else paste('?', vapply(names(params), function(p) paste(p, params[[p]], sep = '='), FUN.VALUE = ''), collapse = '&', sep = '')
 
 		# Get URL
 		content <- .self$.url.scheduler$getUrl(url = url, params = params)
@@ -287,8 +286,9 @@
 			rt.res <- data.frame(MSDB.TAG.MOLID = character(), MSDB.TAG.COL = character(), MSDB.TAG.COLRT = numeric())
 
 			if (nrow(results) > 0) {
+
 				# Build URL for rt search
-				url <- paste0('spectra/lcms/range-rt-min/', rt.low, '/', rt.high)
+				url <- paste0('spectra/lcms/range-rt-min/', rt.low / 60, '/', rt.high / 60)
 				params <- NULL
 				if ( ! is.null(col))
 					params <- c(columns = paste(col, collapse = ','))
@@ -296,7 +296,6 @@
 				# Run query
 				rtspectra <- .self$.get.url(url = url, params = params)
 
-
 				# Get compound/molecule IDs
 				for (x in rtspectra)
 					if (all(c('listOfCompounds', 'liquidChromatography') %in% names(x))) {
@@ -308,7 +307,7 @@
 							colrt <- (rtmin + rtmax) / 2
 							rt.res <- rbind(rt.res, data.frame(MSDB.TAG.MOLID = molids,
 				                                   	   	   	   MSDB.TAG.COL = col,
-				                                   	   	   	   MSDB.TAG.COLRT = colrt,
+				                                   	   	   	   MSDB.TAG.COLRT = colrt * 60,
 					                                   	   	   stringsAsFactors = FALSE))
 						}
 					}