| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
bin_dir="/usr/local/bin" |
| 4 |
bam2bed_bin="${bin_dir}/bam2bed" |
| 5 |
bam2starch_bin="${bin_dir}/bam2starch" |
| 6 |
|
| 7 |
echo "[bam2bed] testing sorted output..." |
| 8 |
sample_bam_fn="sample.bam" |
| 9 |
expected_sorted_bed_fn="sample.expected.bed" |
| 10 |
observed_sorted_bed_fn="$(mktemp /tmp/XXXXXX)" |
| 11 |
${bam2bed_bin} < ${sample_bam_fn} > ${observed_sorted_bed_fn} 2> /dev/null |
| 12 |
diff -q ${expected_sorted_bed_fn} ${observed_sorted_bed_fn} |
| 13 |
rm -f ${observed_sorted_bed_fn} |
| 14 |
|
| 15 |
echo "[bam2bed] testing split output..." |
| 16 |
split_bam_fn="split.bam" |
| 17 |
expected_split_bed_fn="split.expected.bed" |
| 18 |
observed_split_bed_fn="$(mktemp /tmp/XXXXXX)" |
| 19 |
${bam2bed_bin} --split < ${split_bam_fn} > ${observed_split_bed_fn} 2> /dev/null |
| 20 |
diff -q ${expected_split_bed_fn} ${observed_split_bed_fn} |
| 21 |
rm -f ${observed_split_bed_fn} |
| 22 |
|
| 23 |
echo "[bam2bed] testing starch (bzip2) output..." |
| 24 |
sample_bam_fn="sample.bam" |
| 25 |
expected_starch_fn="sample.expected.starch" |
| 26 |
observed_starch_fn="$(mktemp /tmp/XXXXXX)" |
| 27 |
${bam2starch_bin} < ${sample_bam_fn} > ${observed_starch_fn} 2> /dev/null |
| 28 |
diff -q <(unstarch ${expected_starch_fn}) <(unstarch ${observed_starch_fn}) |
| 29 |
rm -f ${observed_starch_fn} |
| 30 |
|
| 31 |
echo "[bam2bed] testing starch (gzip) output..." |
| 32 |
sample_bam_fn="sample.bam" |
| 33 |
expected_starch_fn="sample.expected.starch" |
| 34 |
observed_starch_fn="$(mktemp /tmp/XXXXXX)" |
| 35 |
${bam2starch_bin} --starch-gzip < ${sample_bam_fn} > ${observed_starch_fn} 2> /dev/null |
| 36 |
diff -q <(unstarch ${expected_starch_fn}) <(unstarch ${observed_starch_fn}) |
| 37 |
rm -f ${observed_starch_fn} |
| 38 |
|
| 39 |
echo "[bam2bed] tests complete!" |