From 14aae16a559268022d95bd6fa2d39da1dd87be75 Mon Sep 17 00:00:00 2001 From: Alexis CRISCUOLO <alexis.criscuolo@pasteur.fr> Date: Sat, 4 Jan 2025 16:40:46 +0100 Subject: [PATCH] 0.5 --- forest.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/forest.sh b/forest.sh index 14ededd..8ae3397 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 -- GitLab