hey i have the problem with bash script. It should run interproscan REST Im green in bash scripting. I found this script on the web:
#!/bin/bash
i=1
waitevery=30
mkdir -p out
for j in $(find `pwd` -type f -name "*.fa")
do
echo "Iteration: $i; File: $j"
filename=$(basename "$j")
python3 iprscan5.py \
--goterms \
--pathways \
[email protected] \
--outfile=out/${filename} \
--outformat=tsv \
--quiet \
$j & (( i++%waitevery==0 )) && wait
done
out:
Iteration: 1; File: /home/marcin/interproscan-5.57-90.0-64-bit/interproscan-5.57-90.0/test/xtr.fa
interpro_batch_submit.sh: 18: i++%waitevery==0: not found
Iteration: 1; File: /home/marcin/interproscan-5.57-90.0-64-bit/interproscan-5.57-90.0/test/xts.fa
interpro_batch_submit.sh: 18: i++%waitevery==0: not found
Iteration: 1; File: /home/marcin/interproscan-5.57-90.0-64-bit/interproscan-5.57-90.0/test/xtt.fa
interpro_batch_submit.sh: 18: i++%waitevery==0: not found
Iteration: 1; File: /home/marcin/interproscan-5.57-90.0-64-bit/interproscan-5.57-90.0/test/xtu.fa
interpro_batch_submit.sh: 18: i++%waitevery==0: not found
Iteration: 1; File: /home/marcin/interproscan-5.57-90.0-64-bit/interproscan-5.57-90.0/test/xtv.fa
interpro_batch_submit.sh: 18: i++%waitevery==0: not found
Iteration: 1; File: /home/marcin/interproscan-5.57-90.0-64-bit/interproscan-5.57-90.0/test/xtw.fa
Edit:
I think I forgot to add --sequence
, but something was still wrong after it.
submit.sh
and then running it. How are you running it exactly? $\endgroup$wait
will wait until all background jobs have finished.(( i++%waitevery==0 ))
will be true whenever the current value ofi
modulowaitevery
is 0, so this is a really neat trick to make the script wait for all background processes to execute every N processes. Quite clever, that. $\endgroup$