Snakemake/DahakFlot: Difference between revisions
From charlesreid1
(Created page with "=Start= This tutorial is assuming you start out on a machine with a conda-based python distribution (Anaconda or Miniconda or other). If you don't have a version of conda, i...") |
(→Start) |
||
| Line 26: | Line 26: | ||
# We don't need to add ~/.pyenv/bin to $PATH, | # We don't need to add ~/.pyenv/bin to $PATH, | ||
# it is already done. | # it is already done. | ||
if __name__=="__main__": | |||
install_pyenv() | |||
</pre> | |||
As noted in the script, you will need to add <code>~/.pyenv/bin</code> to the path, as that is where the [[Pyenv]] versions of [[Python]] live. | |||
Next, we have a python script to install snakemake: | |||
<pre> | |||
#!/usr/bin/python3 | |||
import getpass | |||
import tempfile | |||
import subprocess | |||
def install_pyenv(): | |||
user = getpass.getuser() | |||
if(user=="root"): | |||
raise Exception("You are root - you should run this script as a normal user.") | |||
else: | |||
# Install snakemake | |||
conda_version = "miniconda3-4.3.30" | |||
installcmd = ["pyenv","install",conda_version] | |||
subprocess.call(installcmd) | |||
globalcmd = ["pyenv","global",conda_version] | |||
subprocess.call(globalcmd) | |||
# --------------------------- | |||
# Install snakemake | |||
pyenvbin = os.environ['HOME'] | |||
condabin = pyenvbin+"/.pyenv/shims/conda" | |||
subprocess.call([condabin,"update"]) | |||
subprocess.call([condabin,"config","--all","channels","r"]) | |||
subprocess.call([condabin,"config","--all","channels","default"]) | |||
subprocess.call([condabin,"config","--all","channels","conda-forge"]) | |||
subprocess.call([condabin,"config","--all","channels","bioconda"]) | |||
subprocess.call([condabin,"install","--yes","-c","bioconda","snakemake"]) | |||
# --------------------------- | |||
# Install osf cli client | |||
pyenvbin = os.environ['HOME'] | |||
pipbin = pyenvbin+"/.pyenv/shims/pip" | |||
subprocess.call([pipbin,"install","--upgrade","pip"]) | |||
subprocess.call([pipbin,"install","--user","osfclient"]) | |||
| Line 31: | Line 84: | ||
install_pyenv() | install_pyenv() | ||
</pre> | </pre> | ||
Revision as of 02:32, 22 February 2018
Start
This tutorial is assuming you start out on a machine with a conda-based python distribution (Anaconda or Miniconda or other).
If you don't have a version of conda, it is recommended you use Pyenv to manage versions of python.
A very simple pyenv installation script:
install_pyenv.py
#!/usr/bin/python3
import getpass
import subprocess
def install_pyenv():
user = getpass.getuser()
if(user=="root"):
raise Exception("You are root - you should run this script as a normal user.")
else:
# Install pyenv
pyenvcmd = ["curl","-L","https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer","|","/bin/bash"]
subprocess.call(pyenvcmd, shell=True)
# We don't need to add ~/.pyenv/bin to $PATH,
# it is already done.
if __name__=="__main__":
install_pyenv()
As noted in the script, you will need to add ~/.pyenv/bin to the path, as that is where the Pyenv versions of Python live.
Next, we have a python script to install snakemake:
#!/usr/bin/python3
import getpass
import tempfile
import subprocess
def install_pyenv():
user = getpass.getuser()
if(user=="root"):
raise Exception("You are root - you should run this script as a normal user.")
else:
# Install snakemake
conda_version = "miniconda3-4.3.30"
installcmd = ["pyenv","install",conda_version]
subprocess.call(installcmd)
globalcmd = ["pyenv","global",conda_version]
subprocess.call(globalcmd)
# ---------------------------
# Install snakemake
pyenvbin = os.environ['HOME']
condabin = pyenvbin+"/.pyenv/shims/conda"
subprocess.call([condabin,"update"])
subprocess.call([condabin,"config","--all","channels","r"])
subprocess.call([condabin,"config","--all","channels","default"])
subprocess.call([condabin,"config","--all","channels","conda-forge"])
subprocess.call([condabin,"config","--all","channels","bioconda"])
subprocess.call([condabin,"install","--yes","-c","bioconda","snakemake"])
# ---------------------------
# Install osf cli client
pyenvbin = os.environ['HOME']
pipbin = pyenvbin+"/.pyenv/shims/pip"
subprocess.call([pipbin,"install","--upgrade","pip"])
subprocess.call([pipbin,"install","--user","osfclient"])
if __name__=="__main__":
install_pyenv()