Nextflow getting started
Before Getting Started
Windows Users
You should havve Windows Subsystem for Linux (WSL2) installed with a version of linux. My recommendation is that your version of linux should be Ubuntu 20.04
because you will find more help online when you search for linux help. If you don't already have WSL2 installed, follow these directions to install WSL2 on Windows 10. Once you have a linux terminal open, you can follow any linux guide online because you are now using linux (as a virtual machine on your windows computer). Java is part of the default installation of Ubuntu 20.04 so you should be all set to install nextflow.
Mac Users
You will need to install Java because it's not part of the default installation of MacOS. To check if you installed Java previously, open a terminal window and type java -version
and if you have it installed, you'll see which version is available.
Prerequisites
- Java version 8 or later
- You can check by running
java -version
at the terminal. (If your output isopenjdk version 1.8.xxx
this is version 8. If you want to read more about why, here's a link with more info.
- You can check by running
Installing Nextflow (local computer)
- Open a terminal window.
- You should already be in your home directory but you can type
cd ~
or simplycd
will also take you to your home directory. - Create a directory called
nextflow
and change directory to this new directory.mkdir nextflow && cd nextflow
- Download and execute the nextflow install file by typing the following into your terminal.
curl -s https://get.nextflow.io | bash
You can now run nextflow. Let's check the version by typing
./nextflow -version
.
But this is inconvenient because if you try to run nextflow from a different directory, you will need to type ~/nextflow/nextflow -version
so let's create a symlink so that we can use a shortcut. Type
sudo ln -s ~/nextflow/nextflow /usr/local/bin/
The ln
command is a useful command to know so you might want to read more about it.
Installing Nextflow on Xanadu
- Start an interactive session to keep the admins happy.
srun -p general -q general -t 4:00:00 --mem 4G --pty bash
- Create an
opt
directory in your home directory and change directory into this new directory.mkdir -p ~/opt && cd ~/opt
- Download and install the nextflow install script.
curl -s https://get.nextflow.io | bash
Add the path to the opt
directory to your PATH
- Open your
.bashrc
file usingvim
ornano
.vim ~/.bashrc
- Add the following line to the end of your
.bashrc
file.export PATH="/home/FCAM/$USER/opt/:$PATH"
- Source your
.bashrc
so the change takes effect.source ~/.bashrc
- Check if the new
opt
directory is in yourPATH
.echo $PATH | grep "$USER/opt"
- You should see your username and opt in red
Running Nextflow
Now you can just type nextflow -version
from any directory. Nextflow comes with a hello world pipeline ready to run so let's run our first pipeline!
nextflow run hello
The output of your pipeline should be "hello world" four times each in a different language.
Running Nextflow RNAtoy pipeline on Xanadu
If you haven't already done so, start an interactive session srun -p general -q general -t 4:00:00 -c 4 --mem 8G --pty bash
- Create a
nextflow_pipelines
directory in your home directory and change into this directorymkdir -p ~/nextflow_pipelines && cd ~/nextflow_pipelines
- Clone the
rnatoy
repo and change into this direcotry.git clone https://github.com/nextflow-io/rnatoy.git && cd rnatoy
- Load singularity
module load singularity
- Pull the needed docker container
singularity pull docker://nextflow/rnatoy:1.3
- Run the rnatoy pipeline using a singularity container
nextflow run main.nf -with-singularity rnatoy_1.3.sif