diff --git a/LifeSciences/README.md b/LifeSciences/README.md index 0fbae3f8c71f4f843628c6f1469a0b5e2d7ead3a..cfbc1135c4bb40c25c3f896a672ba8ab458d16aa 100644 --- a/LifeSciences/README.md +++ b/LifeSciences/README.md @@ -6,4 +6,5 @@ Life Sciences Software List: - repositories: RepeatMasker-4.1.2 - repositories: eigensoft-7.2.1 - repositories: redundans-v0.13c -- repositories: bamtools-2.5.2 \ No newline at end of file +- repositories: bamtools-2.5.2 +- repositories: flye-2.9 \ No newline at end of file diff --git a/LifeSciences/flye-2.9/build.sh b/LifeSciences/flye-2.9/build.sh new file mode 100644 index 0000000000000000000000000000000000000000..e72655c9fc9c30b0c89d2bfa54bc3a7a23323270 --- /dev/null +++ b/LifeSciences/flye-2.9/build.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# 此脚本用来编译安装FLye-2.9软件 +# Flye-2.9软件介绍 +# Flye是用于单分子组装数据的denovo基因组装的软件,输入是原始的PacBio或者ONT的序列文件, +# 输出是polished的contig。Flye可用于各种数据集,从小的细菌到大的哺乳动物,并且有针对微生物组装的模式。 +# Usage: +# bash /path/to/build.sh /path/to/build /path/to/install +# 使用build.sh 脚本样例 bash /path/to/build.sh /path/to/build /path/to/install +# 使用build.sh 需要root权限或者sudo权限,否则无法安装依赖 +# +############################################################## +set -e + +source "$( + cd "$(dirname "$0")" || exit 1 + pwd +)/common.sh" + +function write_flye_run() { + cat >"$1/flye-2.9-hpc/run.sh" < /dev/null +current_dir="\$(cd "\$(dirname "\${BASH_SOURCE[0]}")" && pwd -P)" +for f in "\${current_dir}"/*; do + if [[ -d "\${f}" && -f "\$(ls "\${f}"/*modulefiles 2>&1)" ]]; then + module use "\${f}" && module load "\${f}"/*modulefiles + fi +done +echo -e "\033[1;32;1mFlye environment initialization completed.\033[0m" +EOF + + chmod +x "$1"/flye-2.9-hpc/run.sh +} + +function install_bisheng() { + bash "$1"/bisheng-compiler-2.1.0.sh "$2" "$3" + module use "$3"/bisheng-compiler-2.1.0 + module load "$3"/bisheng-compiler-2.1.0/bisheng_modulefiles +} + +function install_flye() { + bash "$4"/flye-2.9.sh "$1" "$2" + mkdir -p "$3"/flye-2.9-hpc && cp -r "$2"/* "$3"/flye-2.9-hpc/ +} + +function tar_pkg() { + echo "# 正在打包FLYE文件 路径为$1" + cd "$1" && tar zcfP flye-2.9-hpc.tar.gz flye-2.9-hpc + echo -e "\033[1;32;1m# FLYE已经打包成功 文件路径为$1/flye-2.9-hpc.tar.gz\033[0m" +} + +function install_development() { + sudo yum install -y time patch environment-modules zlib-devel zlib bc gcc-c++ + source /etc/profile + module purge +} + +function main() { + is_check_build_install_directory "$1" "$2" "build.sh" + buildpath=$(create_dir "$1") + installpath=$(create_dir "$2") + dep_dir=$(get_current_dir)/dependency + pkg_dir=$(trim_path "$1")/pkg + install_development + install_bisheng "$dep_dir" "$buildpath" "$installpath" + install_flye "$buildpath" "$installpath" "$pkg_dir" "$(get_current_dir)" + write_flye_run "$pkg_dir" + tar_pkg "$pkg_dir" + echo "# ------------------------------------------------------------------------" + echo "# 运行软件前请执行以下命令" + echo -e "\033[1;32;1m# source ""${pkg_dir}""/flye-2.9-hpc/run.sh\033[0m" + echo "# 来加载Flye运行时环境变量" + echo "# ------------------------------------------------------------------------" + rm -rf "$buildpath" "$installpath" +} + +main "$@" diff --git a/LifeSciences/flye-2.9/common.sh b/LifeSciences/flye-2.9/common.sh new file mode 100644 index 0000000000000000000000000000000000000000..2b904623e8de4fc032d46f39efba9f439057d4aa --- /dev/null +++ b/LifeSciences/flye-2.9/common.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +function is_check_build_install_directory() { + if [[ $# -ne 3 ]]; then + echo "The format is as follows:" + echo "bash $3 buildpath installpath" + echo ":param buildpath: 应用构建绝对路径" + echo ":param installpath: 应用安装绝对路径" + exit 1 + fi + + [[ ! "$1" =~ ^/.* || "$1" = "/" ]] && echo "请输入正确的构建路径" && exit 1 + [[ ! "$2" =~ ^/.* || "$2" = "/" ]] && echo "请输入正确的安装路径" && exit 1 + echo "# ------------------------------------------------------------------------" + echo "# $3 正在运行" +} + +function is_check_build_equal() { + local buildpath + local installpath + buildpath="$1" + installpath="$2" + [[ "${buildpath}" =~ .*/$ ]] && buildpath=${buildpath%/*} + [[ "${installpath}" =~ .*/$ ]] && installpath=${installpath%/*} + [[ "${buildpath}" == "${installpath}" ]] && echo "构建路径与安装路径需为不同路径" && exit 1 + echo "# 构建路径为$1" + echo "# 安装路径为$2" +} + +function create_dir() { + local path + path="$1" + [[ "$path" =~ .*/$ ]] && path=${path%/*} + if [[ ! -d "${path}" && ! -f "${path}" ]]; then + mkdir -p "${path}" + elif [[ -n "$(ls -A "$1")" ]]; then + path=$path$(date "+%y%m%d%H%M%S") && mkdir -p "${path}" + fi + echo "${path}" +} + +function get_current_dir() { + local current_dir + current_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd) + echo "${current_dir}" +} + +function trim_path() { + cd "$1"/.. && echo "$PWD" +} diff --git a/LifeSciences/flye-2.9/dependency/bisheng-compiler-2.1.0.sh b/LifeSciences/flye-2.9/dependency/bisheng-compiler-2.1.0.sh new file mode 100644 index 0000000000000000000000000000000000000000..6e7a2179b4b2af39bb6b4fe4948355e979e973b5 --- /dev/null +++ b/LifeSciences/flye-2.9/dependency/bisheng-compiler-2.1.0.sh @@ -0,0 +1,60 @@ +#!/bin/bash +set -e + +source "$( + cd "$(dirname "$0")" || exit 1 + pwd +)/../common.sh" + +function download_bisheng() { + echo "# 毕昇编译器正在下载" + wget -t 40 -c -P "$1" https://mirrors.huaweicloud.com/kunpeng/archive/compiler/bisheng_compiler/bisheng-compiler-2.1.0-aarch64-linux.tar.gz + if [[ $? -eq 0 ]]; then + echo -e "\033[1;32;1m# 毕昇编译器已经下载成功\033[0m" + else + echo -e "\033[31m# 毕昇编译器下载失败,请重新执行脚本\033[0m" + exit 1 + fi +} + +function install_bisheng() { + echo "# 毕昇编译器正在安装" + tar xf "$1"/bisheng-compiler-2.1.0-aarch64-linux.tar.gz -C "$1" && rm -rf "$1"/bisheng-compiler-2.1.0-aarch64-linux.tar.gz + mkdir -p "$2"/bisheng-compiler-2.1.0 && cp -r "$1"/bisheng-compiler-2.1.0-aarch64-linux/* "$2"/bisheng-compiler-2.1.0/ + echo -e "\033[1;32;1m# 毕昇编译器已经安装完毕\033[0m" +} + +function install_development() { + sudo yum install -y wget tar libatomic environment-modules + source /etc/profile +} + +function write_bisheng_module() { + cat >"$1/bisheng-compiler-2.1.0/bisheng_modulefiles" </dev/null + CC=clang CXX=clang++ python setup.py install --prefix="$2"/flye-2.9 >make.log 2>&1 + if [[ $? -eq 0 ]]; then + echo -e "\033[1;32;1m# FLYE已经安装成功\033[0m" + else + echo -e "\033[31m# FLYE安装失败,请查看$1/Flye-2.9/make.log\033[0m" + exit 1 + fi +} + +function write_flye_module() { + cat >"$1/flye-2.9/flye_2.9_modulefiles" <