After installing an application, variables such as PATH and LD_LIBRARY_PATH must be set in order to call the application from any directory. The preferred method of setting the environment is to use the module load command. Typing module avail shows the modules installed by staff that are available system wide.

Users may also create their own custom modules.

Creating a custom module

Here is the general procedure to create a module for user maintained software.

Loading a custom module

To load the module, the whole path may be specified

module load /usr/local/usrapps/$GROUP/modulefiles/appname/[app version number]-[name and version of compiler]

Alternatively, the path to the modulefiles can be added by doing the following. (Do not add a slash '/' after modulefiles.)

module use --append /usr/local/usrapps/$GROUP/modulefiles
After doing module use --append, the custom modules should be visible when typing module avail, and then modules may be loaded as usual:
module load appname


Here is a full example of creating a module. This was done to install and create a module for SPAdes in the software group bioinfo. (Only members of bioinfo can access this module.)

Install the application

The following was done to install SPAdes:

mkdir /usr/local/usrapps/bioinfo/spades
cd /usr/local/usrapps/bioinfo/spades
tar -xzf SPAdes-3.14.0-Linux.tar.gz
rm SPAdes-3.14.0-Linux.tar.gz

This results in a directory called SPAdes-3.14.0-Linux, containing the directories

bin     #contains the executables
share   #often contains documentation 

Create the module

To create the module, first create the modulefiles and appname directories:

mkdir /usr/local/usrapps/bioinfo/modulefiles
cd /usr/local/usrapps/bioinfo/modulefiles
mkdir spades
cd spades
SPAdes was downloaded as a binary executable rather than being compiled; therefore, the naming convention is appname/[app version number]. The version number was 3.14.0.

From the directory /usr/local/usrapps/bioinfo/modulefiles/spades, create a text file called 3.14.0 containing

prepend-path PATH {/usr/local/usrapps/bioinfo/spades/SPAdes-3.14.0-Linux/bin};

Set the default module

In case there are or will be other versions of SPAdes installed, set 3.14.0 as default by creating a file /usr/local/usrapps/bioinfo/modulefiles/spades/.version containing

set ModulesVersion 3.14.0

Call the module

The module for SPAdes may be called from the command line or from an LSF batch script by doing

module load /usr/local/usrapps/bioinfo/modulefiles/spades/3.14.0
or by doing
module use --append /usr/local/usrapps/bioinfo/modulefiles
module load spades

Set the modules path to be available on login

To make the modules available upon logging in, without having to specify the full path or doing module use, add the following to the ~/.tcsh or ~/.bashrc file:

#User defined modules
module use --append /usr/local/usrapps/bioinfo/modulefiles

Usually modifications to the login files (.tcsh, .bashrc., .login) are discouraged, but this an appropriate use case for modifying those files.

Copyright © 2022 · Office of Information Technology · NC State University · Raleigh, NC 27695 · Accessibility · Privacy · University Policies