Skip to content

Commit

Permalink
GC test
Browse files Browse the repository at this point in the history
  • Loading branch information
telatin committed Jun 5, 2022
1 parent 22cb875 commit df40240
Showing 1 changed file with 43 additions and 13 deletions.
56 changes: 43 additions & 13 deletions test/test-stats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SEQS=$(cat "$TMP" | tail -n 1 | cut -f 2)
TOT=$(cat "$TMP" | tail -n 1 | cut -f 3)
N50=$(cat "$TMP" | tail -n 1 | cut -f 5)

MSG="[stats] Checking normal output expecting 2 lines: <$WC>"
MSG="Checking normal output expecting 2 lines: <$WC>"
if [[ $WC == 2 ]]; then
echo -e "$OK: $MSG"
PASS=$((PASS+1))
Expand All @@ -19,7 +19,7 @@ else
fi


MSG="[stats] Checking normal output expecting total seqs 78730: <$SEQS>"
MSG="Checking normal output expecting total seqs 78730: <$SEQS>"
if [[ $SEQS == 78730 ]]; then
echo -e "$OK: $MSG"
PASS=$((PASS+1))
Expand All @@ -28,7 +28,7 @@ else
ERRORS=$((ERRORS+1))
fi

MSG="[stats] Checking normal output expecting total bases 24299931: <$TOT>"
MSG="Checking normal output expecting total bases 24299931: <$TOT>"
if [[ $TOT == 24299931 ]]; then
echo -e "$OK: $MSG"
PASS=$((PASS+1))
Expand All @@ -37,7 +37,7 @@ else
ERRORS=$((ERRORS+1))
fi

MSG="[stats] Checking normal N50 to be 316: <$N50>"
MSG="Checking normal N50 to be 316: <$N50>"
if [[ $N50 == 316 ]]; then
echo -e "$OK: $MSG"
PASS=$((PASS+1))
Expand All @@ -48,7 +48,7 @@ fi

CSV=$("$BINDIR"/seqfu stats --basename --csv $iAmpli > $TMP)
N50=$(cat "$TMP" | tail -n 1 | cut -f 5 -d ,)
MSG="[stats] Checking CSV output N50 is 316, got: <$N50>"
MSG="Checking CSV output N50 is 316, got: <$N50>"
if [[ $N50 == 316 ]]; then
echo -e "$OK: $MSG"
PASS=$((PASS+1))
Expand All @@ -61,10 +61,10 @@ fi
STATS=$("$BINDIR"/seqfu stats --basename --nice $iAmpli > $TMP)
WC=$(cat "$TMP" | grep . | wc -l | grep -o '\d\+')
if [[ $WC == 5 ]]; then
echo -e "$OK: [stats] Checking nice output expecting 5 lines: <$WC>"
echo -e "$OK: Checking nice output expecting 5 lines: <$WC>"
PASS=$((PASS+1))
else
echo -e "$FAIL: [stats] Checking nice output expecting 5 lines: <$WC>"
echo -e "$FAIL: Checking nice output expecting 5 lines: <$WC>"
ERRORS=$((ERRORS+1))
fi

Expand All @@ -74,18 +74,18 @@ STATS=$("$BINDIR"/seqfu stats --basename --json --multiqc $TMP2 $iAmpli > $TMP)
WC=$(cat "$TMP" | grep . | wc -l | grep -o '\d\+')
WC2=$(cat "$TMP2" | grep . | wc -l | grep -o '\d\+')
if [[ $WC2 == 39 ]]; then
echo -e "$OK: [stats] Checking MultiQC output expecting 39 lines: <$WC2>"
echo -e "$OK: Checking MultiQC output expecting 39 lines: <$WC2>"
PASS=$((PASS+1))
else
echo -e "$FAIL: [stats] Checking MultiQC output expecting 39 lines: <$WC2>"
echo -e "$FAIL: Checking MultiQC output expecting 39 lines: <$WC2>"
ERRORS=$((ERRORS+1))
fi

if [[ $WC == 1 ]]; then
echo -e "$OK: [stats] Experimental JSON output on 1 line: <$WC>"
echo -e "$OK: Experimental JSON output on 1 line: <$WC>"
PASS=$((PASS+1))
else
echo -e "$FAIL: [stats] Experimental JSON output on 1 line: <$WC>"
echo -e "$FAIL: Experimental JSON output on 1 line: <$WC>"
ERRORS=$((ERRORS+1))
fi
# Multi file
Expand All @@ -96,7 +96,7 @@ fi
"$BINDIR"/seqfu stats --basename --sort n50 --reverse $iAmpli $iSort $iMini > $TMP2

FILT=$(cat $TMP | head -n 2 | tail -n 1 | cut -f 1)
MSG="[stats] Checking default starting by 'filt': <$FILT>"
MSG="Checking default starting by 'filt': <$FILT>"
if [[ $FILT == "filt" ]]; then
echo -e "$OK: $MSG"
PASS=$((PASS+1))
Expand All @@ -106,7 +106,7 @@ else
fi

FILT=$(cat $TMP2 | head -n 2 |tail -n 1 | cut -f 1)
MSG="[stats] Checking default N50 starting by 'sort': <$FILT>"
MSG="Checking default N50 starting by 'sort': <$FILT>"
if [[ $FILT == "sort" ]]; then
echo -e "$OK: $MSG"
PASS=$((PASS+1))
Expand Down Expand Up @@ -157,4 +157,34 @@ if [[ $(tail -n 1 $TMP | cut -f 3 ) == 3300 ]]; then
else
echo -e "$FAIL: $MSG:$(head -n 1 $TMP | cut -f 3 ) "
ERRORS=$((ERRORS+1))
fi

"$BINDIR"/seqfu stats --gc $FILES/gc/1.fa | grep -v "Total bp" > $TMP
MSG="%GC check at 1.00"
if [[ $(cut -f 11 $TMP ) == 1.00 ]]; then
echo -e "$OK: $MSG"
PASS=$((PASS+1))
else
echo -e "$FAIL: $MSG: $(cut -f 11 $TMP ) "
ERRORS=$((ERRORS+1))
fi

"$BINDIR"/seqfu stats --gc $FILES/gc/2.fa | grep -v "Total bp" > $TMP
MSG="%GC check at 0.00"
if [[ $(cut -f 11 $TMP ) == 0.00 ]]; then
echo -e "$OK: $MSG"
PASS=$((PASS+1))
else
echo -e "$FAIL: $MSG: $(cut -f 11 $TMP ) "
ERRORS=$((ERRORS+1))
fi

"$BINDIR"/seqfu stats --gc $FILES/gc/3.fa | grep -v "Total bp" > $TMP
MSG="%GC check at 0.50"
if [[ $(cut -f 11 $TMP ) == 0.50 ]]; then
echo -e "$OK: $MSG"
PASS=$((PASS+1))
else
echo -e "$FAIL: $MSG: $(cut -f 11 $TMP ) "
ERRORS=$((ERRORS+1))
fi

0 comments on commit df40240

Please sign in to comment.