| 1 | #!/usr/bin/env bash |
|---|
| 2 | # |
|---|
| 3 | # Galaxy wrapper for Aakrosh Ratan's ldtools |
|---|
| 4 | # |
|---|
| 5 | |
|---|
| 6 | set -e |
|---|
| 7 | |
|---|
| 8 | export PATH=$PATH:$(dirname $0) |
|---|
| 9 | |
|---|
| 10 | ## pagetag options |
|---|
| 11 | input= |
|---|
| 12 | rsquare=0.64 |
|---|
| 13 | freq=0.00 |
|---|
| 14 | sample=### |
|---|
| 15 | |
|---|
| 16 | ## senatag options |
|---|
| 17 | excluded=### |
|---|
| 18 | required=### |
|---|
| 19 | output= |
|---|
| 20 | |
|---|
| 21 | until [ $# -eq 0 ] |
|---|
| 22 | do |
|---|
| 23 | case $1 in |
|---|
| 24 | rsquare=*) |
|---|
| 25 | rsquare=${1#rsquare=} |
|---|
| 26 | ;; |
|---|
| 27 | freq=*) |
|---|
| 28 | freq=${1#freq=} |
|---|
| 29 | ;; |
|---|
| 30 | input=*) |
|---|
| 31 | input=${1#input=} |
|---|
| 32 | ;; |
|---|
| 33 | output=*) |
|---|
| 34 | output=${1#output=} |
|---|
| 35 | ;; |
|---|
| 36 | *) |
|---|
| 37 | if [ -z "$new_args" ]; then |
|---|
| 38 | new_args=$1 |
|---|
| 39 | else |
|---|
| 40 | new_args="$new_args $1" |
|---|
| 41 | fi |
|---|
| 42 | ;; |
|---|
| 43 | esac |
|---|
| 44 | |
|---|
| 45 | shift |
|---|
| 46 | done |
|---|
| 47 | |
|---|
| 48 | ## run pagetag |
|---|
| 49 | pagetag.py --rsquare $rsquare --freq $freq $input snps.txt neighborhood.txt &> /dev/null |
|---|
| 50 | if [ $? -ne 0 ]; then |
|---|
| 51 | echo "failed: pagetag.py --rsquare $rsquare --freq $freq $input snps.txt neighborhood.txt" |
|---|
| 52 | exit 1 |
|---|
| 53 | fi |
|---|
| 54 | |
|---|
| 55 | ## run sentag |
|---|
| 56 | senatag.py neighborhood.txt snps.txt > $output 2> /dev/null |
|---|
| 57 | if [ $? -ne 0 ]; then |
|---|
| 58 | echo "failed: senatag.py neighborhood.txt snps.txt" |
|---|
| 59 | exit 1 |
|---|
| 60 | fi |
|---|
| 61 | |
|---|
| 62 | ## cleanup |
|---|
| 63 | rm -f snps.txt neighborhood.txt |
|---|
| 64 | |
|---|