diff MsXlsDb.R @ 5:fb9c0409d85c draft

planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit 608d9e59a0d2dcf85a037968ddb2c61137fb9bce
author prog
date Wed, 19 Apr 2017 10:00:05 -0400
parents 20d69a062da3
children
line wrap: on
line diff
--- a/MsXlsDb.R	Tue Mar 14 12:40:22 2017 -0400
+++ b/MsXlsDb.R	Wed Apr 19 10:00:05 2017 -0400
@@ -56,7 +56,7 @@
 	# GET MOLECULE IDS #
 	####################
 	
-	MsXlsDb$methods( getMoleculeIds = function() {
+	MsXlsDb$methods( getMoleculeIds = function(max.results = NA_integer_) {
 	
 		# Init file list
 		.self$.init.file.list()
@@ -64,6 +64,10 @@
 		# Get IDs
 		mol.ids <- as.integer(which( ! is.na(.self$.files)))
 
+		# Cut
+		if ( ! is.na(max.results) && length(mol.ids) > max.results)
+			mol.ids <- mol.ids[max.results, ]
+
 		return(mol.ids)
 	})
 	
@@ -801,6 +805,7 @@
 			mols <- .self$getMoleculeIds()
 
 		results <- data.frame(id = integer(), col = character(), colrt = double(), stringsAsFactors = FALSE)
+		colnames(results) <- c(MSDB.TAG.MOLID, MSDB.TAG.COL, MSDB.TAG.COLRT)
 
 		# Loop on all molecules
 		for (molid in mols) {