123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- #! /bin/bash
- function precollated_fq_1
- {
- cat <<EOF
- @A/1
- ACGTACGT
- +
- HGFEDCBA
- EOF
- }
- function precollated_fq_2
- {
- cat <<EOF
- @A/2
- GTCAGTCA
- +
- GHGFEDCB
- EOF
- }
- function precollated_fq
- {
- precollated_fq_1
- precollated_fq_2
- }
- function runopts
- {
- ../src/fastqtobam $* <(precollated_fq) | ../src/bamtofastq | cmp <(precollated_fq)
- # copy pipe return status array
- PIPESTAT=( ${PIPESTATUS[*]} )
- if [ ${PIPESTAT[0]} -ne 0 ] ; then
- echo 'fastqtobam failed'
- return 1
- elif [ ${PIPESTAT[1]} -ne 0 ] ; then
- echo 'bamtofastq failed'
- return 1
- elif [ ${PIPESTAT[2]} -ne 0 ] ; then
- echo 'cmp failed'
- return 1
- else
- return 0
- fi
- }
- function runopts2
- {
- ../src/fastqtobam $* <(precollated_fq_1) <(precollated_fq_2) | ../src/bamtofastq | cmp <(precollated_fq)
- # copy pipe return status array
- PIPESTAT=( ${PIPESTATUS[*]} )
- if [ ${PIPESTAT[0]} -ne 0 ] ; then
- echo 'fastqtobam failed'
- return 1
- elif [ ${PIPESTAT[1]} -ne 0 ] ; then
- echo 'bamtofastq failed'
- return 1
- elif [ ${PIPESTAT[2]} -ne 0 ] ; then
- echo 'cmp failed'
- return 1
- else
- return 0
- fi
- }
- function runoptsfile
- {
- ../src/fastqtobam $* <(precollated_fq) | ../src/bamtofastq filename=/dev/stdin | cmp <(precollated_fq)
- # copy pipe return status array
- PIPESTAT=( ${PIPESTATUS[*]} )
- if [ ${PIPESTAT[0]} -ne 0 ] ; then
- echo 'fastqtobam failed'
- return 1
- elif [ ${PIPESTAT[1]} -ne 0 ] ; then
- echo 'bamtofastq failed'
- return 1
- elif [ ${PIPESTAT[2]} -ne 0 ] ; then
- echo 'cmp failed'
- return 1
- else
- return 0
- fi
- }
- function runoptsfile2
- {
- ../src/fastqtobam $* <(precollated_fq_1) <(precollated_fq_2) | ../src/bamtofastq filename=/dev/stdin | cmp <(precollated_fq)
- # copy pipe return status array
- PIPESTAT=( ${PIPESTATUS[*]} )
- if [ ${PIPESTAT[0]} -ne 0 ] ; then
- echo 'fastqtobam failed'
- return 1
- elif [ ${PIPESTAT[1]} -ne 0 ] ; then
- echo 'bamtofastq failed'
- return 1
- elif [ ${PIPESTAT[2]} -ne 0 ] ; then
- echo 'cmp failed'
- return 1
- else
- return 0
- fi
- }
- function runoptsgz
- {
- ../src/fastqtobam $* <(precollated_fq) | ../src/bamtofastq gz=1 | zcat | cmp <(precollated_fq)
- # copy pipe return status array
- PIPESTAT=( ${PIPESTATUS[*]} )
- if [ ${PIPESTAT[0]} -ne 0 ] ; then
- echo 'fastqtobam failed'
- return 1
- elif [ ${PIPESTAT[1]} -ne 0 ] ; then
- echo 'bamtofastq failed'
- return 1
- elif [ ${PIPESTAT[2]} -ne 0 ] ; then
- echo 'cmp failed'
- return 1
- else
- return 0
- fi
- }
- function runoptsgz2
- {
- ../src/fastqtobam $* <(precollated_fq_1) <(precollated_fq_2) | ../src/bamtofastq gz=1 | zcat | cmp <(precollated_fq)
- # copy pipe return status array
- PIPESTAT=( ${PIPESTATUS[*]} )
- if [ ${PIPESTAT[0]} -ne 0 ] ; then
- echo 'fastqtobam failed'
- return 1
- elif [ ${PIPESTAT[1]} -ne 0 ] ; then
- echo 'bamtofastq failed'
- return 1
- elif [ ${PIPESTAT[2]} -ne 0 ] ; then
- echo 'cmp failed'
- return 1
- else
- return 0
- fi
- }
- #
- runopts ; R=$? ; if [ ${R} -ne 0 ] ; then exit ${R} ; fi
- runopts namescheme=generic ; R=$? ; if [ ${R} -ne 0 ] ; then exit ${R} ; fi
- echo "This is expected to fail:"
- runopts namescheme=c18s ; R=$? ; if [ ${R} -eq 0 ] ; then exit 1 ; fi
- echo "This is expected to fail:"
- runopts namescheme=c18pe ; R=$? ; if [ ${R} -eq 0 ] ; then exit 1 ; fi
- runopts namescheme=pairedfiles ; R=$? ; if [ ${R} -ne 0 ] ; then exit ${R} ; fi
- runopts2 ; R=$? ; if [ ${R} -ne 0 ] ; then exit ${R} ; fi
- runopts2 namescheme=generic ; R=$? ; if [ ${R} -ne 0 ] ; then exit ${R} ; fi
- echo "This is expected to fail:"
- runopts2 namescheme=c18s ; R=$? ; if [ ${R} -eq 0 ] ; then exit 1 ; fi
- echo "This is expected to fail:"
- runopts2 namescheme=c18pe ; R=$? ; if [ ${R} -eq 0 ] ; then exit 1 ; fi
- runopts2 namescheme=pairedfiles ; R=$? ; if [ ${R} -ne 0 ] ; then exit ${R} ; fi
- #
- runoptsfile ; R=$? ; if [ ${R} -ne 0 ] ; then exit ${R} ; fi
- runoptsfile namescheme=generic ; R=$? ; if [ ${R} -ne 0 ] ; then exit ${R} ; fi
- echo "This is expected to fail:"
- runoptsfile namescheme=c18s ; R=$? ; if [ ${R} -eq 0 ] ; then exit 1 ; fi
- echo "This is expected to fail:"
- runoptsfile namescheme=c18pe ; R=$? ; if [ ${R} -eq 0 ] ; then exit 1 ; fi
- runoptsfile namescheme=pairedfiles ; R=$? ; if [ ${R} -ne 0 ] ; then exit ${R} ; fi
- runoptsfile2 ; R=$? ; if [ ${R} -ne 0 ] ; then exit ${R} ; fi
- runoptsfile2 namescheme=generic ; R=$? ; if [ ${R} -ne 0 ] ; then exit ${R} ; fi
- echo "This is expected to fail:"
- runoptsfile2 namescheme=c18s ; R=$? ; if [ ${R} -eq 0 ] ; then exit 1 ; fi
- echo "This is expected to fail:"
- runoptsfile2 namescheme=c18pe ; R=$? ; if [ ${R} -eq 0 ] ; then exit 1 ; fi
- runoptsfile2 namescheme=pairedfiles ; R=$? ; if [ ${R} -ne 0 ] ; then exit ${R} ; fi
- # gzip
- runoptsgz ; R=$? ; if [ ${R} -ne 0 ] ; then exit ${R} ; fi
- runoptsgz namescheme=generic ; R=$? ; if [ ${R} -ne 0 ] ; then exit ${R} ; fi
- echo "This is expected to fail:"
- runoptsgz namescheme=c18s ; R=$? ; if [ ${R} -eq 0 ] ; then exit 1 ; fi
- echo "This is expected to fail:"
- runoptsgz namescheme=c18pe ; R=$? ; if [ ${R} -eq 0 ] ; then exit 1 ; fi
- runoptsgz namescheme=pairedfiles ; R=$? ; if [ ${R} -ne 0 ] ; then exit ${R} ; fi
- runoptsgz2 ; R=$? ; if [ ${R} -ne 0 ] ; then exit ${R} ; fi
- runoptsgz2 namescheme=generic ; R=$? ; if [ ${R} -ne 0 ] ; then exit ${R} ; fi
- echo "This is expected to fail:"
- runoptsgz2 namescheme=c18s ; R=$? ; if [ ${R} -eq 0 ] ; then exit 1 ; fi
- echo "This is expected to fail:"
- runoptsgz2 namescheme=c18pe ; R=$? ; if [ ${R} -eq 0 ] ; then exit 1 ; fi
- runoptsgz2 namescheme=pairedfiles ; R=$? ; if [ ${R} -ne 0 ] ; then exit ${R} ; fi
- exit ${R}
|