Skip to content

Commit

Permalink
Merge pull request #54 from smithlabcode/fixing_test_output_comparisons
Browse files Browse the repository at this point in the history
Fixing output validation in test suit
  • Loading branch information
masarunakajima authored Jun 28, 2023
2 parents 15abb30 + 40eacf7 commit a6b06bf
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 40 deletions.
24 changes: 14 additions & 10 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ EXTRA_DIST = \
test_scripts/test_hmr.test \
test_scripts/test_roi.test

### ADS: the file md5sum.txt can be regenerated by running the tests
### with "make check" and then doing `md5sum tests/* > md5sum.txt`
### from the build directory.

ACLOCAL_AMFLAGS = -I m4

SUBDIRS := src/smithlab_cpp src/abismal
Expand Down Expand Up @@ -184,18 +188,18 @@ dnmtools_SOURCES += src/mlml/mlml.cpp
## grep "^outfile" test_scripts/*.test
##
CLEANFILES = \
tests/tRex1.idx \
tests/reads.sam \
tests/reads.mstats \
tests/reads.bsrate \
tests/reads.counts.gz \
tests/reads.fmt.bam \
tests/reads.fmt.srt.bam \
tests/reads.counts \
tests/reads.counts.sym \
tests/reads.fmt.sam \
tests/reads.fmt.srt.sam \
tests/reads.fmt.srt.uniq.sam \
tests/reads.hmr \
tests/reads.levels \
tests/tRex1_promoters.roi.bed \
tests/reads.mstats \
tests/reads.sam \
tests/reads.ustats \
tests/simreads_1.fq \
tests/simreads_2.fq \
tests/reads.counts.sym \
tests/reads.fmt.srt.uniq.bam \
tests/reads.ustats
tests/tRex1.idx \
tests/tRex1_promoters.roi.bed
8 changes: 4 additions & 4 deletions data/md5sum.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
cd862d6d57ea148375ddec9935574dfb tests/reads_1.fq.gz
43947b43b6888a17d9e8036692ce54c5 tests/reads_2.fq.gz
96bfaea99753a9cf6193c5b7ced6d732 tests/reads.bsrate
0b617e1d8dfbf4df1846ca502ebba2f9 tests/reads.counts.gz
8e289a0d800c1165ca213812cbc75bdb tests/reads.counts
9af847370bbb0e78fdc0cd435a9f724f tests/reads.counts.sym
9d2826b98ae3642dbae75eef6f041cce tests/reads.fmt.bam
892cb87c55714055ff9dbd33132b0307 tests/reads.fmt.srt.bam
7dcb23a0ce5478f9cc16d1f8992bd5a4 tests/reads.fmt.srt.uniq.bam
4a27ffa9f858d8c32352d30c9623a338 tests/reads.fmt.sam
e832cd0a2b0e1cfa43364610663590f3 tests/reads.fmt.srt.sam
230fd48c3b9959a34078671770842fe6 tests/reads.fmt.srt.uniq.sam
6dabc63bcab01f8c2b03708dad6bc0b7 tests/reads.hmr
2610d1e63613e4e092f15aa132de3a20 tests/reads.levels
8ee3daa36fad0e196d6d86696abed3dc tests/reads.mstats
Expand Down
4 changes: 2 additions & 2 deletions test_scripts/test_abismal.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ outfile2=tests/reads.mstats
if [[ -e "${infile1}" && -e "${infile2}" && -e "${infile3}" ]]; then
./dnmtools abismal -s ${outfile2} -o ${outfile1} \
-i ${infile3} ${infile1} ${infile2};
x1=$(md5sum -c tests/md5sum.txt | grep ${outfile1} | cut -d ' ' -f 2)
x2=$(md5sum -c tests/md5sum.txt | grep ${outfile2} | cut -d ' ' -f 2)
x1=$(md5sum -c tests/md5sum.txt | grep "${outfile1}:" | cut -d ' ' -f 2)
x2=$(md5sum -c tests/md5sum.txt | grep "${outfile2}:" | cut -d ' ' -f 2)
if [[ "${x1}" != "OK" || "${x2}" != "OK" ]]; then
exit 1;
fi
Expand Down
2 changes: 1 addition & 1 deletion test_scripts/test_abismalidx.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ infile=tests/tRex1.fa
outfile=tests/tRex1.idx
if [[ -e "${infile}" ]]; then
./dnmtools abismalidx ${infile} ${outfile}
x=$(md5sum -c tests/md5sum.txt | grep ${outfile} | cut -d ' ' -f 2)
x=$(md5sum -c tests/md5sum.txt | grep "${outfile}:" | cut -d ' ' -f 2)
if [[ "${x}" != "OK" ]]; then
exit 1;
fi
Expand Down
4 changes: 2 additions & 2 deletions test_scripts/test_bsrate.test
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env bash

