Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

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

  1. Java version 8 or later
    • You can check by running java -version at the terminal. (If your output is openjdk version 1.8.xxx this is version 8. If you want to read more about why, here's a link with more info.

Installing Nextflow (local computer)

  1. Open a terminal window.
  2. You should already be in your home directory but you can type cd ~ or simply cd will also take you to your home directory.
  3. Create a directory called nextflow and change directory to this new directory.
    • mkdir nextflow && cd nextflow
  4. 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

  1. Start an interactive session to keep the admins happy.
    • srun -p general -q general -t 4:00:00 --mem 4G --pty bash
  2. Create an opt directory in your home directory and change directory into this new directory.
    • mkdir -p ~/opt && cd ~/opt
  3. Download and install the nextflow install script.
    • curl -s https://get.nextflow.io | bash

Add the path to the opt directory to your PATH

  1. Open your .bashrc file using vim or nano.
    • vim ~/.bashrc
  2. Add the following line to the end of your .bashrc file.
    • export PATH="/home/FCAM/$USER/opt/:$PATH"
  3. Source your .bashrc so the change takes effect.
    • source ~/.bashrc
  4. Check if the new opt directory is in your PATH.
    • 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

  1. Create a nextflow_pipelines directory in your home directory and change into this directory
    • mkdir -p ~/nextflow_pipelines && cd ~/nextflow_pipelines
  2. Clone the rnatoy repo and change into this direcotry.
    • git clone https://github.com/nextflow-io/rnatoy.git && cd rnatoy
  3. Load singularity
    • module load singularity
  4. Pull the needed docker container
    • singularity pull docker://nextflow/rnatoy:1.3
  5. Run the rnatoy pipeline using a singularity container
    • nextflow run main.nf -with-singularity rnatoy_1.3.sif