Skip to content

Tweak to make sure Simple_prep.sh works outside of main repo #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 35 additions & 23 deletions Simple_Prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,39 @@ if ! /bin/ls $FSLDIR/data/standard/MNI152_T1_1mm.nii.gz >/dev/null; then
fi
echo "FSL MNI templates found"


# Check if curl is available
[ ! $(command -v curl) ] && echo "No curl: Make sure a version of curl is installed and available." && kill -INT $$
echo "curl is available"

echo "Creating local directory simple_workflow to create and execute environment"
mkdir -p simple_workflow && cd simple_workflow
if [ ! -e ./expected_output ]; then
echo "Creating local directory 'workflow' to host and execute environment"
mkdir -p workflow
cd workflow

# Get the repo and Create the specific versioned python environment
echo "Getting the analysis repo"
if [ $(command -v git) ]; then
#git clone https://github.com/ReproNim/simple_workflow scripts
cd scripts
git checkout a26e0c01227c8baa0756b9e95a0442d69e9c9e10
elif [ $(command -v unzip) ]; then
curl -ssL -o workdir.zip https://github.com/ReproNim/simple_workflow/archive/a26e0c01227c8baa0756b9e95a0442d69e9c9e10.zip
unzip workdir.zip && rm workdir.zip
mv simple_workflow-a26e0c01227c8baa0756b9e95a0442d69e9c9e10 scripts
else
echo "Neither git not unzip available. Cannot download scripts"
cd ../.. & rm -Rf workflow
exit 1
fi
cd ..
fi

# Setup standalone python environment
echo "Setting up standalone conda Python environment"

if [ ! -e miniconda ]; then
echo "Downloading miniconda"

if [ `uname` == 'Darwin' ]; then
curl -sSL -o miniconda.sh http://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
else
Expand All @@ -57,23 +77,7 @@ if [ ! -e miniconda ]; then
rm miniconda.sh
fi
PATH=$PWD/miniconda/bin:$PATH

# Get the repo and Create the specific versioned python environment
if [ ! -e scripts/expected_output ]; then
echo "Getting the analysis repo"
if [ $(command -v git) ]; then
git clone https://github.com/ReproNim/simple_workflow scripts
cd scripts
git checkout a26e0c01227c8baa0756b9e95a0442d69e9c9e10
elif [ $(command -v unzip) ]; then
curl -ssL -o workdir.zip https://github.com/ReproNim/simple_workflow/archive/a26e0c01227c8baa0756b9e95a0442d69e9c9e10.zip
unzip workdir.zip && rm workdir.zip
mv simple_workflow-a26e0c01227c8baa0756b9e95a0442d69e9c9e10 scripts
else
echo "Neither git not unzip available. Cannot download scripts"
exit 1
fi
fi
echo "Updated path to:" $PATH

echo "Creating and activating versioned Python environment"
if [ ! -e miniconda/envs/bh_demo/bin/nipype_display_crash ]; then
Expand All @@ -93,19 +97,27 @@ to check.

---- END SIMPLE_PREP SCRIPT WARNING ----"
fi
conda env create -f scripts/environment.yml
if [ ! -e ./expected_output ]; then
conda env create -f scripts/environment.yml
else
conda env create -f ./environment.yml
fi
conda clean -tipsy
fi

if [ "$1" == "test" ]; then
PATH=$PWD/miniconda/envs/bh_demo/bin:$PATH
cd scripts
if [ ! -e ./expected_output ]; then
cd scripts
fi
python run_demo_workflow.py --key 11an55u9t2TAf0EV2pHN0vOd8Ww2Gie-tHp9xGULh_dA -n 1 && \
python check_output.py --ignoremissing
fi
if [ "$1" == "replay" ]; then
PATH=$PWD/miniconda/envs/bh_demo/bin:$PATH
cd scripts
if [ ! -e ./expected_output ]; then
cd scripts
fi
python run_demo_workflow.py --key 11an55u9t2TAf0EV2pHN0vOd8Ww2Gie-tHp9xGULh_dA && \
python check_output.py
fi
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: bh_demo
channels:
- anaconda
- conda-forge
- defaults
dependencies:
Expand Down