arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

Nextflow CLI

hashtag
Nextflow CLI

In this tutorial, we will demonstrate how to create and launch a Nextflow pipeline using the ICA command line interface (CLI).

hashtag
Installation

Please refer to for installing ICA CLI. To authenticate, please follow the steps in the page.

hashtag
Tutorial project

In this tutorial, we will create pipeline in ICA which includes four processes:

  • index creation

  • quantification

  • FastQC

  • MultiQC

We will also upload a Docker container to the ICA Docker repository for use within the pipeline.

hashtag
main.nf

The 'main.nf' file defines the pipeline that orchestrates various RNASeq analysis processes.

The script uses the following tools:

  • Salmon: Software tool for quantification of transcript abundance from RNA-seq data.

  • FastQC: QC tool for sequencing data

  • MultiQC: Tool to aggregate and summarize QC reports

We need a Docker container containing these tools. For the sake of this tutorial, we will use the container from the original tutorial. You can refer to the section to build your own docker image with the required tools.

hashtag
Docker image upload

With in your computer, download the image required for this project using the following command.

docker pull nextflow/rnaseq-nf

Create a tarball of the image to upload to ICA.

Following are lists of commands that you can use to upload the tarball to your project.

Add the image to the ICA Docker repository

The uploaded image can be added to the ICA docker repository from the ICA Graphical User Interface (GUI).

Change the format for the image tarball to DOCKER:

  1. Navigate to Projects > your_project > Data.

  2. Check the checkbox for the uploaded tarball.

  3. Click on Manage > Change format.

To add this image to the ICA Docker repository, first click on Projects to go back to the home page.

  1. From the ICA home page, click on the System Settings > Docker Repository > Create > Image.

  2. This will open a new window that lets you select the region (US, EU, CA) in which your your project is and the docker image from the bottom pane.

  3. Edit the Name field to rename it. For this tutorial, we will change the name to "rnaseq". Select the region, and give it a version number, and description. Click on "Save".

circle-info

If you have the images hosted in other repositories, you can add them as external image by using System Settings > Docker Repository > Create > External Image.

After creating a new docker image, you can click on the image to get the container URL (under Regions) for the nextflow configuration file.

hashtag
Nextflow configuration file

Create a configuration file called "nextflow.config" in the same folder as the main.nf file above. Use the URL copied above to add the process.container line in the config file.

You can add a pod directive within a process or in the config file to specify a compute type. The following is an example of a configuration file with the 'standard-small' compute type for all processes. Please refer to the page for a list of available compute types.

hashtag
Parameters file

The parameters file defines the pipeline input parameters. Refer to the or input for detailed information for creating correctly formatted parameters files.

An empty form looks as follows:

The input files are specified within a single dataInputs node with individual input file specified in a separate dataInput node. Settings (as opposed to files) are specified within the steps node. Settings represent any non-file input to the pipeline, including but not limited to, strings, booleans, integers, etc..

For this tutorial, we do not have any settings parameters but it requires multiple file inputs. The parameters.xml file looks as follows:

Use the following commands to create the pipeline with the above contents in your project.

If not already in the project context, enter it by using the following command:

icav2 enter <PROJECT NAME or ID>

Create pipeline using icav2 project pipelines create nextflow Example:

If you prefer to organize the processes in different folders/files, you can use --other parameter to upload the different processes as additional files. Example:

You can refer to page to explore options to automate this process.

Refer to for details on running the pipeline from CLI.

Example command to run the pipeline from CLI:

You can get the pipeline id under "ID" column by running the following command:

You can get the file ids under "ID" column by running the following commands:

Please refer to command help (icav2 [command] --help) to determine available flags to filter output of above commands if necessary. You can also refer to page for available flags for the icav2 commands.

For more help on uploading data to ICA, please refer to the page.

In the new popup window, select "DOCKER" format and save.
these instructionsarrow-up-right
Authenticationarrow-up-right
Simple RNA-Seqarrow-up-right
"Build and push to ICA your own Docker image"
Docker installedarrow-up-right
Compute Types
JSON
XML
Nextflow: Pipeline Lift
Launch Pipelines on CLI
Command Index
Data Transfer options
nextflow.enable.dsl = 2

