Merge branch '277-new-tomodrgn-module' into 'master'

Resolve "new tomodrgn module"

Closes #277

See merge request Pmodules/buildblocks!439
This commit is contained in:
2024-05-24 11:56:32 +02:00
5 changed files with 110 additions and 0 deletions

13
EM/tomodrgn/README.md Normal file
View File

@@ -0,0 +1,13 @@
Installation remarks for Tomodrgn:
1.) function in tomodrgn/analysis.py is not valid with matplotlib v3.8 anymore, this is why the function is substituted in the build script:
sed -i 's/cbar.draw_all/cbar._draw_all/' tomodrgn/analysis.py
2.) the tomodrgn quicktest script can be exectued by :
python /opt/psi/EM/tomodrgn/0.2.2/tomodrgn/testing/quicktest.py
REMARK: This file was changed in order to provide the argument --datadir /opt/psi/EM/tomodrgn/0.2.2/tomodrgn/testing/, otherwise it will look for the "data" folder in the current working dir.
3.) quicktest is run without the two arguments: --num-workers (dafault =0) and --prefetch-factor (default should be None, but is actually 2), which throws an error,was fixed by changing the default of --prefetch-factor to None in the file /opt/psi/EM/tomodrgn/0.2.2/miniconda/envs/tomodrgn_0.2.2/lib/python3.9/site-packages/tomodrgn/commands/train_vae.py

34
EM/tomodrgn/build Executable file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/env modbuild
pbuild::configure() {
#MINICONDA INSTALL
mkdir -p "$PREFIX/miniconda"
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/"
#CREATE ENV , make sure to source the "correct" conda.sh
"$PREFIX/miniconda/condabin/conda" env create --name "tomodrgn_$V" -f "$BUILDBLOCK_DIR/environment.yaml"
source "$PREFIX/miniconda/etc/profile.d/conda.sh"
conda activate "tomodrgn_$V"
#CP SOURCE CODE
mkdir "$PREFIX/tomodrgn"
cd "$PREFIX/tomodrgn"
cp -r "$SRC_DIR"/* .
#FIX MATPLOTLIB VERSION issue
sed -i 's/cbar.draw_all/cbar._draw_all/' tomodrgn/analysis.py
#INSTALL IN ENV
pip install .
}
#DO NOTHING
pbuild::compile(){
:
}
pbuild::install(){
:
}

View File

@@ -0,0 +1,18 @@
channels:
- pytorch
- conda-forge
- defaults
dependencies:
- pytorch-gpu>=1.11.0
- cudatoolkit>=11.0
- pandas
- seaborn
- scikit-learn
- umap-learn
- ipython_genutils
- notebook
- pip
- pip:
- ipyvolume>=0.6.0
- pythreejs>=2.4.2

View File

@@ -0,0 +1,11 @@
format: 1
tomodrgn:
deaults:
group: EM
overlay: base
relstage: unstable
urls:
- url: https://github.com/bpowell122/tomodrgn/archive/refs/tags/v${V_PKG}.tar.gz
name: tomodrgn-${V_PKG}.tar.gz
versions:
0.2.2:

34
EM/tomodrgn/modulefile Normal file
View File

@@ -0,0 +1,34 @@
#%Module1.0
module-whatis "TomoDRGN - analyzing structural heterogeneity in cryo-electron sub-tomograms"
module-url "https://github.com/bpowell122/tomodrgn"
module-license "-"
module-maintainer "Greta Assmann <greta.assmann@psi.ch>"
module-help "https://github.com/bpowell122/tomodrgn"
# Check for supported shell types
set shelltype [module-info shelltype]
switch -- $shelltype {
"sh" {
puts stdout "source \"\${PREFIX}\"/miniconda/etc/profile.d/conda.sh;\n"
}
default {
puts stderr "Shells of type '$shelltype' are NOT supported!"
}
}
switch [module-info mode] {
"load" {
# Relies on the anaconda module being loaded since we need to update the path
puts stdout "conda activate $P_$V;\n"
}
"unload" -
"remove" {
puts stdout "conda deactivate;\n"
}
}