-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Two start scripts are created: igv: regular starter. Script looks after memory and gets a bit chatty if too much or too less is found. igvxmem: lets the user set the java VM-memory (-Xmx...)
Showing
1 changed file
with
113 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
#! /bin/bash | ||
|
||
# http://software.broadinstitute.org/software/igv/ | ||
|
||
set -e | ||
|
||
PKG=igv | ||
VERSION=2.4.14 | ||
VERSION2=$(echo $VERSION | cut -d. -f1,2) | ||
BUILD=0 | ||
|
||
PREFIX=/pkg/$PKG-$VERSION-$BUILD | ||
# PREFIX=/dev/shm/$PKG-$VERSION-$BUILD | ||
|
||
mkdir -p $PREFIX | ||
cd $PREFIX | ||
mkdir -p attic | ||
|
||
if test -e attic/IGV_$VERSION.zip ; then | ||
rm -vr bin | ||
mv attic/IGV_$VERSION.zip . | ||
else | ||
wget http://data.broadinstitute.org/igv/projects/downloads/$VERSION2/IGV_$VERSION.zip | ||
fi | ||
|
||
unzip IGV_$VERSION.zip | ||
|
||
mkdir -p attic | ||
mv IGV_$VERSION.zip attic | ||
|
||
mv IGV_$VERSION bin | ||
|
||
mv bin/readme.txt attic # this one lies! | ||
mv bin/igv.sh attic | ||
rm bin/igv.command | ||
|
||
cat >$PREFIX/profile <<-EOF | ||
PATH=$PREFIX/bin:\$PATH | ||
EOF | ||
|
||
# try to be smarter with the memory | ||
|
||
cat >bin/igv <<-'EOF' | ||
#!/bin/sh | ||
#-Xmx4g indicates 4 gb of memory, adjust number up or down as needed | ||
#Script must be in the same directory as igv.jar | ||
#Add the flag -Ddevelopment = true to use features still in development | ||
MEM_KB=$(grep 'MemTotal:' /proc/meminfo | head -1 | rev | cut -d' ' -f2 | rev) | ||
MEM_GB=$(( $MEM_KB/1024/1024 )) | ||
CONSIDER="# Consider using 'igvxmem XYZg' to start igv with proper memory setup." | ||
if test $MEM_GB -lt 4; then | ||
MSG="# This is faily below the suitable amount of 4 GB.\n$CONSIDER" | ||
elif test $MEM_GB -gt 9 ; then | ||
MSG="$CONSIDER\n# To gain better performance you may increase the memory in sane steps." | ||
fi | ||
if test -n "$MSG"; then | ||
echo '# NOTE:' | ||
echo "# found approx. $MEM_GB GB of Memory on your host." | ||
echo '#' | ||
echo -e "$MSG" | ||
echo '#' | ||
echo '# igv with default settings will start in 5 seconds ...' | ||
sleep 5 | ||
fi | ||
prefix=`dirname \$(readlink \$0 || echo \$0)` | ||
exec java -Xmx4g \ | ||
-Dapple.laf.useScreenMenuBar=true \ | ||
-Djava.net.preferIPv4Stack=true \ | ||
-jar "$prefix"/lib/igv.jar "$@" | ||
EOF | ||
|
||
chmod 755 bin/igv | ||
|
||
cat >bin/igvxmem <<-'EOF' | ||
#!/bin/sh | ||
#-Xmx4g indicates 4 gb of memory, adjust number up or down as needed | ||
#Script must be in the same directory as igv.jar | ||
#Add the flag -Ddevelopment = true to use features still in development | ||
MEM=4g | ||
case $1 in | ||
[1-9]g |\ | ||
[1-9][0-9]g |\ | ||
[1-2][0-9][0-9]g) | ||
MEM=$1 | ||
shift | ||
;; | ||
*) | ||
echo "# Error: need a proper value for memory to use, eg. 8g" | ||
exit 1 | ||
;; | ||
esac | ||
prefix=`dirname \$(readlink \$0 || echo \$0)` | ||
exec java -Xmx$MEM \ | ||
-Dapple.laf.useScreenMenuBar=true \ | ||
-Djava.net.preferIPv4Stack=true \ | ||
-jar "$prefix"/lib/igv.jar "$@" | ||
EOF | ||
|
||
|
||
chmod 755 bin/igvxmem |