process INDEX {
   input:
       path transcriptome_file

   output:
       path 'salmon_index'

   script:
       """
       salmon index -t $transcriptome_file -i salmon_index
       """
}

process QUANTIFICATION {
   publishDir 'out', mode: 'symlink'

   input:
       path salmon_index
       tuple path(read1), path(read2)
       val(quant)

   output:
       path "$quant"

   script:
       """
       salmon quant --libType=U -i $salmon_index -1 $read1 -2 $read2 -o $quant
       """
}

process FASTQC {

   input:
       tuple path(read1), path(read2)

   output:
       path "fastqc_logs"

   script:
       """
       mkdir fastqc_logs
       fastqc -o fastqc_logs -f fastq -q ${read1} ${read2}
       """
}

process MULTIQC {
   publishDir 'out', mode:'symlink'

   input:
       path '*'

   output:
       path 'multiqc_report.html'

   script:
       """
       multiqc .
       """
}

workflow {
   index_ch = INDEX(Channel.fromPath(params.transcriptome_file))
   quant_ch = QUANTIFICATION(index_ch, Channel.of([file(params.read1), file(params.read2)]),Channel.of("quant"))
   fastqc_ch = FASTQC(Channel.of([file(params.read1), file(params.read2)]))
   MULTIQC(quant_ch.mix(fastqc_ch).collect())
}
docker save nextflow/rnaseq-nf > cont_rnaseq.tar
# Enter the project context
icav2 enter docs
# Upload the container image to the root directory (/) of the project
icav2 projectdata upload cont_rnaseq.tar /
process.container = '079623148045.dkr.ecr.us-east-1.amazonaws.com/cp-prod/3cddfc3d-2431-4a85-82bb-dae061f7b65d:latest'
process {
    container = '079623148045.dkr.ecr.us-east-1.amazonaws.com/cp-prod/3cddfc3d-2431-4a85-82bb-dae061f7b65d:latest'
    pod = [
        annotation: 'scheduler.illumina.com/presetSize',
        value: 'standard-small'
    ]  
}
<pipeline code="" version="1.0" xmlns="xsd://www.illumina.com/ica/cp/pipelinedefinition">
   <dataInputs>
   </dataInputs>
   <steps>
   </steps>
</pipeline>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<pd:pipeline xmlns:pd="xsd://www.illumina.com/ica/cp/pipelinedefinition" code="" version="1.0">
   <pd:dataInputs>
       <pd:dataInput code="read1" format="FASTQ" type="FILE" required="true" multiValue="false">
           <pd:label>FASTQ Read 1</pd:label>
           <pd:description>FASTQ Read 1</pd:description>
       </pd:dataInput>
       <pd:dataInput code="read2" format="FASTQ" type="FILE" required="true" multiValue="false">
           <pd:label>FASTQ Read 2</pd:label>
           <pd:description>FASTQ Read 2</pd:description>
       </pd:dataInput>
       <pd:dataInput code="transcriptome_file" format="FASTA" type="FILE" required="true" multiValue="false">
           <pd:label>Transcript</pd:label>
           <pd:description>Transcript faster</pd:description>
       </pd:dataInput>
   </pd:dataInputs>
   <pd:steps/>
</pd:pipeline>
icav2 projectpipelines create nextflow rnaseq-docs --main main.nf --parameter parameters.xml --config nextflow.config --storage-size small --description 'cli nextflow pipeline'
icav2 projectpipelines create nextflow rnaseq-docs --main main.nf --parameter parameters.xml --config nextflow.config --other index.nf:filename=processes/index.nf --other quantification.nf:filename=processes/quantification.nf --other fastqc.nf:filename=processes/fastqc.nf --other multiqc.nf:filename=processes/multiqc.nf --storage-size small --description 'cli nextflow pipeline'
icav2 projectpipelines start nextflow <pipeline_id> --input read1:<read1_file_id> --input read2:<read2_file_id> --input transcriptome_file:<transcriptome_file_id> --storage-size small --user-reference demo_run
icav2 projectpipelines list
icav2 projectdata list