infile1=tests/reads.fmt.srt.uniq.bam
infile1=tests/reads.fmt.srt.uniq.sam
infile2=tests/tRex1.fa
outfile=tests/reads.bsrate
if [[ -e "${infile1}" && -e "${infile2}" ]]; then
./dnmtools bsrate -c ${infile2} -o ${outfile} ${infile1}
x=$(md5sum -c tests/md5sum.txt | grep ${outfile} | cut -d ' ' -f 2)
x=$(md5sum -c tests/md5sum.txt | grep "${outfile}:" | cut -d ' ' -f 2)
if [[ "${x}" != "OK" ]]; then
exit 1;
fi
Expand Down
8 changes: 4 additions & 4 deletions test_scripts/test_counts.test
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env bash

infile1=tests/reads.fmt.srt.uniq.bam
infile1=tests/reads.fmt.srt.uniq.sam
infile2=tests/tRex1.fa
outfile=tests/reads.counts.gz
outfile=tests/reads.counts
if [[ -e "${infile1}" && -e "${infile2}" ]]; then
./dnmtools counts -v -z -o ${outfile} -c ${infile2} ${infile1}
x=$(md5sum -c tests/md5sum.txt | grep ${outfile} | cut -d ' ' -f 2)
./dnmtools counts -v -o ${outfile} -c ${infile2} ${infile1}
x=$(md5sum -c tests/md5sum.txt | grep "${outfile}:" | cut -d ' ' -f 2)
if [[ "${x}" != "OK" ]]; then
exit 1;
fi
Expand Down
8 changes: 4 additions & 4 deletions test_scripts/test_format.test
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env bash

infile=tests/reads.sam
outfile1=tests/reads.fmt.bam
outfile2=tests/reads.fmt.srt.bam
outfile1=tests/reads.fmt.sam
outfile2=tests/reads.fmt.srt.sam
cmd=samtools
if [[ -e "${infile}" ]]; then
./dnmtools format -f abismal ${infile} ${outfile1}
x=$(md5sum -c tests/md5sum.txt | grep ${outfile1} | cut -d ' ' -f 2)
x=$(md5sum -c tests/md5sum.txt | grep "${outfile1}:" | cut -d ' ' -f 2)
### ADS: only want to check the first output here; any failure
### later will result in a skip for subsequent tests.
if [[ "${x}" != "OK" ]]; then
Expand All @@ -18,7 +18,7 @@ else
fi

if [[ -e $(type -P "${cmd}") ]]; then
samtools sort -o ${outfile2} ${outfile1};
samtools sort --no-PG -O SAM -o ${outfile2} ${outfile1};
else
echo "${cmd} not found"
fi
2 changes: 1 addition & 1 deletion test_scripts/test_hmr.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ infile=tests/reads.counts.sym
outfile=tests/reads.hmr
if [[ -e "${infile}" ]]; then
./dnmtools hmr -v -o ${outfile} ${infile}
x=$(md5sum -c tests/md5sum.txt | grep ${outfile} | cut -d ' ' -f 2)
x=$(md5sum -c tests/md5sum.txt | grep "${outfile}:" | cut -d ' ' -f 2)
if [[ "${x}" != "OK" ]]; then
exit 1;
fi
Expand Down
4 changes: 2 additions & 2 deletions test_scripts/test_levels.test
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env bash

