1 新建install.sh,内容如下
#!/bin/bashset -eif [ ! $1 ] || [ "$1"x == "-h"x ] || [ "$1"x == "--help"x ];then echo -e " \033[32mone-click install samtools, bcftools and htslib\033[0musage: \033[1m`basename $0` version [prefix]\033[0m version the version to install, eg. 1.9 prefix the path to install, default: `dirname $(pwd)`/v\$versioncontact: suqingdong@novogene.com" exitfiVERSION=$1if [ $2 ];then INSTALL_DIR=$2else SOURCE_DIR=`pwd` INSTALL_DIR=`dirname $SOURCE_DIR`/v${VERSION}fifor name in samtools bcftools htslib;do if [ ! -f $name-$VERSION.tar.bz2 ];then wget -c https://github.com/samtools/$name/releases/download/$VERSION/$name-$VERSION.tar.bz2 fidonetar -xf htslib-${VERSION}.tar.bz2cd htslib-${VERSION}./configure --prefix=${INSTALL_DIR} --disable-lzmamake && make installcd ..tar -xf bcftools-${VERSION}.tar.bz2cd bcftools-${VERSION}./configure --prefix=${INSTALL_DIR} --disable-lzma \ --with-htslib=${INSTALL_DIR}make && make installcd ..tar -xf samtools-${VERSION}.tar.bz2cd samtools-${VERSION}./configure --prefix=${INSTALL_DIR} --disable-lzma \ --with-htslib=${INSTALL_DIR}make && make installecho "export PATH=${INSTALL_DIR}/bin:\$PATHexport LD_LIBRARY_PATH=${INSTALL_DIR}/lib:\$LD_LIBRARY_PATH" > ${INSTALL_DIR}/source_thischmod 755 ${INSTALL_DIR}/source_thiscd ..rm -rf *-${VERSION}*echo -e '\033[1;32minstall done !\033[0m'
2 在软件安装目录执行以下命令
sh install.sh 1.9
3 使用时,source一下source_this文件即可