Skip to content

Commit 97e78e4

Browse files
committed
Cleaned up the bash for the masking processes.
* Double [ instead of single ([[ instead of [) The if-condition is then evaluated by bash instead of test. Kudos to @andkaha * More quoting of varnames * continue instead of break on non-file masks.
1 parent 27ead98 commit 97e78e4

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

main.nf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,18 @@ process artifact_mask_vcfs {
175175
# We don't want to change the filename in this process so we copy the
176176
# infile and remove the symbolic link. And then recreate the file at the
177177
# end.
178-
cp $svfile workfile
179-
rm $svfile # It's a link, should be ok :)
178+
cp "$svfile" workfile
179+
rm "$svfile" # It's a link, should be ok :)
180180
for mask in \$MASK_DIR/*; do
181-
if [ ! -f "\$mask" ]; then
182-
break
181+
if [[ ! -f "\$mask" ]]; then
182+
continue
183183
fi
184184
cat workfile \
185-
| bedtools intersect -header -v -a stdin -b \$mask -f 0.25 \
185+
| bedtools intersect -header -v -a stdin -b "\$mask" -f 0.25 \
186186
> tempfile
187187
mv tempfile workfile
188188
done
189-
mv workfile $svfile
189+
mv workfile "$svfile"
190190
"""
191191
}
192192

@@ -212,15 +212,15 @@ process cohort_mask_vcfs {
212212
213213
cp $svfile workfile
214214
for mask in \$MASK_DIR/*; do
215-
if [ ! -f "\$mask" ]; then
216-
break
215+
if [[ ! -f "\$mask" ]]; then
216+
continue
217217
fi
218218
cat workfile \
219-
| bedtools intersect -header -v -a stdin -b \$mask -f $params.sg_mask_ovlp $reciprocal \
219+
| bedtools intersect -header -v -a stdin -b "\$mask" -f "$params.sg_mask_ovlp" "$reciprocal" \
220220
> tempfile
221221
mv tempfile workfile
222222
done
223-
mv workfile \$MASK_FILE
223+
mv workfile "\$MASK_FILE"
224224
"""
225225
}
226226

0 commit comments

Comments
 (0)