# HG changeset patch
# User prog
# Date 1488470876 18000
# Node ID f61ce21ed17c75366dd6917dfa0fe29b853e2f85
# Parent  20d69a062da3b25cb2c8aa5a44b89477a4ec84c4
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit 476a081c0da66822f4e77070f5ce59d9f14511f4-dirty

diff -r 20d69a062da3 -r f61ce21ed17c MsPeakForestDb.R
--- a/MsPeakForestDb.R	Thu Mar 02 08:55:00 2017 -0500
+++ b/MsPeakForestDb.R	Thu Mar 02 11:07:56 2017 -0500
@@ -260,13 +260,15 @@
 
 		# Build result data frame
 		results <- data.frame(MSDB.TAG.MOLID = character(), MSDB.TAG.MOLNAMES = character(), MSDB.TAG.MZTHEO = numeric(), MSDB.TAG.COMP = character(), MSDB.TAG.ATTR = character())
-		for (x in spectra)
-			results <- rbind(results, data.frame(MSDB.TAG.MOLID = vapply(x$source$listOfCompounds, function(c) as.character(c$id), FUN.VALUE = ''),
-			                                     MSDB.TAG.MOLNAMES = vapply(x$source$listOfCompounds, function(c) paste(c$names, collapse = MSDB.MULTIVAL.FIELD.SEP), FUN.VALUE = ''),
-												 MSDB.TAG.MZTHEO = as.numeric(x$theoricalMass),
-												 MSDB.TAG.COMP = as.character(x$composition),
-												 MSDB.TAG.ATTR = as.character(x$attribution),
-												 stringsAsFactors = FALSE))
+		for (x in spectra) {
+			if ('source' %in% names(x) && is.list(x$source))
+				results <- rbind(results, data.frame(MSDB.TAG.MOLID = vapply(x$source$listOfCompounds, function(c) as.character(c$id), FUN.VALUE = ''),
+				                                     MSDB.TAG.MOLNAMES = vapply(x$source$listOfCompounds, function(c) paste(c$names, collapse = MSDB.MULTIVAL.FIELD.SEP), FUN.VALUE = ''),
+													 MSDB.TAG.MZTHEO = as.numeric(x$theoricalMass),
+													 MSDB.TAG.COMP = as.character(x$composition),
+													 MSDB.TAG.ATTR = as.character(x$attribution),
+													 stringsAsFactors = FALSE))
+		}
 
 		# RT search
 		if ( ! is.null(rt.low) && ! is.null(rt.high)) {
diff -r 20d69a062da3 -r f61ce21ed17c lcmsmatching.xml
--- a/lcmsmatching.xml	Thu Mar 02 08:55:00 2017 -0500
+++ b/lcmsmatching.xml	Thu Mar 02 11:07:56 2017 -0500
@@ -1,4 +1,4 @@
-<tool id="lcmsmatching" name="LC/MS matching" version="3.1.7" profile="16.01">
+<tool id="lcmsmatching" name="LC/MS matching" version="3.1.8" profile="16.01">
 
 	<description>Annotation of MS peaks using matching on a spectra database.</description>