Skip to content

Instantly share code, notes, and snippets.

@RYDM
Last active November 7, 2018 18:10
Show Gist options
  • Save RYDM/834a5ca826347a2fb798676084d81ada to your computer and use it in GitHub Desktop.
Save RYDM/834a5ca826347a2fb798676084d81ada to your computer and use it in GitHub Desktop.
This is a script I wrote for myself while volunteering at Cancer Computer (www.cancercomputer.com). It was made to setup a Galaxy Project server and Data Science coding environment for a fresh install of Centos7.
Rob's Dev Flavor for Bioinformatics (Centos 7 VM):
This is a not-so-small bash script that completes setup of a fresh Centos 7/7.5 (or possibly RHEL) OS, with all development packages and updates, for working in multiple programing environments. It loosely facilitates and checks the avoidance of possible conflicts with centos 7 python environment (2.7) and fetches(wget's) the Anaconda install scripts for the more naive volunteers (*raises hand*) and/or quick env setup and experimentation, or whatever you make of it. Anaconda also has access to many more data science and other scientific libraries that are of extreme value to developing in, but not limited to, bioinformatics.
Included operations:
verify sudo priviledged user if not run by sudo (does this through --stdin, no variable or printout of credentials).
Synchronize Time on Virtual Machine (Spinning up VM's from save states can screw your browsing and ssl up.)
Update Centos 7 to latest with EPEL release/IUS repo list
Install python-pip
Make directories under '/home/*' ready to run Planemo operations with virtual environment scipts/dependancies, Base directory structure for running Jupyter notebook, ***Anaconda 3 install directory***, 'Tools' folder for downloading stand alone bioinformatic tools or applications
add user "galaxy" at /home/galaxy/ for install of future local galaxy server env.
Install Docker and test.
Verify Centos 7 python path is ver 2.7
Future Considerations for the automated bash setup:
Maybe do this in python script?
How to install Anaconda 3 automatically (accept and pass prompts) (Advice on this if at all possible, please?)
Additional .bashrc alias to facilitate switching system python paths (I'm inclined to leave this to the preferences of the user).
Instructions:
Get this Script (from a friend or github)
Make sure its executable by:
sudo chmod+x
Run as 'sudo'. If not, there is a loop to authenticate and prompt or deny the user.
(this script verifies and passes your credential input recursively to restart the script as sudo if you don't do so initially.)
Sit back and enjoy your coffee.
Dependancies and Other Considerations:
Authentication loop executes whiptail interactive script. Centos 7 should have this.
It is possible to remove and/or rebrand the loop entirely for any concerns of security or issues running the script.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Versioning:
V0.1.0
I used SemVer for versioning. https://semver.org
Acknowledgments:
Whiptail script shamelessly modified and used from Michael Hampton here:
https://askubuntu.com/questions/746350/request-root-privilege-from-within-a-script/748362
Sincere Thanks to my colleagues Ian S., Dave H., Roy C. Tyler N. @ www.cancercomputer.com
Super-Special Thanks to:
Dave C., J. Goecks @ the Galaxy Project for their time, guidance, and review.
Dr. Mishra for her support on the exome-seq data and benevolent disposition for life and an innovative accessible future in medicine/personalized genomic.
T. Burton @ Health Canada for her expert and effective consultations on Neo-Antigens, hypoxic tumour environments and immunotherapies.
I have gained a world of perspective and immeasurable value in knowledge and experience taking on this project with you all.
Questions, Concerns, Issues and Criticism are welcome!
Contact me at: rydmsound@gmail.com
LEGAL DISCLAIMER/LICENSING INFORMATION/END-USER INFORMATION:
Reference here for the software this script installs.
Anaconda End User Licenses Agreement here (when you run the install scripts you'll have to confirm this):
https://docs.anaconda.com/anaconda/eula/
Docker:
https://www.docker.com/legal/docker-software-end-user-license-agreement
Galaxy Code of Conduct:
https://github.com/galaxyproject/galaxy/blob/dev/CODE_OF_CONDUCT.md
Galaxy License:
https://github.com/galaxyproject/galaxy/blob/dev/LICENSE.txt
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#!/usr/bin/bash
# Varaible Defs
HOME=/home/$USER/
JUPYTER=/home/$USER/Jupyter/
ANACONDA=/home/$USER/Anaconda_3/
TOOLS=/home/$USER/Tools/
GALAXY=/home/$USER/galaxy/
PLANEMO=/home/$USER/Planemo/
PYV=`python -c "import sys;t='{v[0]}.{v[1]}.{v[2]}'.format(v=list(sys.version_info[:3]));sys.stdout.write(t)";`
brand="Rob's Dev Flav"
# Check that the script is running as root. If not, then prompt for the sudo
# password and re-execute this script with sudo.
# this was for fun so if its a concern or not entertaining for you you can delete it or comment out
if [ "$(id -nu)" != "root" ]; then
sudo -k
pass=$(whiptail --backtitle "$brand for Bioinformatics GNU 2018" --title "Authentication required" --passwordbox "Running $brand requires administrative privilege. Please authenticate to begin the installation.\n\n[sudo] Password for user $USER:" 12 50 3>&2 2>&1 1>&3-)
exec sudo -S -p '' "$0" "$@" <<< "$pass"
exit
fi
# Set working directory to /home/$USER/, incase you didn't start here . . .
cd "$HOME"
# set VM or host system time
timedatectl set-ntp true &&
# Update OS/Kernel and repos, dev stuff, support, etc.
yum -y update &&
yum -y install epel-release &&
# Install pip, updating should be done from the virtual environment
yum -y install python-pip &&
# Make project/server directories
mkdir -p "$JUPYTER"/{data,docs,test,source}/ "$ANACONDA" "$TOOLS"/{dcontainers,docs,source}/ "$PLANEMO" ;
# Setup docker repo
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo &&
# Install Docker-CE
# 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E
yum -y install docker-ce &&
# Check to see if Galaxy is installed and make sure it is (this is not an update!)
if [ ! -d "$GALAXY" ]; then
git clone -b release_18.05 https://github.com/galaxyproject/galaxy.git
else
echo -e "\n\n You appear to have Galaxy. Make sure its stable and up to date!"
fi
# Get install files for Anaconda 2 and 3 and put it in Anaconda_3 folder (I use three and virtualize py 2.7 env)
wget -bq https://repo.continuum.io/archive/Anaconda2-4.3.0-Linux-x86_64.sh -P "$ANACONDA" &
wget -bq https://repo.continuum.io/archive/Anaconda3-4.3.0-Linux-x86_64.sh -P "$ANACONDA" &
# Get BG Docker Image of Galaxy and put in Tools directory
wget -bq https://github.com/bgruening/docker-galaxy-stable/archive/master.zip -P "$TOOLS"/dcontainers/
# start docker and test install
systemctl start docker &&
docker run hello-world
# Double (or triple?) check the system version of Python (Should be 2.7.5)
echo -e "\n\n\t\t System Python Version is "$PYV"\n\n\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment