Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 103 lines (77 sloc) 2.17 KB
#! /bin/bash
# http://software.broadinstitute.org/software/igv/
## https://data.broadinstitute.org/igv/projects/downloads/2.15/IGV_2.15.2.zip
set -xe
PKG=igv
VERSION=2.15.2
BUILD=0
PREFIX=/pkg/$PKG-$VERSION-$BUILD
if [ -n "$TESTING" ]; then PREFIX=/scratch/local2/$USER/$PKG-$VERSION-$BUILD ; fi
mkdir -p $PREFIX
cat >$PREFIX/profile <<-EOF
. /pkg/openjdk-11.0.3.2-0/profile
PATH=$PREFIX:\$PATH
if [ -d $PREFIX/.compatlibs ]; then export LD_LIBRARY_PATH=$PREFIX/.compatlibs\${LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH ; fi
EOF
. $PREFIX/profile
BUILDDIR=$PREFIX/build
mkdir -p $BUILDDIR
cd $BUILDDIR
BEEHIVE=https://beehive.molgen.mpg.de/0c790465bf203bd018ea46c058ec5585/IGV_2.15.2.zip
test -e IGV_$VERSION.zip || wget -nv $BEEHIVE
test -d IGV_$VERSION || bsdtar -xf IGV_$VERSION.zip
mv IGV_$VERSION/* $PREFIX
# intentionally fail if not empty
rmdir IGV_$VERSION
cd $PREFIX
cat >igv <<-'EOF'
#!/bin/sh
die() { echo $1; exit 1; }
parse_mem() {
case $1 in
[1-9]g | [1-9][0-9]g | [1-2][0-9][0-9]g)
IGVXMX=$1 ;;
*)
die "# Error: need a proper value for memory to use, eg. 8g" ;;
esac
}
script=`basename $0`
IGVXMX=${IGVXMX:-8g}
export IGVXMX
case "$script" in
igvxmem_hidpi)
parse_mem $1; shift
exec igv_hidpi.sh "$@" ;;
igvxmem)
parse_mem $1; shift
exec igv.sh "$@" ;;
esac
MEM_KB=$(grep -m1 'MemTotal:' /proc/meminfo | 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 7; then
MSG="# This is fairly below the suitable amount of 8 GB.\n$CONSIDER"
elif test $MEM_GB -gt 17 ; 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 3 seconds ...'
sleep 3
fi
case "$script" in
igv_hidpi)
exec igv_hidpi.sh "$@" ;;
*)
exec igv.sh "$@" ;;
esac
EOF
chmod 755 igv
ln -s igv igvxmem
ln -s igv igv_hidpi
ln -s igv igvxmem_hidpi
exit