comparison 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
comparison
equal deleted inserted replaced
3:abfba8eb1c8d 4:1ba222315fd5
393 # Filter on columns 393 # Filter on columns
394 if ( ! is.null(col) && ! is.na(col)) 394 if ( ! is.null(col) && ! is.na(col))
395 db <- db[db[[MSDB.TAG.COL]] %in% col,] 395 db <- db[db[[MSDB.TAG.COL]] %in% col,]
396 396
397 # Filter on retention time 397 # Filter on retention time
398 if ( ! is.null(rt.low) && ! is.na(rt.low) && ! is.null(rt.high) && ! is.na(rt.high)) 398 if ( ! is.null(rt.low) && ! is.na(rt.low) && ! is.null(rt.high) && ! is.na(rt.high)) {
399 db <- db[db[[MSDB.TAG.COLRT]] >= rt.low & db[[MSDB.TAG.COLRT]] <= rt.high, ] 399 scale <- if (.self$.rt.unit == MSDB.RTUNIT.MIN) 60 else 1
400 db <- db[db[[MSDB.TAG.COLRT]] * scale >= rt.low & db[[MSDB.TAG.COLRT]] <= rt.high, ]
401 }
400 402
401 # Remove retention times and column information 403 # Remove retention times and column information
402 if (is.null(col) || is.na(col) || is.null(rt.low) || is.na(rt.low) || is.null(rt.high) || is.na(rt.high)) { 404 if (is.null(col) || is.na(col) || is.null(rt.low) || is.na(rt.low) || is.null(rt.high) || is.na(rt.high)) {
403 db <- db[, ! (colnames(db) %in% c(MSDB.TAG.COL, MSDB.TAG.COLRT))] 405 db <- db[, ! (colnames(db) %in% c(MSDB.TAG.COL, MSDB.TAG.COLRT))]
404 406
485 for (col in cols) { 487 for (col in cols) {
486 colrts <- db[db[[MSDB.TAG.COL]] %in% col, MSDB.TAG.COLRT] 488 colrts <- db[db[[MSDB.TAG.COL]] %in% col, MSDB.TAG.COLRT]
487 rt[col] <- list(colrts) 489 rt[col] <- list(colrts)
488 } 490 }
489 491
492 if (.self$.rt.unit == MSDB.RTUNIT.MIN)
493 rt <- 60 * rt
494
490 return(rt) 495 return(rt)
491 }) 496 })
492 497
493 } # end of load safe guard 498 } # end of load safe guard