infile=tests/reads.counts.gz
infile=tests/reads.counts
outfile=tests/reads.levels
if [[ -e "${infile}" ]]; then
./dnmtools levels -v -o ${outfile} ${infile}
x=$(md5sum -c tests/md5sum.txt | grep ${outfile} | cut -d ' ' -f 2)
x=$(md5sum -c tests/md5sum.txt | grep "${outfile}:" | cut -d ' ' -f 2)
if [[ "${x}" != "OK" ]]; then
exit 1;
fi
Expand Down
2 changes: 1 addition & 1 deletion test_scripts/test_roi.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ infile2=tests/tRex1_promoters.bed
outfile=tests/tRex1_promoters.roi.bed
if [[ -e "${infile1}" && -e "${infile2}" ]]; then
./dnmtools roi -v -M -o ${outfile} ${infile2} ${infile1}
x=$(md5sum -c tests/md5sum.txt | grep ${outfile} | cut -d ' ' -f 2)
x=$(md5sum -c tests/md5sum.txt | grep "${outfile}:" | cut -d ' ' -f 2)
if [[ "${x}" != "OK" ]]; then
exit 1;
fi
Expand Down
4 changes: 2 additions & 2 deletions test_scripts/test_simreads.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ outprefix=tests/simreads
if [[ -e "${infile}" ]]; then
./dnmtools simreads -seed 1 \
-o ${outprefix} -n 10000 -m 0.01 -b 0.98 ${infile};
x1=$(md5sum -c tests/md5sum.txt | grep ${outfile1} | cut -d ' ' -f 2)
x2=$(md5sum -c tests/md5sum.txt | grep ${outfile2} | cut -d ' ' -f 2)
x1=$(md5sum -c tests/md5sum.txt | grep "${outfile1}:" | cut -d ' ' -f 2)
x2=$(md5sum -c tests/md5sum.txt | grep "${outfile2}:" | cut -d ' ' -f 2)
if [[ "${x1}" != "OK" || "${x2}" != "OK" ]]; then
exit 1;
fi
Expand Down
4 changes: 2 additions & 2 deletions test_scripts/test_sym.test
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env bash

infile=tests/reads.counts.gz
infile=tests/reads.counts
outfile=tests/reads.counts.sym
if [[ -e "${infile}" ]]; then
./dnmtools sym -o ${outfile} ${infile}
x=$(md5sum -c tests/md5sum.txt | grep ${outfile} | cut -d ' ' -f 2)
x=$(md5sum -c tests/md5sum.txt | grep "${outfile}:" | cut -d ' ' -f 2)
if [[ "${x}" != "OK" ]]; then
exit 1;
fi
Expand Down
10 changes: 5 additions & 5 deletions test_scripts/test_uniq.test
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env bash

infile=tests/reads.fmt.srt.bam
outfile1=tests/reads.fmt.srt.uniq.bam
infile=tests/reads.fmt.srt.sam
outfile1=tests/reads.fmt.srt.uniq.sam
outfile2=tests/reads.ustats
if [[ -e "${infile}" ]]; then
./dnmtools uniq -v -B -S ${outfile2} ${infile} ${outfile1}
x1=$(md5sum -c tests/md5sum.txt | grep ${outfile1} | cut -d ' ' -f 2)
x2=$(md5sum -c tests/md5sum.txt | grep ${outfile2} | cut -d ' ' -f 2)
./dnmtools uniq -v -S ${outfile2} ${infile} ${outfile1}
x1=$(md5sum -c tests/md5sum.txt | grep "${outfile1}:" | cut -d ' ' -f 2)
x2=$(md5sum -c tests/md5sum.txt | grep "${outfile2}:" | cut -d ' ' -f 2)
if [[ "${x1}" != "OK" || "${x2}" != "OK" ]]; then
exit 1;
fi
Expand Down

0 comments on commit a6b06bf

Please sign in to comment.