diff --git a/LifeSciences/README.md b/LifeSciences/README.md index 35ae9d068bea926dd3f42ff39e1fdf1a1fdae9f1..6eca72539543e85d892f2de24b581a0cc27478e2 100644 --- a/LifeSciences/README.md +++ b/LifeSciences/README.md @@ -18,4 +18,4 @@ Life Sciences Software List: - repositories: deepTools-2.0.0 - repositories: AutoDock-4.2.6 - repositories: falcon-v0.3.0 - +- repositories: sratoolkit-3.0.0 diff --git a/LifeSciences/sratoolkit-3.0.0/build.sh b/LifeSciences/sratoolkit-3.0.0/build.sh new file mode 100644 index 0000000000000000000000000000000000000000..c0bed8a5b9338a00a0f28637e1b899e00dc09f7a --- /dev/null +++ b/LifeSciences/sratoolkit-3.0.0/build.sh @@ -0,0 +1,84 @@ +#!/bin/bash +# 此脚本用来编译安装sratoolkit-3.0.0软件 +# sratoolkit软件介绍 +# sratoolkit用于sra文件处理的软件包。 +# 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_sratoolkit_run() { + cat >"$1/sratoolkit-3.0.0-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;1msratoolkit environment initialization completed.\033[0m" +EOF + + chmod +x "$1"/sratoolkit-3.0.0-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_ncbi-vdb() { + bash "$1"/ncbi-vdb-3.0.0.sh "$2" "$3" + module use "$3"/ncbi-vdb-3.0.0 + module load "$3"/ncbi-vdb-3.0.0/ncbi-vdb_modulefiles +} + +function install_sratoolkit() { + bash "$4"/sratoolkit-3.0.0.sh "$1" "$2" + mkdir -p "$3"/sratoolkit-3.0.0-hpc && cp -r "$2"/* "$3"/sratoolkit-3.0.0-hpc/ +} + +function tar_pkg() { + echo "# 正在打包sratoolkit文件 路径为$1" + cd "$1" && tar zcvf sratoolkit-3.0.0-hpc.tar.gz sratoolkit-3.0.0-hpc + echo -e "\033[1;32;1m# sratoolkit已经打包成功 文件路径为$1/sratoolkit-3.0.0-hpc.tar.gz\033[0m" +} + +function install_development() { + yum install -y m4 environment-modules systemd-devel + 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=$(get_current_dir)/pkg + install_development + install_bisheng "$dep_dir" "$buildpath" "$installpath" + install_ncbi-vdb "$dep_dir" "$buildpath" "$installpath" + install_sratoolkit "$buildpath" "$installpath" "$pkg_dir" "$(get_current_dir)" + write_sratoolkit_run "$pkg_dir" + tar_pkg "$pkg_dir" + echo "# ------------------------------------------------------------------------" + echo "# 运行软件前请执行以下命令" + echo -e "\033[1;32;1m# source ""${pkg_dir}""/sratoolkit-3.0.0-hpc/run.sh\033[0m" + echo "# 来加载sratoolkit运行时环境变量" + echo "# ------------------------------------------------------------------------" + rm -rf "$buildpath" "$installpath" +} + +main "$@" diff --git a/LifeSciences/sratoolkit-3.0.0/ccsra.c.patch b/LifeSciences/sratoolkit-3.0.0/ccsra.c.patch new file mode 100644 index 0000000000000000000000000000000000000000..f5967b991571c57ec4310b61a9f8c29b5c975605 --- /dev/null +++ b/LifeSciences/sratoolkit-3.0.0/ccsra.c.patch @@ -0,0 +1,89 @@ +--- ccsra.c.old 2022-07-05 16:38:39.717343571 +0800 ++++ ccsra.c 2022-07-05 16:39:37.414039637 +0800 +@@ -209,9 +209,9 @@ + va_list args) + { + char path[4096]; +- int size = args ? +- vsnprintf ( path, sizeof path, path_fmt, args ) : +- snprintf ( path, sizeof path, "%s", path_fmt ); ++ ++ int size = vsnprintf ( path, sizeof path, path_fmt, args ); ++ + if ( size < 0 || size >= (int) sizeof path ) + return RC (rcFS, rcNoTarg, rcAccessing, rcPath, rcExcessive ); + if (absolute && (path[0] != '/')) +@@ -438,11 +438,9 @@ + assert (self != NULL); + assert (f != NULL); + assert (path_fmt != NULL); ++ size = vsnprintf ( path, sizeof path, path_fmt, args ); + +- size = args ? +- vsnprintf ( path, sizeof path, path_fmt, args ) : +- snprintf ( path, sizeof path, "%s", path_fmt ); +- if ( size < 0 || size >= (int) sizeof path ) ++ if ( size < 0 || size >= (int) sizeof path ) + return RC (rcFS, rcNoTarg, rcAccessing, rcPath, rcExcessive ); + + if (CCNodeSraDirLegalPath (self, path)) +@@ -541,10 +539,8 @@ + assert (self != NULL); + assert (locator != NULL); + assert (path_fmt != NULL); ++ size = vsnprintf ( path, sizeof path, path_fmt, args ); + +- size = args ? +- vsnprintf ( path, sizeof path, path_fmt, args ) : +- snprintf ( path, sizeof path, "%s", path_fmt ); + if ( size < 0 || size >= (int) sizeof path ) + return RC (rcFS, rcNoTarg, rcAccessing, rcPath, rcExcessive ); + +@@ -577,9 +573,7 @@ + assert (size != NULL); + assert (path_fmt != NULL); + +- path_size = args ? +- vsnprintf ( path, sizeof path, path_fmt, args ) : +- snprintf ( path, sizeof path, "%s", path_fmt ); ++ path_size = vsnprintf ( path, sizeof path, path_fmt, args ); + if ( path_size < 0 || path_size >= (int) sizeof path ) + return RC (rcFS, rcNoTarg, rcAccessing, rcPath, rcExcessive ); + +@@ -613,9 +607,7 @@ + assert (size != NULL); + assert (path_fmt != NULL); + +- path_size = args ? +- vsnprintf ( path, sizeof path, path_fmt, args ) : +- snprintf ( path, sizeof path, "%s", path_fmt ); ++ path_size = vsnprintf ( path, sizeof path, path_fmt, args ); + if ( path_size < 0 || path_size >= (int) sizeof path ) + return RC (rcFS, rcNoTarg, rcAccessing, rcPath, rcExcessive ); + +@@ -757,9 +749,7 @@ + assert (contiguous); + assert (path_fmt); + +- size = args ? +- vsnprintf ( path, sizeof path, path_fmt, args ) : +- snprintf ( path, sizeof path, "%s", path_fmt ); ++ size = vsnprintf ( path, sizeof path, path_fmt, args ); + if ( size < 0 || size >= (int) sizeof path ) + return RC (rcFS, rcNoTarg, rcAccessing, rcPath, rcExcessive ); + +@@ -1018,12 +1008,13 @@ + KPathType type = KDirectoryPathType (dir, "%s", path); + size_t pathlen = strlen (path); + size_t linklen = 0; ++ va_list null_list; + char link [2 * 4096]; /* we'll truncate? */ + + if (type & kptAlias) + { + rc = KDirectoryVResolveAlias (dir, false, link, sizeof (link), +- path, NULL); ++ path, null_list); + if (rc == 0) + linklen = strlen (link); + } diff --git a/LifeSciences/sratoolkit-3.0.0/common.sh b/LifeSciences/sratoolkit-3.0.0/common.sh new file mode 100644 index 0000000000000000000000000000000000000000..4f83767e57eb4f8b403455e8402dd0fc398d466c --- /dev/null +++ b/LifeSciences/sratoolkit-3.0.0/common.sh @@ -0,0 +1,46 @@ +#!/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}" +} diff --git a/LifeSciences/sratoolkit-3.0.0/dependency/bisheng-compiler-2.1.0.sh b/LifeSciences/sratoolkit-3.0.0/dependency/bisheng-compiler-2.1.0.sh new file mode 100644 index 0000000000000000000000000000000000000000..6e7a2179b4b2af39bb6b4fe4948355e979e973b5 --- /dev/null +++ b/LifeSciences/sratoolkit-3.0.0/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" <"$1/ncbi-vdb-3.0.0/ncbi-vdb_modulefiles" <"$1/sra-tools-3.0.0/sra-tools_modulefiles" <