Previous changeset 10:2d94da58904b (2024-05-22) |
Commit message:
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit bc3445f7c41271b0062c7674108f57708d08dd28 |
modified:
macros.xml ramclustr.xml ramclustr_wrapper.R |
b |
diff -r 2d94da58904b -r da7722f665f4 macros.xml --- a/macros.xml Wed May 22 08:04:21 2024 +0000 +++ b/macros.xml Thu May 30 14:52:11 2024 +0000 |
b |
@@ -66,7 +66,7 @@ </xml> <xml name="parameters_recetox_aplcms"> - <section name="ms_dataframe" title="Input MS Data as parquet (output from recetox-aplcms)" expanded="true"> + <section name="ms_dataframe" title="Input MS Data as parquet/tabular (output from recetox-aplcms)" expanded="true"> <param label="Input MS1 featureDefinitions" name="ms1_featureDefinitions" type="data" format="parquet,tabular" help="Metadata with columns: mz, rt, feature names containing MS data."/> <param label="Input MS1 featureValues" name="ms1_featureValues" type="data" format="parquet,tabular" |
b |
diff -r 2d94da58904b -r da7722f665f4 ramclustr.xml --- a/ramclustr.xml Wed May 22 08:04:21 2024 +0000 +++ b/ramclustr.xml Thu May 30 14:52:11 2024 +0000 |
b |
@@ -1,4 +1,4 @@ -<tool id="ramclustr" name="RAMClustR" version="@TOOL_VERSION@+galaxy6" profile="21.09"> +<tool id="ramclustr" name="RAMClustR" version="@TOOL_VERSION@+galaxy7" profile="21.09"> <description>A feature clustering algorithm for non-targeted mass spectrometric metabolomics data.</description> <macros> <import>macros.xml</import> |
b |
diff -r 2d94da58904b -r da7722f665f4 ramclustr_wrapper.R --- a/ramclustr_wrapper.R Wed May 22 08:04:21 2024 +0000 +++ b/ramclustr_wrapper.R Thu May 30 14:52:11 2024 +0000 |
[ |
b'@@ -2,42 +2,42 @@\n output_merge_msp,\n output_spec_abundance,\n msp_file) {\n- RAMClustR::write.msp(ramclustr_obj, one.file = output_merge_msp)\n- write.table(ramclustr_obj$SpecAbund,\n- file = output_spec_abundance,\n- row.names = TRUE, quote = FALSE, col.names = NA, sep = "\\t"\n- )\n+ RAMClustR::write.msp(ramclustr_obj, one.file = output_merge_msp)\n+ write.table(ramclustr_obj$SpecAbund,\n+ file = output_spec_abundance,\n+ row.names = TRUE, quote = FALSE, col.names = NA, sep = "\\t"\n+ )\n \n- if (!is.null(msp_file)) {\n- exp_name <- ramclustr_obj$ExpDes[[1]][which(\n- row.names(ramclustr_obj$ExpDes[[1]]) == "Experiment"\n- ), 1]\n- filename <- paste("spectra/", exp_name, ".msp", sep = "")\n- file.copy(from = filename, to = msp_file, overwrite = TRUE)\n- }\n+ if (!is.null(msp_file)) {\n+ exp_name <- ramclustr_obj$ExpDes[[1]][which(\n+ row.names(ramclustr_obj$ExpDes[[1]]) == "Experiment"\n+ ), 1]\n+ filename <- paste("spectra/", exp_name, ".msp", sep = "")\n+ file.copy(from = filename, to = msp_file, overwrite = TRUE)\n+ }\n }\n \n load_experiment_definition <- function(filename) {\n- experiment <- RAMClustR::defineExperiment(csv = filename)\n- return(experiment)\n+ experiment <- RAMClustR::defineExperiment(csv = filename)\n+ return(experiment)\n }\n \n read_metadata <- function(filename) {\n- data <- read.csv(filename, header = TRUE, stringsAsFactors = FALSE)\n+ data <- read.csv(filename, header = TRUE, stringsAsFactors = FALSE)\n \n- if (!"qc" %in% colnames(data)) {\n- if ("sampleType" %in% colnames(data)) {\n- data$qc <- ifelse(data$sampleType == "qc", TRUE, FALSE)\n+ if (!"qc" %in% colnames(data)) {\n+ if ("sampleType" %in% colnames(data)) {\n+ data$qc <- ifelse(data$sampleType == "qc", TRUE, FALSE)\n+ }\n }\n- }\n \n- if (!"order" %in% colnames(data)) {\n- if ("injectionOrder" %in% colnames(data)) {\n- names(data)[names(data) == "injectionOrder"] <- "order"\n+ if (!"order" %in% colnames(data)) {\n+ if ("injectionOrder" %in% colnames(data)) {\n+ names(data)[names(data) == "injectionOrder"] <- "order"\n+ }\n }\n- }\n \n- return(data)\n+ return(data)\n }\n \n read_ramclustr_aplcms <- function(ms1_featuredefinitions = NULL,\n@@ -49,52 +49,55 @@\n ensure_no_na = TRUE,\n ms1_featuredefinitions_ext = "parquet",\n ms1_featurevalues_ext = "parquet") {\n- if (ms1_featuredefinitions_ext == "parquet") {\n- ms1_featuredefinitions <- arrow::read_parquet(ms1_featuredefinitions)\n- } else {\n- ms1_featuredefinitions <- read.csv(ms1_featuredefinitions,\n- header = TRUE, sep = "\\t"\n- )\n- }\n+ if (ms1_featuredefinitions_ext == "parquet") {\n+ ms1_featuredefinitions <- arrow::read_parquet(ms1_featuredefinitions)\n+ } else {\n+ ms1_featuredefinitions <- read.csv(ms1_featuredefinitions,\n+ header = TRUE, sep = "\\t", check.names = FALSE\n+ )\n+ }\n \n- if (ms1_featurevalues_ext == "parquet") {\n- ms1_featurevalues <- arrow::read_parquet(ms1_featurevalues)\n- } else {\n- ms1_featurevalues <- read.csv(ms1_featurevalues, header = TRUE, sep = "\\t")\n- }\n-\n- if (!is.null(df_phenodata)) {\n- if (phenodata_ext == "csv") {\n- df_phenodata <- read.csv(\n- file = df_phenodata,\n- header = TRUE, check.names = FALSE\n- )\n+ if (ms1_featurevalues_ext == "parquet") {\n+ ms1_featurevalues <- arrow::read_parquet(ms1_featurevalues)\n } else {\n- df_phenodata <- read.csv(\n- file = df_phenodata,\n- header = TRUE, check.names = FALSE, sep = "\\t"\n- )\n+ ms1_featurevalues <- read.csv(ms1_featurevalues,\n+ header = TRUE,\n+ sep = "\\t", check.names = FALSE\n+ )\n }\n- }\n- if (!is.null(exp_des)) {\n- exp_des <- load_experiment_de'..b'+ } else {\n+ df_phenodata <- read.csv(\n+ file = df_phenodata,\n+ header = TRUE, check.names = FALSE, sep = "\\t"\n+ )\n+ }\n+ }\n+ if (!is.null(exp_des)) {\n+ exp_des <- load_experiment_definition(exp_des)\n+ }\n \n- ramclustr_obj <- RAMClustR::rc.get.df.data(\n- ms1_featureDefinitions = feature_definitions,\n- ms1_featureValues = feature_values,\n- phenoData = df_phenodata,\n- ExpDes = exp_des,\n- st = st,\n- ensure.no.na = ensure_no_na\n- )\n- return(ramclustr_obj)\n+ feature_values <- ms1_featurevalues[-1]\n+ feature_values <- t(feature_values)\n+ colnames(feature_values) <- ms1_featurevalues[[1]]\n+\n+ feature_definitions <- data.frame(ms1_featuredefinitions)\n+\n+ ramclustr_obj <- RAMClustR::rc.get.df.data(\n+ ms1_featureDefinitions = feature_definitions,\n+ ms1_featureValues = feature_values,\n+ phenoData = df_phenodata,\n+ ExpDes = exp_des,\n+ st = st,\n+ ensure.no.na = ensure_no_na\n+ )\n+ return(ramclustr_obj)\n }\n \n apply_normalisation <- function(ramclustr_obj = NULL,\n@@ -104,49 +107,49 @@\n p_cut,\n rsq_cut,\n p_adjust) {\n- batch <- NULL\n- order <- NULL\n- qc <- NULL\n+ batch <- NULL\n+ order <- NULL\n+ qc <- NULL\n \n- if (normalize_method == "TIC") {\n- ramclustr_obj <- RAMClustR::rc.feature.normalize.tic(\n- ramclustObj =\n- ramclustr_obj\n- )\n- } else if (normalize_method == "quantile") {\n- ramclustr_obj <- RAMClustR::rc.feature.normalize.quantile(ramclustr_obj)\n- } else if (normalize_method == "batch.qc") {\n- if (!(is.null(metadata_file) || metadata_file == "None")) {\n- metadata <- read_metadata(metadata_file)\n- batch <- metadata$batch\n- order <- metadata$order\n- qc <- metadata$qc\n- }\n+ if (normalize_method == "TIC") {\n+ ramclustr_obj <- RAMClustR::rc.feature.normalize.tic(\n+ ramclustObj =\n+ ramclustr_obj\n+ )\n+ } else if (normalize_method == "quantile") {\n+ ramclustr_obj <- RAMClustR::rc.feature.normalize.quantile(ramclustr_obj)\n+ } else if (normalize_method == "batch.qc") {\n+ if (!(is.null(metadata_file) || metadata_file == "None")) {\n+ metadata <- read_metadata(metadata_file)\n+ batch <- metadata$batch\n+ order <- metadata$order\n+ qc <- metadata$qc\n+ }\n \n- ramclustr_obj <- RAMClustR::rc.feature.normalize.batch.qc(\n- order = order,\n- batch = batch,\n- qc = qc,\n- ramclustObj = ramclustr_obj,\n- qc.inj.range = qc_inj_range\n- )\n- } else {\n- if (!(is.null(metadata_file) || metadata_file == "None")) {\n- metadata <- read_metadata(metadata_file)\n- batch <- metadata$batch\n- order <- metadata$order\n- qc <- metadata$qc\n+ ramclustr_obj <- RAMClustR::rc.feature.normalize.batch.qc(\n+ order = order,\n+ batch = batch,\n+ qc = qc,\n+ ramclustObj = ramclustr_obj,\n+ qc.inj.range = qc_inj_range\n+ )\n+ } else {\n+ if (!(is.null(metadata_file) || metadata_file == "None")) {\n+ metadata <- read_metadata(metadata_file)\n+ batch <- metadata$batch\n+ order <- metadata$order\n+ qc <- metadata$qc\n+ }\n+\n+ ramclustr_obj <- RAMClustR::rc.feature.normalize.qc(\n+ order = order,\n+ batch = batch,\n+ qc = qc,\n+ ramclustObj = ramclustr_obj,\n+ p.cut = p_cut,\n+ rsq.cut = rsq_cut,\n+ p.adjust = p_adjust\n+ )\n }\n-\n- ramclustr_obj <- RAMClustR::rc.feature.normalize.qc(\n- order = order,\n- batch = batch,\n- qc = qc,\n- ramclustObj = ramclustr_obj,\n- p.cut = p_cut,\n- rsq.cut = rsq_cut,\n- p.adjust = p_adjust\n- )\n- }\n- return(ramclustr_obj)\n+ return(ramclustr_obj)\n }\n' |