-
-
Save arahuja/6c09833125ae9bbfddc6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
SCRIPT_NAME=$(basename $0) | |
short_usage() | |
{ | |
echo "Cf : $SCRIPT_NAME [--help]" | |
} | |
long_usage() | |
{ | |
echo "Post VCFs to Cycledash" | |
echo " Description : " | |
echo "Usage :" | |
echo "-----" | |
echo " $SCRIPT_NAME {--help,-h,}" | |
echo "" | |
echo "Options :" | |
echo "-------" | |
echo "" | |
} | |
if [ "$1" = "--help" ] | |
then | |
long_usage ; | |
exit | |
fi | |
if [ $# -eq 0 ] | |
then | |
short_usage ; | |
exit | |
fi | |
while getopts hv:d:T:V:U:t:n:r:p:w: option | |
do | |
case $option in | |
h ) long_usage ; exit ;; | |
V ) export VCF_PATH=$OPTARG ;; | |
v ) export VARIANT_CALLER_NAME=$OPTARG ;; | |
d ) export DATASET=$OPTARG ;; | |
T ) export TRUTH_VCF=$OPTARG ;; | |
U ) export CYCLEDASH_URL=$OPTARG ;; | |
t ) export TUMOR_BAM=$OPTARG ;; | |
n ) export NORMAL_BAM=$OPTARG ;; | |
r ) export REF_PATH=$OPTARG ;; | |
p ) export PARAMS=$OPTARG ;; | |
w ) export WITNESS=$OPTARG ;; | |
\?) short_usage ; exit 2 ;; | |
esac | |
done | |
curl=curl | |
# tmp_file=`mktemp /tmp/bbXXX` | |
# $curl -f $CYCLEDASH_URL/runs > $tmp_file | |
# if [ `cat $tmp_file | wc -l` -lt 2 ] ; then | |
tmp_json=`mktemp /tmp/bbXXX` | |
cat <<EOF > $tmp_json | |
{ | |
"uri": "$VCF_PATH", | |
"variantCallerName": "$VARIANT_CALLER_NAME", | |
"projectName": "$DATASET", | |
"tumorBamUri": "$TUMOR_BAM", | |
"normalBamUri": "$NORMAL_BAM", | |
"params": " | |
EOF | |
echo ${PARAMS} | sed 's/"/\\"/g' >> $tmp_json | |
echo '" }' >> $tmp_json | |
$curl -H 'Content-Type: application/json' -f $CYCLEDASH_URL/runs --data @$tmp_json -o $WITNESS | |
# else | |
# exit 3 | |
# fi | |
shift `expr $OPTIND - 1` | |
if [ $# -ne 0 ] ; then | |
for arg in $*; do | |
echo "Don't know what to do with: $arg" | |
done | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment