From 2a3657055b8a8a1d3ce076072aa5a642f1c1fb2b Mon Sep 17 00:00:00 2001 From: Nana Mensah Date: Mon, 28 Oct 2019 12:03:27 +0000 Subject: [PATCH 1/2] Add environment scripts to remove dx python2 from PYTHONPATH --- wscleaner/README.md | 4 ++++ wscleaner/env/activate_env_vars.sh | 10 ++++++++++ wscleaner/env/deactivate_env_vars.sh | 4 ++++ 3 files changed, 18 insertions(+) create mode 100644 wscleaner/env/activate_env_vars.sh create mode 100644 wscleaner/env/deactivate_env_vars.sh diff --git a/wscleaner/README.md b/wscleaner/README.md index 515e4cb..91c17fb 100644 --- a/wscleaner/README.md +++ b/wscleaner/README.md @@ -52,6 +52,10 @@ optional arguments: pytest . --auth_token DNA_NEXUS_KEY ``` +## Workstation Environment +The directory `env/` in this repository contains conda environment scripts for the workstation. These remove conflicts in the PYTHONPATH environment variable by editing the variable when conda is activated. The conda documentation describes where to place these scripts under ['saving environment variables'](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#macos-and-linux). + + ## License Developed by Viapath Genome Informatics diff --git a/wscleaner/env/activate_env_vars.sh b/wscleaner/env/activate_env_vars.sh new file mode 100644 index 0000000..b77e02c --- /dev/null +++ b/wscleaner/env/activate_env_vars.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Cache the python path +export wsc_PPCACHE=$PYTHONPATH + +# Remove the dxtoolkit path from the pythonpath environment variable +# Python searches this when importing modules, causing clashes with conda install +PYTHONPATH_CLEAN=$(echo $PYTHONPATH | sed s,/usr/share/dnanexus/lib/python2.7/site-packages:,,) +# Set the new pythonpath +export PYTHONPATH=$PYTHONPATH_CLEAN diff --git a/wscleaner/env/deactivate_env_vars.sh b/wscleaner/env/deactivate_env_vars.sh new file mode 100644 index 0000000..e0f5191 --- /dev/null +++ b/wscleaner/env/deactivate_env_vars.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +# Set the python path to the original before the environment was active +export PYTHONPATH=${wsc_PPCACHE} From f26f808581bd3da99e5ffa2a4d77e25555515395 Mon Sep 17 00:00:00 2001 From: Nana Mensah Date: Mon, 28 Oct 2019 12:09:31 +0000 Subject: [PATCH 2/2] Update workstation housekeeping readme and version --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a177f44..aed7e7f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Workstation Housekeeping v1.5 +# Workstation Housekeeping v1.6 Scripts to manage data on the NGS workstation @@ -56,6 +56,7 @@ Delete local directories that have been uploaded to the DNAnexus cloud storage s git clone https://github.com/moka-guys/workstation_housekeeping.git pip install workstation_housekeeping/wscleaner wscleaner --version # Print version number +# If installing on workstation see wscleaner/README.md section 'Workstation Environment' ``` ### Usage @@ -65,4 +66,4 @@ wscleaner --set-key DNA_NEXUS_KEY # Cache dnanexus api key wscleaner ROOT_DIRECTORY --logfile LOGFILE_PATH ``` ---- \ No newline at end of file +---