From a9b86c123348afad445ddf56cbc21ab63f4a7a61 Mon Sep 17 00:00:00 2001 From: hechth Date: Wed, 4 Dec 2024 15:19:29 +0100 Subject: [PATCH 1/4] recetox-aplcms: parse parameter line tool Fixes #623 --- .../recetox_aplcms_parse_parameters.xml | 147 ++++++++++++++++++ .../test-data/parse_parameters/test.csv | 2 + 2 files changed, 149 insertions(+) create mode 100644 tools/recetox_aplcms/recetox_aplcms_parse_parameters.xml create mode 100644 tools/recetox_aplcms/test-data/parse_parameters/test.csv diff --git a/tools/recetox_aplcms/recetox_aplcms_parse_parameters.xml b/tools/recetox_aplcms/recetox_aplcms_parse_parameters.xml new file mode 100644 index 00000000..215f98b5 --- /dev/null +++ b/tools/recetox_aplcms/recetox_aplcms_parse_parameters.xml @@ -0,0 +1,147 @@ + + tool to parse parameters from a csv row for parameter searches, to be used in workflows only. + + + 0.1.0 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/recetox_aplcms/test-data/parse_parameters/test.csv b/tools/recetox_aplcms/test-data/parse_parameters/test.csv new file mode 100644 index 00000000..3536c620 --- /dev/null +++ b/tools/recetox_aplcms/test-data/parse_parameters/test.csv @@ -0,0 +1,2 @@ +min_run,sigma_lower,sigma_higher,min_sd,max_sd,mz_tol,weighting,min_pres,group_threshold +3.1,0.5,1.5,0.1,0.9,0.01,true,0.8,0.7 From 0d8ffd53f9eda6cdeeb5d433951c62dc9e587adc Mon Sep 17 00:00:00 2001 From: hechth Date: Wed, 4 Dec 2024 15:25:05 +0100 Subject: [PATCH 2/4] added edam operations and topics --- .../recetox_aplcms_parse_parameters.xml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/recetox_aplcms/recetox_aplcms_parse_parameters.xml b/tools/recetox_aplcms/recetox_aplcms_parse_parameters.xml index 215f98b5..1d05677e 100644 --- a/tools/recetox_aplcms/recetox_aplcms_parse_parameters.xml +++ b/tools/recetox_aplcms/recetox_aplcms_parse_parameters.xml @@ -5,11 +5,16 @@ 0.1.0 0 - - - - + + operation_1812 + + + + topic_3316 + topic_3071 + + Date: Wed, 4 Dec 2024 16:31:19 +0100 Subject: [PATCH 3/4] added additional validation logic --- .../recetox_aplcms_parse_parameters.xml | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tools/recetox_aplcms/recetox_aplcms_parse_parameters.xml b/tools/recetox_aplcms/recetox_aplcms_parse_parameters.xml index 1d05677e..67afc17d 100644 --- a/tools/recetox_aplcms/recetox_aplcms_parse_parameters.xml +++ b/tools/recetox_aplcms/recetox_aplcms_parse_parameters.xml @@ -16,6 +16,30 @@ Date: Mon, 6 Jan 2025 16:54:29 +0100 Subject: [PATCH 4/4] no idea what this was --- tools/recetox_aplcms/parse_parameters.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tools/recetox_aplcms/parse_parameters.sh diff --git a/tools/recetox_aplcms/parse_parameters.sh b/tools/recetox_aplcms/parse_parameters.sh new file mode 100644 index 00000000..e1cd4534 --- /dev/null +++ b/tools/recetox_aplcms/parse_parameters.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Check if the correct number of arguments is provided +if [ "$#" -ne 1 ]; then + echo "Usage: $0 input.csv" + exit 1 +fi + +input_file="$1" +header=$(head -n 1 "$input_file") +num_columns=$(echo "$header" | awk -F, '{print NF}') + +# Create a directory to store the output files +output_dir="split_columns" +mkdir -p "$output_dir" + +# Split the CSV file into one file per column +for ((i=1; i<= num_columns; i++)); do + column_name=$(echo "$header" | cut -d, -f$i) + output_file="$output_dir/${column_name}.txt" + tail -n +2 "$input_file" | cut -d, -f$i > "$output_file" +done + +echo "Columns have been split into separate files in the '$output_dir' directory." \ No newline at end of file