Shayan Doust pushed to branch master at Debian Med / covtobed
Commits: 1a7224f5 by Shayan Doust at 2020-06-04T13:27:51+01:00 Add more example data to covtobed-examples - - - - - f173df56 by Shayan Doust at 2020-06-04T13:39:11+01:00 Patch test script so it uses covtobed binary installed on system and works with autopkgtest - - - - - 3 changed files: - debian/covtobed-examples.install - + debian/patches/series - + debian/patches/test_use_system_installed_binary.patch Changes: ===================================== debian/covtobed-examples.install ===================================== @@ -1 +1,2 @@ -test/ usr/share/doc/covtobed-examples/ +test/* usr/share/doc/covtobed-examples/examples +example_data/* usr/share/doc/covtobed-examples/examples ===================================== debian/patches/series ===================================== @@ -0,0 +1 @@ +test_use_system_installed_binary.patch ===================================== debian/patches/test_use_system_installed_binary.patch ===================================== @@ -0,0 +1,144 @@ +Description: modify test script so it works with autopkgtest +Author: Shayan Doust <[email protected]> +Last-Update: 2020-06-04 +--- +--- covtobed.orig/test/test.sh ++++ covtobed/test/test.sh +@@ -7,40 +7,20 @@ + # ./test/mock.bam + + REMOVE=0 +-if [ ! -e "test/demo.bam" ]; then +- echo "WARNING: running this test from a bad location" +- DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +- cd "$DIR"/.. +-fi +- +-if [ ! -e "./covtobed" ]; then +- REMOVE=1 +- echo "WARNING:" +- echo "Binary not found: tring to use pre-compiled..."; +- if [ `uname` == 'Darwin' ]; then +- echo " - Copying macOS binary" || echo " ERROR: pre-compiled binary not working" +- cp ./binaries/covtobed_mac ./covtobed +- covtobed --version +- else +- echo " - Trying Ubuntu binary" +- cp ./binaries/covtobed ./covtobed +- covtobed --version || echo " ERROR: pre-compiled binary not working" +- fi +-fi + +-./covtobed --version ++covtobed --version + + set -eou pipefail + # Compilation success, checking that --version emits the expected "progname" string + echo -n " - Compiled binary prints version: " +-if [ $(./covtobed --version | grep covtobed | wc -l ) -eq "1" ]; ++if [ $(covtobed --version | grep covtobed | wc -l ) -eq "1" ]; + then + echo PASS 1 + fi + + # Testing that -m MIN produces an output, and it fits the expectation for demo.bam (n. lines) + echo -n " - Minimum coverage, expected BED lines check: " +-if [ $(./covtobed -m 15 test/demo.bam | wc -l) -eq "12" ]; ++if [ $(covtobed -m 15 /usr/share/doc/covtobed-examples/examples/demo.bam | wc -l) -eq "12" ]; + then + echo PASS 2 + else +@@ -50,7 +30,7 @@ + + # Checking thath --physical-coverage will work, and it fits the expected number of lines + echo -n " - Physical coverage, expected BED lines check: " +-if [ $(./covtobed --physical-coverage test/mp.bam | wc -l) -eq "136" ]; ++if [ $(covtobed --physical-coverage /usr/share/doc/covtobed-examples/examples/mp.bam | wc -l) -eq "136" ]; + then + echo PASS 3 + else +@@ -60,7 +40,7 @@ + + # Checking stranded output: it should produce content in the fifth column of the bed file + echo -n " - Stranded output, testing column #5: " +-if [ $(./covtobed --out test/demo.bam | cut -f 5 | sort -u | wc -l) -eq "10" ]; ++if [ $(covtobed --out /usr/share/doc/covtobed-examples/examples/demo.bam | cut -f 5 | sort -u | wc -l) -eq "10" ]; + then + echo PASS 4 + else +@@ -70,7 +50,7 @@ + + # Checking the "counts" output (counting the lines containing a ">") + echo -n " - Testing 'counts' format (printed headers): " +-if [ $(./covtobed --format counts test/demo.bam | grep '>' | wc -l) -eq "2" ]; ++if [ $(covtobed --format counts /usr/share/doc/covtobed-examples/examples/demo.bam | grep '>' | wc -l) -eq "2" ]; + then + echo PASS 5 + else +@@ -78,7 +58,7 @@ + exit 1 + fi + echo -n " - Testing 'counts' format (printed lines): " +-if [ $(./covtobed --format counts test/demo.bam | grep -v '>' | wc -l) -eq "202" ]; ++if [ $(covtobed --format counts /usr/share/doc/covtobed-examples/examples/demo.bam | grep -v '>' | wc -l) -eq "202" ]; + then + echo PASS 6 + else +@@ -88,8 +68,8 @@ + + # Checking BED output with reference output file + echo -n " - Checking identity of BED output with pre-calculated: " +-./covtobed test/demo.bam > test/output.test +-if [ $(diff test/output.test test/output.bed | wc -l) -eq "0" ]; ++covtobed /usr/share/doc/covtobed-examples/examples/demo.bam > output.test ++if [ $(diff output.test /usr/share/doc/covtobed-examples/examples/output.bed | wc -l) -eq "0" ]; + then + echo PASS 7 + rm test/output.test +@@ -100,8 +80,8 @@ + + ## Synthetic BAM test + echo -n " - Checking computed coverage for a synthetic BAM file: " +-./covtobed -m 1 test/mock.bam > test/output.test +-if [ $(diff test/output.test test/mock.bed | wc -l) -eq "0" ]; ++covtobed -m 1 /usr/share/doc/covtobed-examples/examples/mock.bam > output.test ++if [ $(diff output.test /usr/share/doc/covtobed-examples/examples/mock.bed | wc -l) -eq "0" ]; + then + echo PASS 8 + rm test/output.test +@@ -112,23 +92,23 @@ + + ## Filter non valid alignments + echo -n " - Checking filtering of invalid alignments: " +-if [ $(./covtobed -m 1 -d test/filtered.bam | wc -l) -eq "2" ] ; then ++if [ $(covtobed -m 1 -d /usr/share/doc/covtobed-examples/examples/filtered.bam | wc -l) -eq "2" ] ; then + echo -n "PASS 9," + else + echo FAIL + exit 1 + fi +-if [ $(./covtobed -m 1 test/filtered.bam | wc -l) -eq "6" ] ; then ++if [ $(covtobed -m 1 /usr/share/doc/covtobed-examples/examples/filtered.bam | wc -l) -eq "6" ] ; then + echo 10 + else +- echo "FAIL: $(./covtobed -m 1 -d test/filtered.bam | wc -l)" ++ echo "FAIL: $(covtobed -m 1 -d /usr/share/doc/covtobed-examples/examples/filtered.bam | wc -l)" + exit 1 + fi + + # A synthetic BAM containing reference name {n}X that should only print one reagion + # covered exactly {n}X times + echo " - Checking artificial coverage values:" +-./covtobed test/test_cov.bam -m 1 |cut -f 1,4| while read LINE; ++covtobed /usr/share/doc/covtobed-examples/examples/test_cov.bam -m 1 |cut -f 1,4| while read LINE; + do + echo "$LINE" | perl -ne '($exp, $cov)=split /\s+/, $_; if ("$exp" ne "${cov}X") { + die "$exp != $cov\n"; +@@ -137,7 +117,3 @@ + }' + done + echo "ALL TESTS: PASSED" +- +-if [[ $REMOVE -eq 1 ]]; then +- rm ./covtobed +-fi View it on GitLab: https://salsa.debian.org/med-team/covtobed/-/compare/b3e2773294ecb4ac8daacc4b597e3c025b64e73d...f173df5696a49a31b75bebb2dbab036e405daf29 -- View it on GitLab: https://salsa.debian.org/med-team/covtobed/-/compare/b3e2773294ecb4ac8daacc4b597e3c025b64e73d...f173df5696a49a31b75bebb2dbab036e405daf29 You're receiving this email because of your account on salsa.debian.org.
_______________________________________________ debian-med-commit mailing list [email protected] https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/debian-med-commit
