6.3 EXERCISE 4

  • Look at EXERCISE 3.
    Can you make a configuration for that script with a new label for handling failing processes?
Answer

The process should become:


process reverseSequence {
    tag { "${seq}" }                  
    publishDir "output"
    label 'ignorefail'
    
    input:
    path seq

    output:
    path "all.rev"

    script:
    """
    cat ${seq} | AAAAA '{if (\$1~">") {print \$0} else system("echo " \$0 " |rev")}' > all.rev
    """
}

while the nextflow.config file would be:


process {
     withLabel: 'ignorefail'
    {
        errorStrategy = 'ignore' 
     }   
}
  • Now look at test2.nf.
    Can you make a configuration for that script with a new label for handling failing processes by retrying 3 times and incrementing the time?
    You can give very low time (10 / 15 seconds) for the fastqc process so it would fail at beginning.
Answer

The process should become:


process fastQC {
    publishDir fastqcOutputFolder   // where (and whether) to publish the results
    tag { "${reads}" }  // during the execution prints the indicated variable for follow-up
    label 'keep_trying' 

    input:
    path reads      // it defines the input of the process. It sets values from a channel

    output:                                 // It defines the output of the process (i.e. files) and send to a new channel
    path "*_fastqc.*"

    script:                                 // here you have the execution of the script / program. Basically is the command line
    """
        fastqc ${reads} 
    """
}

while the nextflow.config file would be:

includeConfig "$baseDir/params.config"

 
process {
     //containerOptions = { workflow.containerEngine == "docker" ? '-u $(id -u):$(id -g)': null}
     memory='0.6G'
     cpus='1'
     time='6h'

     withLabel: 'keep_trying'   
    { 
        time = { 10.second * task.attempt }
        errorStrategy = 'retry' 
        maxRetries = 3  
    }   

}

process.container = 'biocorecrg/c4lwg-2018:latest'
singularity.cacheDir = "$baseDir/singularity"