diff --git a/forest.sh b/forest.sh index 14ededdb0b178dbaee98b1fa9f018c2d5878fbef..8ae33972bde92c7f8bd6f1504a6c57120e26b84b 100755 --- a/forest.sh +++ b/forest.sh @@ -299,7 +299,7 @@ dcheck() { fi ## tac >8.0 ######################## echo -e -n "> \e[1mtac\e[0m >8.0 mandatory\t" ; binexe=$TAC_BIN; - echo -e -n "$binexe \t\t" ; + echo -e -n "$binexe \t\t" ; if [ ! $(command -v $binexe) ]; then echo -e "\e[31m[fail]\e[0m"; else echo -e -n "$(which $binexe)\t\t\e[32m[ok]\e[0m\t\t"; $TAC_BIN --version | sed -n '1p;q' ; fi @@ -543,7 +543,7 @@ then # selecting trees mv $FOREST $TMP ; - while IFS=$'\t' read -r llk tre + while read -r llk tre # using IFS=$'\t' is slow... do chk=$($BAWK -v d=$DELTA '($1-$2<=d){print"OK"}' <<<"$BESTLK $llk"); [ "$chk" == "OK" ] && echo -e "$llk\t$tre" >> $FOREST ; @@ -572,7 +572,7 @@ else ############################## <=== option -t # checking no. sequences and leaves na=$(grep "^>" $ALN | wc -l); - while read t + while read -r t do nt=$(tr '(,' '\n' <<<"$t" | grep -c -v "^$"); if [ $nt -ne $na ] @@ -598,7 +598,7 @@ else ############################## <=== option -t tml="$(sed -n '1p;q' $MLTREE)"; hml="$(hashtree $tml)"; # discarding duplicate trees (if any) - while read tre ; do echo -e "$(hashtree $tre)\t$tre" ; done < $MLTREE | + while read -r tre ; do echo -e "$(hashtree $tre)\t$tre" ; done < $MLTREE | grep -v -F "$hml" | sort | $TAWK '($1==p){next} {p=$1;print$2}' > $TMP ; @@ -643,7 +643,7 @@ else ############################## <=== option -t # adding other trees cat $TMP >> $INTREES ; # discarding duplicate trees (if any) and the ML one - while read tre ; do echo -e "$(hashtree $tre)\t$tre" ; done < $INTREES | + while read -r tre ; do echo -e "$(hashtree $tre)\t$tre" ; done < $INTREES | grep -v -F "$hml" | sort | $TAWK '($1==p){next} {p=$1;print$2}' > $TMP ; @@ -671,7 +671,7 @@ else ############################## <=== option -t $BAWK '(NR==1){print$2}' $TMP> $MLTREE ; # selecting trees - while IFS=$'\t' read -r llk tre + while read -r llk tre # using IFS=$'\t' is slow... do chk=$($BAWK -v d=$DELTA '($1-$2<=d){print"OK"}' <<<"$BESTLK $llk"); [ "$chk" == "OK" ] && echo -e "$llk\t$tre" >> $FOREST ; @@ -721,7 +721,7 @@ then # building neighborhoods cat $CURRENT | bash -c "$NEIGHBORHOOD" | - while read tre ; do echo -e "$(hashtree $tre)\t$tre" ; done > $TMP ; + while read -r tre ; do echo -e "$(hashtree $tre)\t$tre" ; done > $TMP ; # discarding already processed trees cat $TMP $HASHSET | @@ -834,7 +834,7 @@ then # building neighborhoods cat $CURRENT.$t | bash -c "$NEIGHBORHOOD" | - while read tre ; do echo -e "$(hashtree $tre)\t$tre" ; done > $TMP.$t & + while read -r tre ; do echo -e "$(hashtree $tre)\t$tre" ; done > $TMP.$t & t=$(( $t - 1 )); done