Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/sh
set -eu
# WARNING: you need to adapt the dependency list first
#
# shell script allowing to install all CRISPRCasFinder.pl-v4.2's dependencies
#
# same version than CRISPRCasFinder.pl, here 4.2.17
# authors: David Couvin, Fabrice Leclerc, Claire Toffano-Nioche
# adapted to non sudo install by M. Dondrup
packageManagmentInstall='conda install '
distribution='Linux_x86_64'
#------------------------
function launchInstall {
# $1 $packageManagmentInstall
# $2 package name
# $3 $LOGFILE
echo "Installation of $2" >> $3
$1 $2 | tee -a $3
}
#------------------------
#save the current directory:
CURDIR=`pwd`
#create log file:
LOGFILE=$CURDIR/crisprcasfinder-install.log
#create src & bin folders:
echo "create $CURDIR/src and $CURDIR/bin folders" >> $LOGFILE
mkdir -p src;
mkdir -p bin;
#geting OS info:
ostype=`echo $OSTYPE`
echo "$ostype" >> $LOGFILE
CONDA=`which conda`
if [ "$CONDAxxx" = "xxx" ]; then
echo 'Sorry, you need conda and activate bioconda'
exit 1
else
#important packages
# not sure these need to be installed in conda:
launchInstall "$packageManagmentInstall" "wget" "$LOGFILE"
# don't see any use of curl
launchInstall "$packageManagmentInstall" "curl" "$LOGFILE"
# don't see any use of git
launchInstall "$packageManagmentInstall" "git" "$LOGFILE"
# which version is default in Ubuntu (which version) and is it used?
launchInstall "$packageManagmentInstall" "default-jre" "$LOGFILE"
# I guess it is python2? Need to specify version
launchInstall "$packageManagmentInstall" "python" "$LOGFILE"
launchInstall "$packageManagmentInstall" "parallel" "$LOGFILE"
# might pull a complete perl install, any version requrirements?
launchInstall "$packageManagmentInstall" "cpanminus" "$LOGFILE"
#"bioinfo" packages, most likely the package names don't match
# the conda package name, you need to check all the packages exist in bioconda
launchInstall "$packageManagmentInstall" "hmmer" "$LOGFILE" # checked for conda
launchInstall "$packageManagmentInstall" "emboss" "$LOGFILE" # checked for conda
# launchInstall "$packageManagmentInstall" "emboss-lib" "$LOGFILE" # not found, might be included in emboss
launchInstall "$packageManagmentInstall" "blast" "$LOGFILE" # checked for conda
launchInstall "$packageManagmentInstall" "perl-bioperl" "$LOGFILE" # checked
launchInstall "$packageManagmentInstall" "perl-bioperl-run" "$LOGFILE" # checked
launchInstall "$packageManagmentInstall" "perl-datetime" "$LOGFILE" # checked
launchInstall "$packageManagmentInstall" "perl-xml-simple" "$LOGFILE" # checked
launchInstall "$packageManagmentInstall" "perl-digest-md5" "$LOGFILE" # checked
launchInstall "$packageManagmentInstall" "clustalw" "$LOGFILE" # checked
#install muscle
launchInstall "$packageManagmentInstall" "muscle" "$LOGFILE" # checked
#install prodigal
launchInstall "$packageManagmentInstall" "prodigal" "$LOGFILE" # checked
# echo "copy /usr/bin/clustalw to $CURDIR/bin/clustalw2" >> $LOGFILE
# sudo cp /usr/bin/clustalw $CURDIR/bin/clustalw2
cpanm Try::Tiny >> $LOGFILE
cpanm Test::Most >> $LOGFILE
cpanm JSON::Parse >> $LOGFILE
cpanm Class::Struct >> $LOGFILE
cpanm Bio::DB::Fasta >> $LOGFILE
cpanm File::Copy >> $LOGFILE
cpanm Bio::Seq Bio::SeqIO >> $LOGFILE
cpanm Bio::Tools::Run::Alignment::Clustalw >> $LOGFILE
cpanm Bio::Tools::Run::Alignment::Muscle >> $LOGFILE
#install vmatch # no conda package for vmatch
echo "Installation of Vmatch" >> $LOGFILE
echo "change directory to $CURDIR/src" >> $LOGFILE
cd $CURDIR/src
wget http://vmatch.de/distributions/vmatch-2.3.0-${distribution}-64bit.tar.gz >> $LOGFILE
tar -zxf vmatch-2.3.0-${distribution}-64bit.tar.gz >> $LOGFILE
gcc -Wall -Werror -fPIC -O3 -shared vmatch-2.3.0-${distribution}-64bit/SELECT/sel392.c -o $CURDIR/sel392v2.so >> $LOGFILE
echo "copy $CURDIR/src/vmatch-2.3.0-${distribution}-64bit/vmatch, mkvtree and vsubseqselect to $CURDIR/bin/" >> $LOGFILE
cp $CURDIR/src/vmatch-2.3.0-${distribution}-64bit/vmatch $CURDIR/bin/vmatch2
cp $CURDIR/src/vmatch-2.3.0-${distribution}-64bit/mkvtree $CURDIR/bin/mkvtree2
cp $CURDIR/src/vmatch-2.3.0-${distribution}-64bit/vsubseqselect $CURDIR/bin/vsubseqselect2
echo "change directory to $CURDIR" >> $LOGFILE
cd $CURDIR
#install macsyfinder
echo "Installation of MacSyFinder" >> $LOGFILE
cd ${CURDIR}
wget https://dl.bintray.com/gem-pasteur/MacSyFinder/macsyfinder-1.0.5.tar.gz >> $LOGFILE
tar -xzf macsyfinder-1.0.5.tar.gz
mkdir -p bin
cd bin
ln -s ../macsyfinder-1.0.5/bin/macsyfinder
cd ${CURDIR}
echo "add definition of MACSY_HOME (${CURDIR}/macsyfinder-1.0.5/) in .profile" >> $LOGFILE
echo "export MACSY_HOME=${CURDIR}/macsyfinder-1.0.5/" >> $HOME/.profile
echo "add bin folder ($CURDIR/bin) to the definition of PATH in $HOME/.profile" >> $LOGFILE
echo "export PATH=${CURDIR}/bin:${PATH}" >> $HOME/.profile
#set environment variables
source $HOME/.profile
# if CONDA
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment