These are chat archives for nextflow-io/nextflow

13th
Oct 2018
Firas
@FirasSadiyah
Oct 13 2018 06:39

Good morning.
I am trying to run ngs.plot.r as part of my nextflow script in a similar fashion to nf-core/chipseq. I am getting Process 'ngsplot' terminated with an error exit status (140). I understand that error 140 on SGE means that the process has been killed as it is using more resources that it has requested.
Things I tried:
1) allocates more memory and CPU cores to the process using

    cpus 8
    penv 'cores'
    memory 64.GB

2) edit the code of ngs.plot.r to specify the cores.number

# Register doMC with CPU number.
if(cores.number == 0){
    registerDoMC()
} else {
    registerDoMC(4)            # instead of registerDoMC(cores.number)
}

When I switch to relevant work folder and executes the command, it works like charm. Also, I am using sub-samples of 50,000 reads only for testing purposes.

The relevant part of my main.nf

process ngsplot {
    errorStrategy { task.exitStatus == 140 ? 'retry' : 'ignore'  } 
    publishDir "${params.outdir}/10ngsplot", mode: 'copy'
    cpus 8
    penv 'cores'
    memory 64.GB

    input:
    file downsampled_sorted_bam from downsampled_sorted_bam_ngsplot.collect()
    file downsampled_sorted_index from downsampled_sorted_index_ngsplot.collect()

    output:
    file '*.pdf'

    script:
    """
    $HOME/ngsplot/ngs_config_generate.r $downsampled_sorted_bam
    ngs.plot.r -G $params.ngsplot_genome -R enhancer -C ngsplot_config -O Enhancer -FL 300
    """
}

The full error message

ERROR ~ Error executing process > 'ngsplot'   

Caused by:             
  Process `ngsplot` terminated with an error exit status (140)                               

Command executed:      

/path/to/this/folder/ngs_config_generate.r Naive_KO3_downsampled.sorted.bam Naive_KO1_downsampled.sorted.bam Naive_WT3_downsampled.sorted.bam Naive_WT1_downsampled.sorted.bam
  ngs.plot.r -G mm9 -R enhancer -C ngsplot_config -O Enhancer -FL 300                        

Command exit status:   
  140                  

Command output:        
  Configuring variables...                    
  Using database:      
  /path/to/this/folder/r-ngsplot-2.63-1/database/mm9/enhancer/mm9.ensembl.enhancer.mESC.All.protein_coding.RData
  Done                 
  Loading R libraries.....Done                
  Analyze bam files and calculate coverage...............................                    

Command wrapper:       
  Configuring variables...                    
  Using database:      
  /path/to/this/folder/r-ngsplot-2.63-1/database/mm9/enhancer/mm9.ensembl.enhancer.mESC.All.protein_coding.RData
  Done                 
  Loading R libraries.....Done                
  Analyze bam files and calculate coverage...............................                    

Work dir:              
  /path/to/this/folder/work/1a/e29eda7bca1cedfd04cf7e0e29ae2e                 

Tip: when you have fixed the problem you can continue the execution appending to the nextflow command line the option `-resume`

 -- Check '.nextflow.log' file for details    
WARN: Killing pending tasks (1)