BA_predict.recipe 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. Bootstrap: docker
  2. From: continuumio/miniconda3:latest
  3. %files
  4. %post
  5. export PATH=/opt/conda/bin:$PATH
  6. mkdir -p /opt/scripts
  7. mkdir /opt/src/
  8. wget https://gin.g-node.org/juaml/brainage/raw/master/More/entrypoint.sh -O /opt/scripts/entrypoint.sh
  9. wget https://gin.g-node.org/juaml/brainage/raw/master/More/setup.py -O /opt/src/setup.py
  10. wget https://gin.g-node.org/juaml/brainage/raw/master/More/pyproject.toml -O /opt/src/pyproject.toml
  11. wget https://gin.g-node.org/juaml/brainage/raw/master/More/predict_age_sing.py -O /opt/scripts/predict_age_sing.py
  12. mkdir -p /opt/masks
  13. wget https://gin.g-node.org/juaml/brainage/raw/master/More/masks/brainmask_12.8.nii -O /opt/masks/brainmask_12.8.nii
  14. mkdir -p /opt/trained_models
  15. wget https://gin.g-node.org/juaml/brainage/raw/master/More/trained_models/brainageR_S4_R4.gauss.models -O /opt/trained_models/brainageR.S4_R4.gauss.models
  16. wget https://gin.g-node.org/juaml/brainage/raw/master/More/trained_models/brainageR_S4_R4_pca.gauss.models -O /opt/trained_models/brainageR.S4_R4_pca.gauss.models
  17. wget https://gin.g-node.org/juaml/brainage/raw/master/More/trained_models/4sites.S0_R4.lasso.models -O /opt/trained_models/4sites.S0_R4.lasso.models
  18. wget https://gin.g-node.org/juaml/brainage/raw/master/More/trained_models/4sites.S4_R4.gauss.models -O /opt/trained_models/4sites.S4_R4.gauss.models
  19. wget https://gin.g-node.org/juaml/brainage/raw/master/More/trained_models/4sites.S4_R4_pca.gauss.models -O /opt/trained_models/4sites.S4_R4_pca.gauss.models
  20. wget https://gin.g-node.org/juaml/brainage/raw/master/More/trained_models/9datasets.S4_R4.gauss.models -O /opt/trained_models/9datasets.S4_R4.gauss.models
  21. wget https://gin.g-node.org/juaml/brainage/raw/master/More/trained_models/9datasets.S4_R4_pca.gauss.models -O /opt/trained_models/9datasets.S4_R4_pca.gauss.models
  22. mkdir /opt/src/brainage/
  23. wget https://gin.g-node.org/juaml/brainage/raw/master/More/brainage/__init__.py -O /opt/src/brainage/__init__.py
  24. wget https://gin.g-node.org/juaml/brainage/raw/master/More/brainage/calculate_features.py -O /opt/src/brainage/calculate_features.py
  25. wget https://gin.g-node.org/juaml/brainage/raw/master/More/brainage/create_splits.py -O /opt/src/brainage/create_splits.py
  26. wget https://gin.g-node.org/juaml/brainage/raw/master/More/brainage/define_models.py -O /opt/src/brainage/define_models.py
  27. wget https://gin.g-node.org/juaml/brainage/raw/master/More/brainage/performance_metric.py -O /opt/src/brainage/performance_metric.py
  28. wget https://gin.g-node.org/juaml/brainage/raw/master/More/brainage/read_data.py -O /opt/src/brainage/read_data.py
  29. wget https://gin.g-node.org/juaml/brainage/raw/master/More/brainage/xgboost_adapted.py -O /opt/src/brainage/xgboost_adapted.py
  30. wget https://gin.g-node.org/juaml/brainage/raw/master/More/brainage/zscore.py -O /opt/src/brainage/zscore.py
  31. chmod 777 /tmp/
  32. chmod 777 /opt/scripts/entrypoint.sh
  33. chmod 777 /opt/scripts/predict_age_sing.py
  34. chmod 777 /opt/masks/brainmask_12.8.nii
  35. apt-get update --allow-releaseinfo-change
  36. apt-get install -y --fix-missing libgomp1 wget dpkg
  37. NOW=`date`
  38. # Initialize conda
  39. conda --version
  40. conda create --name BA_env -c conda-forge python=3.9.1 numpy==1.22.3 matplotlib==3.5.1 nibabel==3.2.2 nilearn==0.9.1 pandas==1.4.2 scipy==1.8.0 seaborn==0.11.2 xgboost==1.6.1 scikit-learn==1.0.2 glmnet
  41. . /opt/conda/etc/profile.d/conda.sh
  42. conda activate BA_env
  43. pip install "julearn==0.2.5"
  44. pip install git+https://github.com/JamesRitchie/scikit-rvm.git@master
  45. cd /opt/src && pip install -e .
  46. %environment
  47. export PYTHONPATH=/opt/src
  48. %runscript
  49. echo "Container was created $NOW"
  50. echo "Arguments received: $*"
  51. # Activate environment
  52. conda init
  53. . /opt/conda/etc/profile.d/conda.sh
  54. conda activate BA_env
  55. # Running entrypoint.sh
  56. /opt/scripts/entrypoint.sh "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8"
  57. echo "Computation finished!"