/*
 * -------------------------------------------------
 *  Nextflow config file for running tests
 * -------------------------------------------------
 * Defines bundled input files and everything required
 * to run a fast and simple test. Use as follows:
 * nextflow run nf-core/eager -profile test, docker (or singularity, or conda)
 */

params {
   config_profile_name = 'nf-core/eager stresstess - human profile'
   config_profile_description = "A large-scale benchmarking profile AWS stress-testing of large sample number study" 

   //Input data
   input = 'https://raw.githubusercontent.com/nf-core/test-datasets/eager/testdata/Benchmarking/human_stresstest.tsv'
   // Genome reference
   fasta = 'https://hgdownload.soe.ucsc.edu/goldenPath/hg19/bigZips/hg19.fa.gz'

   save_reference = true

   email = 'james@nf-co.re'

   run_mtnucratio = true
   mtnucratio_header = 'ChrM'

   run_bam_filtering = true
   bam_discard_unmapped = true
   bam_unmapped_type = 'discard'
   bam_mapping_quality_threshold = 30

   dedupper = 'markduplicates'
  
   run_sexdeterrmine = true
   sexdeterrmine_bedfile = 'https://raw.githubusercontent.com/nf-core/test-datasets/eager/reference/Human/1240K.pos.list_HG19.0based.bed.gz'

   run_nuclear_contamination = true
   contamination_chrom_name = 'chrX'

   run_mtnucratio = true


}

process {

   errorStrategy = 'retry'
   
   maxRetries = 5

   withName:'makeBWAIndex'{
      time = { check_max( 48.h * task.attempt, 'time' ) }
   }
   withName:'adapter_removal'{
      cpus = { check_max( 8, 'cpus' ) }
      memory = { check_max( 16.GB * task.attempt, 'memory' ) }
      time = { check_max( 48.h * task.attempt, 'time' ) }
   }
   withName:'bwa'{
      cpus = { check_max( 8, 'cpus' ) }
      memory = { check_max( 16.GB * task.attempt, 'memory' ) }
      time = { check_max( 48.h * task.attempt, 'time' ) }
   }
   withName:'markduplicates'{
      errorStrategy = { task.exitStatus in [143,137,104,134,139] ? 'retry' : 'finish' }
      cpus = { check_max( 16, 'cpus' ) }
      memory = { check_max( 16.GB * task.attempt, 'memory' ) }
      time = { check_max( 48.h * task.attempt, 'time' ) }
   }
   withName:'damageprofiler'{
      cpus = 1
      memory = { check_max( 8.GB * task.attempt, 'memory' ) }
      time = { check_max( 48.h * task.attempt, 'time' ) }
   }
}
