diff MsDb.R @ 4:1ba222315fd5 draft

planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit 947b8707b06176a4801de64a71c8771617311ffb
author prog
date Thu, 16 Mar 2017 05:05:55 -0400
parents 45e985cd8e9e
children b8f70d8216b3
line wrap: on
line diff
--- a/MsDb.R	Tue Mar 14 12:35:23 2017 -0400
+++ b/MsDb.R	Thu Mar 16 05:05:55 2017 -0400
@@ -9,21 +9,22 @@
 	# CLASS DECLARATION #
 	#####################
 	
-	MsDb <- setRefClass("MsDb", fields = list(.observers = "ANY", .prec = "list", .output.streams = "ANY", .input.stream = "ANY", .mz.tol.unit = "character"))
+	MsDb <- setRefClass("MsDb", fields = list(.observers = "ANY", .prec = "list", .output.streams = "ANY", .input.stream = "ANY", .mz.tol.unit = "character", .rt.unit = "character"))
 	
 	###############
 	# CONSTRUCTOR #
 	###############
 	
 	MsDb$methods( initialize = function(...) {
+		
+		callSuper(...)
 
 		.observers <<- NULL
 		.output.streams <<- NULL
 		.input.stream <<- NULL
 		.prec <<- MSDB.DFT.PREC
 		.mz.tol.unit <<- MSDB.DFT.MZTOLUNIT
-		
-		callSuper(...)
+		.rt.unit <<- MSDB.RTUNIT.SEC
 	})
 
 	####################
@@ -126,6 +127,10 @@
 		stop("Method setDbMsModes() not implemented in concrete class.")
 	})
 	
+	###################
+	# SET MZ TOL UNIT #
+	###################
+
 	MsDb$methods( setMzTolUnit = function(mztolunit) {
 
 		if ( ! mztolunit %in% MSDB.MZTOLUNIT.VALS)
@@ -134,6 +139,18 @@
 		.mz.tol.unit <<- mztolunit
 	})
 
+	###############
+	# SET RT UNIT #
+	###############
+
+	MsDb$methods( setRtUnit = function(unit) {
+
+		if ( ! unit %in% MSDB.RTUNIT.VALS)
+			stop(paste0("RT unit must be one of: ", paste(MSDB.RTUNIT.VALS, collapse = ', '), "."))
+
+		.rt.unit <<- unit
+	})
+
 	####################
 	# HANDLE COMPOUNDS #
 	####################