Files
MX_Pmodule/EM/relion/build
2025-02-11 10:35:56 +01:00

94 lines
3.6 KiB
Plaintext
Executable File

#!/usr/bin/env modbuild
PROFILE="no"
SP="no"
pbuild::prep() {
local BRANCH
if [[ "$V" =~ beta$ ]]; then
BRANCH="ver${V_MAJOR}.${V_MINOR}"
elif [[ "$V" =~ profile$ ]]; then
BRANCH="${V_PKG}"
PROFILE="yes"
elif [[ "$V" =~ sp$ ]]; then
BRANCH="ver${V_MAJOR}.${V_MINOR}"
SP="yes"
else
BRANCH="${V_PKG}"
fi
if [[ -d "$SRC_DIR/.git" ]]; then
cd "$SRC_DIR"
git pull
else
git clone --depth=1 -b "$BRANCH" https://github.com/3dem/relion.git "$SRC_DIR" || return $?
fi
}
pbuild::pre_configure() {
# Section will be switched on for -profile version
#-----------------------------------------------------------
if [[ "$PROFILE" == "yes" ]]; then
# this needs to go into the config.yml file for >5.0-1beta
: #pbuild::add_configure_args "-DCMAKE_BUILD_TYPE=BENCHMARKING"
fi
#------------------------------------------------------------
# Section will be switched on for single-precision version
# Safe memory usage for multibody refinements
#------------------------------------------------------------
if [[ "$SP" == "yes" ]]; then
# this needs to go into the config.yml file for >5.0-1beta
: #pbuild::add_configure_args "-DDoublePrec_CPU=OFF"
fi
#------------------------------------------------------------
# The following section will only work for versions >= 5.0-beta
# -------------------------------------------------------------
if [[ "$V_MAJOR" -ge "5" ]]; then
#download blush weights, from zenodo
#mkdir -p "${PREFIX}"
wget -q https://zenodo.org/records/10072731/files/blush_v1.0.ckpt.gz -P "$PREFIX/torch/hub/checkpoints/relion_blush" \
&& gunzip "$PREFIX/torch/hub/checkpoints/relion_blush/blush_v1.0.ckpt.gz"
mv "$PREFIX/torch/hub/checkpoints/relion_blush/blush_v1.0.ckpt" "$PREFIX/torch/hub/checkpoints/relion_blush/v1.0.ckpt"
touch "$PREFIX/torch/hub/checkpoints/relion_blush/v1.0_installed.txt"
#cp classranker that was downloaded on another machine before from BUILDBLOCK_DIR
mkdir -p "$PREFIX/torch/hub/checkpoints/relion_class_ranker"
cp "$BUILDBLOCK_DIR/classranker_v1.0.ckpt.gz" "$PREFIX/torch/hub/checkpoints/relion_class_ranker"
gunzip "$PREFIX/torch/hub/checkpoints/relion_class_ranker/classranker_v1.0.ckpt.gz"
mv "$PREFIX/torch/hub/checkpoints/relion_class_ranker/classranker_v1.0.ckpt" "$PREFIX/torch/hub/checkpoints/relion_class_ranker/v1.0.ckpt"
touch "$PREFIX/torch/hub/checkpoints/relion_class_ranker/v1.0_installed.txt"
# fltk stuff
mkdir -p "$SRC_DIR/external/fltk"
cp "$BUILDBLOCK_DIR/fltk-1.3.5-source.tar.gz" "$SRC_DIR/external/fltk/"
#INSTALL Miniconda
echo "installing miniconda"
mkdir -p "$PREFIX/miniconda"
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh -O "$PREFIX/miniconda/miniconda.sh"
#wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O "$PREFIX/miniconda/miniconda.sh"
bash "$PREFIX/miniconda/miniconda.sh" -b -u -p "$PREFIX/miniconda/"
# Copy manually edited environment.yml file (with cryocare specs) into the folder to substitute the default one
#Conda create env with miniconda installation
"$PREFIX/miniconda/condabin/conda" env create --name "${P}-${V}" -f "$SRC_DIR/environment.yml"
"$PREFIX/miniconda/condabin/conda" env list
fi
#---------------------------------------------------------------
}