polish: use parallel instead of shell func

This commit is contained in:
kuoi 2024-07-03 15:39:13 +10:00
parent 6d3dde8c11
commit e8e40e4327

View file

@ -46,7 +46,8 @@ while true; do
*) ARG_F=$2; shift 2 ;; *) ARG_F=$2; shift 2 ;;
esac ;; esac ;;
-h|--help) -h|--help)
echo -e "\t\t\t\t\t\t\tRGB EPP\n\t\t\t\t\tReference Genome based Exon Phylogeny Pipeline\n \ # echo -e "\t\t\t\t\t\t\t\033[0;31mR\033[0m\033[0;92mG\033[0m\033[0;94mB\033[0m \033[0;33mE\033[0m\033[0;94mP\033[0m\033[0;33mP\033[0m\n\t\t\t\t\tReference Genome based Exon Phylogeny Pipeline\n \
echo -e "\t\t\t\t\t\t\t\033[0;47;31mR\033[0m\033[0;47;92mG\033[0m\033[0;47;94mB\033[0m\033[0;47m \033[0m\033[0;47;33mE\033[0m\033[0;47;94mP\033[0m\033[0;47;33mP\033[0m\n\t\t\t\t\tReference Genome based Exon Phylogeny Pipeline\n \
Version: $pkgver\n \ Version: $pkgver\n \
License: GPL-3.0-only\n \ License: GPL-3.0-only\n \
Author: Guoyi Zhang\n \ Author: Guoyi Zhang\n \
@ -250,19 +251,30 @@ if [ "$ARG_F" = "all" ] || [ "$ARG_F" = "align" ]; then
exit 1 exit 1
fi fi
current_thread=0 # current_thread=0
mkdir -p $DirAlign mkdir -p $DirAlign
mkdir -p $DirAlign/AA && mkdir -p $DirAlign/NT mkdir -p $DirAlign/AA && mkdir -p $DirAlign/NT
cd $DirMerge cd $DirMerge
for (( i=0; i<$length_gn; i++ ))
do align_by_macse() {
java -jar $PathMacse -prog alignSequences -seq ${genes[$i]}.fasta -out_AA ../$DirAlign/AA/${genes[$i]}.fasta -out_NT ../$DirAlign/NT/${genes[$i]}.fasta & java -jar $PathMacse -prog alignSequences -seq $1.fasta -out_AA ../$DirAlign/AA/$1.fasta -out_NT ../$DirAlign/NT/$1.fasta &
((current_thread++)) }
if [ $current_thread -eq $ARG_T ]; then
wait export -f align_by_macse
current_thread=0
fi parallel -j $ARG_T align_by_macse ::: "${genes[@]}"
done
# for (( i=0; i<$length_gn; i++ ))
# do
# java -jar $PathMacse -prog alignSequences -seq ${genes[$i]}.fasta -out_AA ../$DirAlign/AA/${genes[$i]}.fasta -out_NT ../$DirAlign/NT/${genes[$i]}.fasta &
# ((current_thread++))
# if [ $current_thread -eq $ARG_T ]; then
# wait
# current_thread=0
# fi
# done
cd - cd -
fi fi