Mercurial > repos > prog > lcmsmatching
diff MsXlsDb.R @ 1:45e985cd8e9e draft
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
| author | prog |
|---|---|
| date | Tue, 31 Jan 2017 05:27:24 -0500 |
| parents | 3afe41d3e9e7 |
| children | b8f70d8216b3 |
line wrap: on
line diff
--- a/MsXlsDb.R Mon Jul 11 09:12:03 2016 -0400 +++ b/MsXlsDb.R Tue Jan 31 05:27:24 2017 -0500 @@ -39,6 +39,7 @@ MsXlsDb$methods( initialize = function(db_dir = NA_character_, limit = NA_integer_, cache_dir = NA_character_, cache = FALSE, ...) { # Initialize members + # TODO check that db_dir is not null neither na, and tests that it exists and is a directory. .db_dir <<- if ( ! is.null(db_dir)) db_dir else NA_character_ .limit <<- if ( ! is.null(limit) && ! is.na(limit) && limit > 0) limit else NA_integer_ cache_dir <- if (cache && is.na(cache_dir) && ! is.na(db_dir)) file.path(db_dir, 'cache') else cache_dir @@ -283,7 +284,7 @@ ################# # Returns a numeric vector of all masses stored inside the database. - MsXlsDb$methods( getMzValues = function(mode = NULL) { + MsXlsDb$methods( getMzValues = function(mode = NULL, max.results = NA_integer_) { mz <- numeric() @@ -295,6 +296,10 @@ # Remove duplicated mz <- mz[ ! duplicated(mz)] + # Apply cut-off + if ( ! is.na(max.results)) + mz <- mz[1:max.results] + return(mz) })
