diff MsFileDb.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/MsFileDb.R	Tue Mar 14 12:35:23 2017 -0400
+++ b/MsFileDb.R	Thu Mar 16 05:05:55 2017 -0400
@@ -395,8 +395,10 @@
 			db <- db[db[[MSDB.TAG.COL]] %in% col,]
 
 		# Filter on retention time
-		if ( ! is.null(rt.low) && ! is.na(rt.low) && ! is.null(rt.high) && ! is.na(rt.high))
-			db <- db[db[[MSDB.TAG.COLRT]] >= rt.low & db[[MSDB.TAG.COLRT]] <= rt.high, ]
+		if ( ! is.null(rt.low) && ! is.na(rt.low) && ! is.null(rt.high) && ! is.na(rt.high)) {
+			scale <- if (.self$.rt.unit == MSDB.RTUNIT.MIN) 60 else 1
+			db <- db[db[[MSDB.TAG.COLRT]] * scale >= rt.low & db[[MSDB.TAG.COLRT]] <= rt.high, ]
+		}
 
 		# Remove retention times and column information
 		if (is.null(col) || is.na(col) || is.null(rt.low) || is.na(rt.low) || is.null(rt.high) || is.na(rt.high)) {
@@ -487,6 +489,9 @@
 			rt[col] <- list(colrts)
 		}
 
+		if (.self$.rt.unit == MSDB.RTUNIT.MIN)
+			rt <- 60 * rt
+
 		return(rt)
 	})