changeset 45:b5b253a92efe

Uploaded
author da-intersect
date Mon, 06 May 2013 20:31:34 -0400
parents 4006278af368
children 739bf5324d63
files samifier.sh
diffstat 1 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/samifier.sh	Mon May 06 20:31:34 2013 -0400
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# Check java version
+if (type -p java >> /dev/null); then
+    _java=java
+elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]];  then
+    _java="$JAVA_HOME/bin/java"
+else
+    echo "You must install java before runing this tool"
+    exit 1
+fi
+if [[ "$_java" ]]; then
+    version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
+    if ! [[ "$version" > "1.6" ]]; then
+        echo "Java version should be > 1.6"
+	exit 1
+    fi
+fi
+
+# Locate the jar directory
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+jar_path="${DIR}/${1}"
+shift
+
+# Untar the chromosome file into a temporary directory
+tar_file="$1"
+shift
+tmp_dir="/tmp/$(basename "$tar_file")"
+mkdir -p $tmp_dir
+tar -C $tmp_dir -xvf $tar_file
+
+# Run the jar and remove the temporary directory
+java -Xmx3072M -jar $jar_path $@ -c "$tmp_dir"
+rm -rf $tmp_dir