51
51
52
52
# ---------------------------------------------------------------------
53
53
# The following parameters should be provided:
54
+ # Mandatory
54
55
# 1) Identifiers provided in a txt file, one per line. These can be from SRA, ENA, DDBJ, GEO or Synapse repositories
55
56
# 2) Specifies the type of identifier provided {'sra', 'synapse'}
56
- # 3) CPUs
57
- # 4) Max memory to be used
58
- # 5) Provide a name. A samplesheet for direct use with the nf-core/rna-seq pipeline will be created {'rnaseq'}
59
- # 6) Optional (-x): If this run is a resume or a new job
60
- # 7) The output directory where the results will be saved
57
+ # 3) Provide a name. A samplesheet for direct use with the nf-core/rna-seq pipeline will be created {'rnaseq'}
58
+ # 4) The output directory where the results will be saved
59
+ # Optional
60
+ # 5) CPUs
61
+ # 6) Max memory to be used
62
+ # 7) (-x): If this run is a resume or a new job
63
+
61
64
# ---------------------------------------------------------------------
62
65
63
66
64
- while getopts i:t:p:m:n:x:o : flag
67
+ while getopts i:t:n:o: p:m:x : flag
65
68
do
66
69
case " ${flag} " in
67
70
i) ID=${OPTARG} ;;
68
71
t) type=${OPTARG} ;;
72
+ n) name=${OPTARG} ;;
73
+ o) output=${OPTARG} ;;
69
74
p) cpu=${OPTARG} ;;
70
75
m) memory=${OPTARG} ;;
71
- n) name=${OPTARG} ;;
72
76
x) resume=${OPTARG} ;;
73
- o) output=${OPTARG} ;;
74
77
\? ) echo " Invalid option: $OPTARG " 1>&2 ;;
75
78
:) echo " Invalid option: $OPTARG requires an argument" 1>&2 ;;
76
79
esac
@@ -92,13 +95,15 @@ if [ $# -eq 0 ]; then
92
95
echo " "
93
96
echo " **Empty parameters! Unable to run**. Please provide the following parameters:"
94
97
echo "
98
+ Mandatory
95
99
-i: Identifiers provided in a txt file, one per line. These can be from SRA, ENA, DDBJ, GEO or Synapse repositories
96
100
-t: Specifies the type of identifier provided {'sra', 'synapse'}
101
+ -n: Provide a name. A samplesheet for direct use with the nf-core/rna-seq pipeline will be created (CSV) {'rnaseq'}
102
+ -o: The output directory where the results will be saved
103
+ Optional
97
104
-p: CPUs
98
105
-m: Max memory to be used (ej. -m 100.GB) Please note the syntaxis.
99
- -n: Provide a name. A samplesheet for direct use with the nf-core/rna-seq pipeline will be created (CSV) {'rnaseq'}
100
106
-x: resume a previous Job. Options: y/n
101
- -o) The output directory where the results will be saved
102
107
103
108
"
104
109
114
119
# ---------------------------------------------------------------------
115
120
116
121
117
- # Mandatory: Identifiers
122
+ # Mandatory: Identifiers
118
123
if [ -z " ${ID} " ]; then
119
124
printf " Missing Identifiers File. Please provide it and run again.\n"
120
125
exit 1
@@ -132,21 +137,21 @@ else
132
137
fi
133
138
134
139
135
- # Mandatory: Type of identifier
140
+ # Mandatory: Type of identifier
136
141
if [ -z " ${type} " ]; then
137
142
printf " Missing Identifier Type. Please provide sra or synapse and run again.\n"
138
143
exit 1
139
144
fi
140
145
141
146
142
- # Mandatory: Samplesheet name
147
+ # Mandatory: Samplesheet name
143
148
if [ -z " ${name} " ]; then
144
149
printf " Missing samplesheet name. Please provide it and run again.\n"
145
150
exit 1
146
151
fi
147
152
148
153
149
- # Mandatory: Name of output directory
154
+ # Mandatory: Name of output directory
150
155
if [ -z " ${output} " ]; then
151
156
printf " Output not provided.\n"
152
157
output=" SRA"
@@ -156,30 +161,30 @@ else
156
161
fi
157
162
158
163
159
- # Optional: Resume previous job
160
- if [[ " $resume " == " y" ]]; then
161
- printf " Resuming previous Job\n"
162
- again=" -resume"
163
- elif [[ " $resume " == " n" ]]; then
164
- printf " Starting a new Job\n"
165
- again=" "
166
- else
167
- printf " Missing option y/n for resuming process (-x option). Quitting.\n"
168
- exit 1
164
+ # Optional: CPU
165
+ if [ -z " ${cpu} " ]; then
166
+ cpu=$( cat /proc/cpuinfo | grep -c ' processor' )
167
+ printf " CPUs to use not provided. Using all $cpu cores available.\n"
169
168
fi
170
169
171
170
172
- # Optional: Memory
171
+ # Optional: Memory
173
172
if [ -z " ${memory} " ]; then
174
173
memory=$( vmstat -s -S M | grep ' total memory' | awk ' { print $1 / (1024) }' | awk ' { print int($1+0.5) }' )
175
174
printf " Max memory not provided. Using all $memory GB of memory.\n"
176
175
fi
177
176
178
177
179
- # Optional: CPU
180
- if [ -z " ${cpu} " ]; then
181
- cpu=$( cat /proc/cpuinfo | grep -c ' processor' )
182
- printf " CPUs to use not provided. Using all $cpu cores available.\n"
178
+ # Optional: Resume previous job
179
+ if [[ " $resume " == " y" ]]; then
180
+ printf " Resuming previous Job\n"
181
+ again=" -resume"
182
+ elif [[ " $resume " == " n" ]]; then
183
+ printf " Starting a new Job\n"
184
+ again=" "
185
+ else
186
+ printf " Missing option y/n for resuming process (-x option). Quitting.\n"
187
+ exit 1
183
188
fi
184
189
185
190
0 commit comments