Mercurial > repos > lain > xseekerpreparator
diff galaxy/tools/LC-MSMS/XSeekerPreparator.R @ 6:207e36770d18 draft
" master branch Updating"
author | lain |
---|---|
date | Wed, 20 Jan 2021 17:47:51 +0000 |
parents | a174cbbb12dd |
children | 5be8a770a11d |
line wrap: on
line diff
--- a/galaxy/tools/LC-MSMS/XSeekerPreparator.R Wed Jan 20 09:17:48 2021 +0000 +++ b/galaxy/tools/LC-MSMS/XSeekerPreparator.R Wed Jan 20 17:47:51 2021 +0000 @@ -1,7 +1,7 @@ TOOL_NAME <- "XSeekerPreparator" -VERSION <- "1.1.2" +VERSION <- "1.1.3" OUTPUT_SPECIFIC_TOOL <- "XSeeker_Galaxy" @@ -551,12 +551,24 @@ } find_grouping_var <- function(var_meta) { - for (grouping_var in c(".", "Bio")) { - if (!is.null(rdata$variableMetadata[[grouping_var]])) { - return (grouping_var) + known_colnames = c( + "name", "namecustom", "mz", "mzmin", "mzmax", + "rt", "rtmin", "rtmax", "npeaks", "isotopes", "adduct", "pcgroup" + ) + col_names <- colnames(var_meta) + classes = list() + for (name in col_names) { + if (!(name %in% known_colnames)) { + classes[[length(classes)+1]] = name } } - return (NULL) + if (length(classes) > 1) { + stop(sprintf("Only one class expected in the variable metadata. Found %d .", length(classes))) + } + if (length(classes) === 0) { + stop("Could not find any class column in your variableMetadata.") + } + return (classes[[1]]) } add_sample_to_database <- function(orm, env, context, smol_xcms_set) {