Mercurial > repos > prog > lcmsmatching
comparison MsXlsDb.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 | 45e985cd8e9e |
| children |
comparison
equal
deleted
inserted
replaced
| 5:18254e8d1b72 | 6:b8f70d8216b3 |
|---|---|
| 54 | 54 |
| 55 #################### | 55 #################### |
| 56 # GET MOLECULE IDS # | 56 # GET MOLECULE IDS # |
| 57 #################### | 57 #################### |
| 58 | 58 |
| 59 MsXlsDb$methods( getMoleculeIds = function() { | 59 MsXlsDb$methods( getMoleculeIds = function(max.results = NA_integer_) { |
| 60 | 60 |
| 61 # Init file list | 61 # Init file list |
| 62 .self$.init.file.list() | 62 .self$.init.file.list() |
| 63 | 63 |
| 64 # Get IDs | 64 # Get IDs |
| 65 mol.ids <- as.integer(which( ! is.na(.self$.files))) | 65 mol.ids <- as.integer(which( ! is.na(.self$.files))) |
| 66 | |
| 67 # Cut | |
| 68 if ( ! is.na(max.results) && length(mol.ids) > max.results) | |
| 69 mol.ids <- mol.ids[max.results, ] | |
| 66 | 70 |
| 67 return(mol.ids) | 71 return(mol.ids) |
| 68 }) | 72 }) |
| 69 | 73 |
| 70 #################### | 74 #################### |
| 799 # Use all molecules if no list is provided | 803 # Use all molecules if no list is provided |
| 800 if (is.null(mols)) | 804 if (is.null(mols)) |
| 801 mols <- .self$getMoleculeIds() | 805 mols <- .self$getMoleculeIds() |
| 802 | 806 |
| 803 results <- data.frame(id = integer(), col = character(), colrt = double(), stringsAsFactors = FALSE) | 807 results <- data.frame(id = integer(), col = character(), colrt = double(), stringsAsFactors = FALSE) |
| 808 colnames(results) <- c(MSDB.TAG.MOLID, MSDB.TAG.COL, MSDB.TAG.COLRT) | |
| 804 | 809 |
| 805 # Loop on all molecules | 810 # Loop on all molecules |
| 806 for (molid in mols) { | 811 for (molid in mols) { |
| 807 no.col <- TRUE | 812 no.col <- TRUE |
| 808 for (c in col) { | 813 for (c in col) { |
