| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
bin_dir="/usr/local/bin" |
| 4 |
wig2bed_bin="${bin_dir}/wig2bed" |
| 5 |
wig2starch_bin="${bin_dir}/wig2starch" |
| 6 |
|
| 7 |
for idx in $(seq 1 5) |
| 8 |
do |
| 9 |
echo "[wig2bed] testing output [$idx]..." |
| 10 |
sample_wig_fn="sample_$idx.wig" |
| 11 |
expected_sorted_bed_fn="sample_$idx.expected.bed" |
| 12 |
observed_sorted_bed_fn="$(mktemp /tmp/XXXXXX)" |
| 13 |
${wig2bed_bin} < ${sample_wig_fn} > ${observed_sorted_bed_fn} 2> /dev/null |
| 14 |
diff -q ${expected_sorted_bed_fn} ${observed_sorted_bed_fn} |
| 15 |
rm -f ${observed_sorted_bed_fn} |
| 16 |
|
| 17 |
echo "[wig2bed] testing starch (bzip2) output [$idx]..." |
| 18 |
sample_wig_fn="sample_$idx.wig" |
| 19 |
expected_starch_fn="sample_$idx.expected.starch" |
| 20 |
observed_starch_fn="$(mktemp /tmp/XXXXXX)" |
| 21 |
${wig2starch_bin} < ${sample_wig_fn} > ${observed_starch_fn} 2> /dev/null |
| 22 |
diff -q <(unstarch ${expected_starch_fn}) <(unstarch ${observed_starch_fn}) |
| 23 |
rm -f ${observed_starch_fn} |
| 24 |
|
| 25 |
echo "[wig2bed] testing starch (gzip) output [$idx]..." |
| 26 |
sample_wig_fn="sample_$idx.wig" |
| 27 |
expected_starch_fn="sample_$idx.expected.gzip.starch" |
| 28 |
observed_starch_fn="$(mktemp /tmp/XXXXXX)" |
| 29 |
${wig2starch_bin} --starch-gzip < ${sample_wig_fn} > ${observed_starch_fn} 2> /dev/null |
| 30 |
diff -q <(unstarch ${expected_starch_fn}) <(unstarch ${observed_starch_fn}) |
| 31 |
rm -f ${observed_starch_fn} |
| 32 |
done |
| 33 |
|
| 34 |
idx=6 |
| 35 |
|
| 36 |
echo "[wig2bed] testing output [$idx]..." |
| 37 |
sample_wig_fn="sample_$idx.wig" |
| 38 |
expected_sorted_bed_fn="sample_$idx.expected.bed" |
| 39 |
observed_sorted_bed_fn="$(mktemp /tmp/XXXXXX)" |
| 40 |
${wig2bed_bin} --keep-header --multisplit="foo" < ${sample_wig_fn} > ${observed_sorted_bed_fn} 2> /dev/null |
| 41 |
diff -q ${expected_sorted_bed_fn} ${observed_sorted_bed_fn} |
| 42 |
rm -f ${observed_sorted_bed_fn} |
| 43 |
|
| 44 |
echo "[wig2bed] testing starch (bzip2) output [$idx]..." |
| 45 |
sample_wig_fn="sample_$idx.wig" |
| 46 |
expected_starch_fn="sample_$idx.expected.starch" |
| 47 |
observed_starch_fn="$(mktemp /tmp/XXXXXX)" |
| 48 |
${wig2starch_bin} --keep-header --multisplit="foo" < ${sample_wig_fn} > ${observed_starch_fn} 2> /dev/null |
| 49 |
diff -q <(unstarch ${expected_starch_fn}) <(unstarch ${observed_starch_fn}) |
| 50 |
rm -f ${observed_starch_fn} |
| 51 |
|
| 52 |
echo "[wig2bed] testing starch (gzip) output [$idx]..." |
| 53 |
sample_wig_fn="sample_$idx.wig" |
| 54 |
expected_starch_fn="sample_$idx.expected.gzip.starch" |
| 55 |
observed_starch_fn="$(mktemp /tmp/XXXXXX)" |
| 56 |
${wig2starch_bin} --starch-gzip --keep-header --multisplit="foo" < ${sample_wig_fn} > ${observed_starch_fn} 2> /dev/null |
| 57 |
diff -q <(unstarch ${expected_starch_fn}) <(unstarch ${observed_starch_fn}) |
| 58 |
rm -f ${observed_starch_fn} |
| 59 |
|
| 60 |
echo "[wig2bed] tests complete!" |