Mercurial > repos > prog > lcmsmatching
diff MsFileDb.R @ 6:b8f70d8216b3 draft
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit b3a4e34cf9356447ae3507cc6fe2ff6a1f24afbc-dirty
| author | prog |
|---|---|
| date | Mon, 27 Mar 2017 06:27:29 -0400 |
| parents | 1ba222315fd5 |
| children |
line wrap: on
line diff
--- a/MsFileDb.R Thu Mar 16 08:15:11 2017 -0400 +++ b/MsFileDb.R Mon Mar 27 06:27:29 2017 -0400 @@ -82,7 +82,7 @@ if (is.null(.self$.db)) { # Load database - .db <<- read.table(.self$.file, sep = "\t", quote = "\"", header = TRUE, stringsAsFactors = FALSE, row.names = NULL) + .db <<- read.table(.self$.file, sep = "\t", quote = "\"", header = TRUE, stringsAsFactors = FALSE, row.names = NULL, check.names = FALSE, comment.char = '') # Check that colnames are unique dupcol <- duplicated(colnames(.self$.db)) @@ -396,8 +396,8 @@ # Filter on retention time 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, ] + scale <- if (.self$getRtUnit() == MSDB.RTUNIT.MIN) 60 else 1 + db <- db[db[[MSDB.TAG.COLRT]] * scale >= rt.low & db[[MSDB.TAG.COLRT]] * scale <= rt.high, ] } # Remove retention times and column information @@ -411,19 +411,6 @@ # Filter on mz db <- db[db[[MSDB.TAG.MZTHEO]] >= mz.low & db[[MSDB.TAG.MZTHEO]] <= mz.high, ] - # Rename database fields -# conv <- c( mz = 'mztheo', rt = 'colrt') # solving mismatch of field names between database and output -# cols <- colnames(db) -# for (db.field in names(.self$.fields)) { -# output.field <- if (db.field %in% names(conv)) conv[[db.field]] else db.field -# if (.self$.fields[[db.field]] %in% cols && output.field %in% names(.self$.output.fields)) -# cols[cols %in% .self$.fields[[db.field]]] <- .self$.output.fields[[output.field]] -# } -# colnames(db) <- cols - - # Remove unwanted columns -# db <- db[, colnames(db) %in% .self$.output.fields] - return(db) }) @@ -489,7 +476,7 @@ rt[col] <- list(colrts) } - if (.self$.rt.unit == MSDB.RTUNIT.MIN) + if (.self$getRtUnit() == MSDB.RTUNIT.MIN) rt <- 60 * rt return(rt)
