Search code examples
dockercontainersnextflow

Nextflow config file issue


Nextflow config file issue

Hi Please find below a nf script and a config file. I have run them on two computers. Both computers have nextflow (v 22.04.5) and docker installed. However, one computer shows an error message. Please see the screenshot attached. I checked the log file, and it has just one “command not found”. I was wondering if you could point out what is missing in this computer. Thanks.

nextflow script

#!/usr/bin/env nextflow

//data_location
params.outdir = './results'
params.in = "$PWD/*.fastq"
datasetA = Channel
                .fromPath(params.in)
                .map { file -> tuple(file.baseName, file) }
        

// fastqc

process fastqc {
    tag "${datasetIDA}"
    publishDir "${params.outdir}", mode:'copy'

    input:
    set datasetIDA, file(x) from datasetA

    output:
    file ("${x.baseName}_fastqc.html") into fastqc_ch
            
    script:
    """
    fastqc -Xmx20g $x > ${x.baseName}_fastqc.html
    """
}

config file


process {
    withName:fastqc                            { container = 'staphb/fastqc:latest' }
}

Solution

  • The problem is that Docker execution is not enabled by default. When it's disabled, Nextflow just tries to execute the process outside of the container. To enable Docker execution, add the following line to your Nextflow config:

    docker.enabled = true
    

    Nextflow looks for configuration files in multiple places. Check to see if both machines are using the same set of configuration files. For example, one machine may have already set the above in its $HOME/.nextflow/config but this file might not exist on the other machine.

    Test:

    $ touch {A,B,C}.fastq
    $ cat nextflow.config 
    docker.enabled = true
    
    process {
      withName: 'fastqc' {
        container = 'staphb/fastqc:latest'
      }
    }
    

    Results:

    $ nextflow run main.nf -dsl1
    N E X T F L O W  ~  version 22.04.4
    Launching `main.nf` [jolly_brown] DSL1 - revision: 2c6f171a28
    executor >  local (3)
    [97/7b5758] process > fastqc (B) [100%] 3 of 3 ✔
    Completed at: 03-Oct-2022 21:08:43
    Duration    : 2m 50s
    CPU hours   : 0.1
    Succeeded   : 3