comparison MsPeakForestDb.R @ 3:f61ce21ed17c draft

planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit 476a081c0da66822f4e77070f5ce59d9f14511f4-dirty
author prog
date Thu, 02 Mar 2017 11:07:56 -0500
parents 20d69a062da3
children b34c14151f25
comparison
equal deleted inserted replaced
2:20d69a062da3 3:f61ce21ed17c
258 # Get spectra 258 # Get spectra
259 spectra <- .self$.get.url(url = url) 259 spectra <- .self$.get.url(url = url)
260 260
261 # Build result data frame 261 # Build result data frame
262 results <- data.frame(MSDB.TAG.MOLID = character(), MSDB.TAG.MOLNAMES = character(), MSDB.TAG.MZTHEO = numeric(), MSDB.TAG.COMP = character(), MSDB.TAG.ATTR = character()) 262 results <- data.frame(MSDB.TAG.MOLID = character(), MSDB.TAG.MOLNAMES = character(), MSDB.TAG.MZTHEO = numeric(), MSDB.TAG.COMP = character(), MSDB.TAG.ATTR = character())
263 for (x in spectra) 263 for (x in spectra) {
264 results <- rbind(results, data.frame(MSDB.TAG.MOLID = vapply(x$source$listOfCompounds, function(c) as.character(c$id), FUN.VALUE = ''), 264 if ('source' %in% names(x) && is.list(x$source))
265 MSDB.TAG.MOLNAMES = vapply(x$source$listOfCompounds, function(c) paste(c$names, collapse = MSDB.MULTIVAL.FIELD.SEP), FUN.VALUE = ''), 265 results <- rbind(results, data.frame(MSDB.TAG.MOLID = vapply(x$source$listOfCompounds, function(c) as.character(c$id), FUN.VALUE = ''),
266 MSDB.TAG.MZTHEO = as.numeric(x$theoricalMass), 266 MSDB.TAG.MOLNAMES = vapply(x$source$listOfCompounds, function(c) paste(c$names, collapse = MSDB.MULTIVAL.FIELD.SEP), FUN.VALUE = ''),
267 MSDB.TAG.COMP = as.character(x$composition), 267 MSDB.TAG.MZTHEO = as.numeric(x$theoricalMass),
268 MSDB.TAG.ATTR = as.character(x$attribution), 268 MSDB.TAG.COMP = as.character(x$composition),
269 stringsAsFactors = FALSE)) 269 MSDB.TAG.ATTR = as.character(x$attribution),
270 stringsAsFactors = FALSE))
271 }
270 272
271 # RT search 273 # RT search
272 if ( ! is.null(rt.low) && ! is.null(rt.high)) { 274 if ( ! is.null(rt.low) && ! is.null(rt.high)) {
273 275
274 rt.res <- data.frame(MSDB.TAG.MOLID = character(), MSDB.TAG.COL = character(), MSDB.TAG.COLRT = numeric()) 276 rt.res <- data.frame(MSDB.TAG.MOLID = character(), MSDB.TAG.COL = character(), MSDB.TAG.COLRT = numeric())