-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #222 from amarquand/dev
Dev
- Loading branch information
Showing
11 changed files
with
963 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,19 @@ | ||
# Installs software and cleans up unnecessary memory: the smaller, the less downtime | ||
FROM continuumio/miniconda3:latest | ||
RUN apt-get update | ||
RUN apt-get install -y libhdf5-dev \ | ||
pkg-config \ | ||
gcc \ | ||
g++ \ | ||
zip | ||
FROM python:3.10-slim | ||
|
||
# Make sure we have the right version of numpy | ||
RUN conda install numpy=1.21 | ||
# Combine all installation and cleanup steps into a single layer | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends wget unzip tk libhdf5-dev pkg-config gcc g++&& \ | ||
wget https://github.com/amarquand/PCNtoolkit/archive/dev.zip && \ | ||
unzip dev.zip && \ | ||
cd PCNtoolkit-dev && python -m pip install . && cd .. && \ | ||
# Cleanup | ||
rm -rf PCNtoolkit-dev dev.zip && \ | ||
pip cache purge && \ | ||
apt-get remove -y wget unzip && \ | ||
apt-get autoremove -y && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install directly from GitHub (master branch) | ||
#RUN pip install scikit-learn | ||
#RUN pip install pcntoolkit==0.26 | ||
|
||
# This is an alternative method that pulls from the dev branch | ||
RUN wget https://github.com/amarquand/PCNtoolkit/archive/dev.zip | ||
RUN unzip dev.zip | ||
RUN pip install scikit-learn | ||
RUN cd PCNtoolkit-dev; pip install . ; cd .. | ||
|
||
# Add command line links | ||
RUN ln -s /opt/conda/lib/python3.10/site-packages/pcntoolkit /opt/ptk | ||
RUN chmod 755 /opt/ptk/normative.py | ||
RUN chmod 755 /opt/ptk/normative_parallel.py | ||
RUN chmod 755 /opt/ptk/trendsurf.py | ||
RUN echo "export PATH=${PATH}:/opt/ptk" >> ~/.bashrc | ||
|
||
# clean up | ||
RUN rm -rf PCNtoolkit-dev dev.zip | ||
RUN conda clean -a | ||
RUN pip cache purge | ||
RUN apt-get clean | ||
|
||
# execute entrypoint | ||
COPY entrypoint.sh ./entrypoint.sh | ||
RUN chmod +x ./entrypoint.sh | ||
ENTRYPOINT [ "./entrypoint.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ func="$1" | |
shift | ||
|
||
# run using all remaining arguments | ||
/opt/ptk/${func} "$@" | ||
${func} "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
set -x | ||
|
||
script_dir=$(realpath $(dirname $(realpath $0))) | ||
test_dir=$(realpath $script_dir/..) | ||
root_dir=$(realpath $test_dir/..) | ||
|
||
export DOCKER_DIR=$root_dir/docker | ||
|
||
|
||
export LOCAL_DATA_PATH="$script_dir/temp/pcntoolkit/data" | ||
export DOCKER_DATA_PATH="/mnt/data" | ||
mkdir -p $LOCAL_DATA_PATH | ||
curl -o $LOCAL_DATA_PATH/fcon1000 https://raw.githubusercontent.com/predictive-clinical-neuroscience/PCNtoolkit-demo/refs/heads/main/data/fcon1000.csv | ||
|
||
cd $DOCKER_DIR | ||
cd .. | ||
|
||
echo "Splitting the data into train and test covariates, responses and batch effects..." | ||
python tests/cli_test/split_data.py --input_file $LOCAL_DATA_PATH/fcon1000 --output_dir $LOCAL_DATA_PATH | ||
|
||
cd $DOCKER_DIR | ||
|
||
docker run -v $LOCAL_DATA_PATH:$DOCKER_DATA_PATH pcntoolkit:v0.31.0_dev normative $DOCKER_DATA_PATH/Y_tr_fcon1000.pkl -c $DOCKER_DATA_PATH/X_tr_fcon1000.pkl -f fit -a hbr warp=WarpSinArcsinh optimizer=l-bfgs-b warp_reparam=True |
Oops, something went wrong.