The following question was recently asked on Biostar "Bioinformatics: how to version control small scripts located all over the server". I suggested to put the scripts in a central repository (under git or whatever ) and to use symbolic links in the workspaces to manage the files. On the other hand, Alex Reynolds suggested to use a Module to deploy versions of a given package.
http://modules.sourceforge.net/: " The Environment Modules package provides for the dynamic modification of a user's environment via modulefiles. Each modulefile contains the information needed to configure the shell for an application. Once the Modules package is initialized, the environment can be modified on a per-module basis using the module command which interprets modulefiles. Typically modulefiles instruct the module command to alter or set shell environment variables such as PATH, MANPATH, etc. modulefiles may be shared by many users on a system and users may have their own collection to supplement or replace the shared modulefiles."
This tool was also suggested on cited by Lex Nederbragt on twitter:
@yokofakun Yep, module system would allow central place for code/binaries. Load module where/when needed. Loading can be scripted too.
/ Lex Nederbragt (@lexnederbragt) October 5, 2013
I've just played with Modules, here is my (short) experience.
I've got two versions of samtools on my server : 0.1.18 and 0.1.19, I want to easily switch from one version to another.
I created a hidden directory in my home:
mkdir ~/.modulesit contains a directory "samtools" that will contain the two 'modules files' for the two versions of samtools:
mkdir ~/.modules/samtools
The directory '~/.modules' is added to the variable ${MODULESPATH} ( The path that the module command searches when looking for modulefiles )
$ export MODULEPATH=${MODULEPATH}:${HOME}/.modules
Create the Module File
'${HOME}/.modules/samtools/0.1.18'
for samtools 0.1.18: This module file add the PATH to samtools0.1.18 and bcftools0.1.18#%Module1.0 proc ModulesHelp { } { global dotversion puts stderr "\tSamtools" } module-whatis "Samtools 0.1.18" prepend-path PATH /commun/data/packages/samtools-0.1.18/ prepend-path PATH /commun/data/packages/samtools-0.1.18/bcftools
Create the Module File
'${HOME}/.modules/samtools/0.1.19'
for samtools 0.1.19: This module file add the PATH to samtools0.1.19 and bcftools0.1.19#%Module1.0 proc ModulesHelp { } { global dotversion puts stderr "\tSamtools" } module-whatis "Samtools 0.1.19" prepend-path PATH /commun/data/packages/samtools-0.1.19/ prepend-path PATH /commun/data/packages/samtools-0.1.19/bcftools
We also create a file '${HOME}/.modules/samtools/.version' to define the default version of samtools:
#%Module1.0 set ModulesVersion "0.1.19"
On startup the shell doesn't know samtools or bcftools:
$ which samtools /usr/bin/which: no samtools in (/commun/sge_root/bin/lx24-amd64:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/lindenb/bin) $ which bcftools /usr/bin/which: no bcftools in (/commun/sge_root/bin/lx24-amd64:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/lindenb/bin)List the available modules :
$ module avail
------------------------------------------------ /usr/share/Modules/modulefiles ------------------------------------------------
dot module-cvs module-info modules mpich2-x86_64 null use.own
---------------------------------------------------- /home/lindenb/.modules ----------------------------------------------------
samtools/0.1.18 samtools/0.1.19(default)
Let's load the default configuration for samtools:$ module load samtools
now, the shell know the PATH to samtools:
$ which samtools /commun/data/packages/samtools-0.1.19/samtools $ which bcftools /commun/data/packages/samtools-0.1.19/bcftools/bcftools
Unload the module for samtools:
$ module unload samtools $ which samtools /usr/bin/which: no samtools in (/commun/sge_root/bin/lx24-amd64:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/lindenb/bin) $ which bcftools /usr/bin/which: no bcftools in (/commun/sge_root/bin/lx24-amd64:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/lindenb/bin)
Now load the (old) version 0.1.18 of samtools
$ module load samtools/0.1.18
The old versions of samtools and bcftools are now in the $PATH:
$ which samtools /commun/data/packages/samtools-0.1.18/samtools $ which bcftools /commun/data/packages/samtools-0.1.18/bcftools/bcftoolsThat's it,
Pierre
Some more tips:
ReplyDeletemodule list --> list all loaded modules
module avail modulename -->list all available versions of modulename
module display modulename --> list info for module