@@ -7,38 +7,49 @@ default_OS="linux64"
7
7
8
8
# Help function
9
9
function display_help {
10
- echo " Usage: script.sh [folder ]"
10
+ echo " Usage: script.sh [options ]"
11
11
echo " Download resources required for running umetaflow."
12
12
echo " "
13
- echo " Arguments :"
14
- echo " folder: (Optional) The folder where the files will be downloaded. Default: $default_folder "
15
- echo " ion_mode: (Optional) The ionization mode of the data (" positive" or " negative" ). Default: $default_mode "
16
- echo " MY_OS: (Optional) The operating system that is used (" osx64" for macOS and " linux64" for linux ). Default: $default_OS "
13
+ echo " Options :"
14
+ echo " -f, -- folder <folder> (Optional) The folder where the files will be downloaded. Default: $default_folder "
15
+ echo " -m, -- ion_mode <ion_mode> (Optional) The ionization mode of the data (' positive' or ' negative' ). Default: $default_mode "
16
+ echo " -o, -- MY_OS <MY_OS> (Optional) The operating system that is used (' osx64' for macOS and ' linux64' for Linux ). Default: $default_MY_OS "
17
17
echo " "
18
18
}
19
19
20
- # Check if help option is provided
21
- if [[ " $1 " == " --help" || " $1 " == " -h" ]]; then
22
- display_help
23
- exit 0
24
- fi
25
-
26
- # Specify the folder where the files will be downloaded
27
- folder=${1:- $default_folder }
28
-
29
- # Specify the ion mode
30
- ion_mode=${1:- $default_mode }
31
-
32
- # Specify the operating system
33
- MY_OS=${1:- $default_OS }
34
-
35
- # get the SIRIUS executable
36
- (cd ${default_folder} && curl -s https://api.github.com/repos/boecker-lab/sirius/releases/latest | tr -d ' "' | grep " browser_download_url.*${MY_OS} .zip$" | cut -d : -f 2,3 | wget -i- && unzip * .zip)
37
-
38
- # get the ThermoRawFileParser executable
39
- (mkdir ${default_folder} /ThermoRawFileParser && cd ${default_folder} /ThermoRawFileParser && wget https://github.com/compomics/ThermoRawFileParser/releases/download/v1.3.4/ThermoRawFileParser.zip && unzip ThermoRawFileParser.zip)
20
+ # Default option values
21
+ folder=$default_folder
22
+ ion_mode=$default_mode
23
+ MY_OS=$default_MY_OS
24
+
25
+ # Parse command-line options
26
+ while getopts " :f:m:o:-:" opt; do
27
+ case $opt in
28
+ f) folder=$OPTARG ;;
29
+ m) ion_mode=$OPTARG ;;
30
+ o) MY_OS=$OPTARG ;;
31
+ -)
32
+ case $OPTARG in
33
+ folder) folder=" ${! OPTIND} " ;;
34
+ ion_mode) ion_mode=" ${! OPTIND} " ;;
35
+ MY_OS) MY_OS=" ${! OPTIND} " ;;
36
+ help) display_help; exit 0 ;;
37
+ * ) echo " Invalid option: --$OPTARG " ; exit 1 ;;
38
+ esac
39
+ OPTIND=$(( OPTIND + 1 ))
40
+ ;;
41
+ \? ) echo " Invalid option: -$OPTARG " ; exit 1 ;;
42
+ :) echo " Option -$OPTARG requires an argument." ; exit 1 ;;
43
+ esac
44
+ done
45
+
46
+ # Get the SIRIUS executable
47
+ (cd " $folder " && curl -s " https://api.github.com/repos/boecker-lab/sirius/releases/latest" | tr -d ' "' | grep " browser_download_url.*${MY_OS} .zip$" | cut -d : -f 2,3 | wget -i- && unzip * .zip)
48
+
49
+ # Get the ThermoRawFileParser executable
50
+ (mkdir -p " $folder /ThermoRawFileParser" && cd " $folder /ThermoRawFileParser" && wget " https://github.com/compomics/ThermoRawFileParser/releases/download/v1.3.4/ThermoRawFileParser.zip" && unzip ThermoRawFileParser.zip)
40
51
41
52
# Get the directory of the current script
42
53
script_directory=$( dirname " $0 " )
43
- echo $script_directory
44
- bash $script_directory /download_models.sh $script_directory /zenodo_${default_mode } .txt
54
+ echo " $script_directory "
55
+ bash " $script_directory /download_models.sh" " $script_directory /zenodo_${ion_mode } .txt"
0 commit comments