manifest {
  name = 'fastp'
  mainScript = 'main.nf'
  nextflowVersion = '!>=20.12.1-edge'
  version = 'v0.1.0'
  description = 'An ultra-fast all-in-one FASTQ preprocessor (QC/adapters/trimming/filtering/splitting/merging...).\n\nFeatures:\n\n  - comprehensive quality profiling for both before and after filtering data (quality curves, base contents, KMER, Q20/Q30, GC Ratio, duplication, adapter contents...)\n  - filter out bad reads (too low quality, too short, or too many N...)\n  - cut low quality bases for per read in its 5\' and 3\' by evaluating the mean quality from a sliding window (like Trimmomatic but faster).\n  - trim all reads in front and tail\n  - cut adapters. Adapter sequences can be automatically detected, which means you don\'t have to input the adapter sequences to trim them.\n  - correct mismatched base pairs in overlapped regions of paired end reads, if one base is with high quality while the other is with ultra low quality\n  - trim polyG in 3\' ends, which is commonly seen in NovaSeq/NextSeq data. Trim polyX in 3\' ends to remove unwanted polyX tailing (i.e. polyA tailing for mRNA-Seq data)\n  - preprocess unique molecular identifier (UMI) enabled data, shift UMI to sequence name.\n  - report JSON format result for further interpreting.\n  - visualize quality control and filtering results on a single HTML page (like FASTQC but faster and more informative).\n  - split the output to multiple files (0001.R1.gz, 0002.R1.gz...) to support parallel processing. Two modes can be used, limiting the total split file number, or limitting the lines of each split file.\n  - support long reads (data from PacBio / Nanopore devices).\n  - support reading from STDIN and writing to STDOUT\n  - support interleaved input\n  - support ultra-fast FASTQ-level deduplication\n'
}

process.container = 'nextflow/bash:latest'

// detect tempdir
tempDir = java.nio.file.Paths.get(
  System.getenv('NXF_TEMP') ?:
    System.getenv('VIASH_TEMP') ?: 
    System.getenv('TEMPDIR') ?: 
    System.getenv('TMPDIR') ?: 
    '/tmp'
).toAbsolutePath()

profiles {
  no_publish {
    process {
      withName: '.*' {
        publishDir = [
          enabled: false
        ]
      }
    }
  }
  mount_temp {
    docker.temp            = tempDir
    podman.temp            = tempDir
    charliecloud.temp      = tempDir
  }
  docker {
    docker.enabled         = true
    // docker.userEmulation   = true
    singularity.enabled    = false
    podman.enabled         = false
    shifter.enabled        = false
    charliecloud.enabled   = false
  }
  singularity {
    singularity.enabled    = true
    singularity.autoMounts = true
    docker.enabled         = false
    podman.enabled         = false
    shifter.enabled        = false
    charliecloud.enabled   = false
  }
  podman {
    podman.enabled         = true
    docker.enabled         = false
    singularity.enabled    = false
    shifter.enabled        = false
    charliecloud.enabled   = false
  }
  shifter {
    shifter.enabled        = true
    docker.enabled         = false
    singularity.enabled    = false
    podman.enabled         = false
    charliecloud.enabled   = false
  }
  charliecloud {
    charliecloud.enabled   = true
    docker.enabled         = false
    singularity.enabled    = false
    podman.enabled         = false
    shifter.enabled        = false
  }
}

process{
  withLabel: mem1gb { memory = 1000000000.B }
  withLabel: mem2gb { memory = 2000000000.B }
  withLabel: mem5gb { memory = 5000000000.B }
  withLabel: mem10gb { memory = 10000000000.B }
  withLabel: mem20gb { memory = 20000000000.B }
  withLabel: mem50gb { memory = 50000000000.B }
  withLabel: mem100gb { memory = 100000000000.B }
  withLabel: mem200gb { memory = 200000000000.B }
  withLabel: mem500gb { memory = 500000000000.B }
  withLabel: mem1tb { memory = 1000000000000.B }
  withLabel: mem2tb { memory = 2000000000000.B }
  withLabel: mem5tb { memory = 5000000000000.B }
  withLabel: mem10tb { memory = 10000000000000.B }
  withLabel: mem20tb { memory = 20000000000000.B }
  withLabel: mem50tb { memory = 50000000000000.B }
  withLabel: mem100tb { memory = 100000000000000.B }
  withLabel: mem200tb { memory = 200000000000000.B }
  withLabel: mem500tb { memory = 500000000000000.B }
  withLabel: mem1gib { memory = 1073741824.B }
  withLabel: mem2gib { memory = 2147483648.B }
  withLabel: mem4gib { memory = 4294967296.B }
  withLabel: mem8gib { memory = 8589934592.B }
  withLabel: mem16gib { memory = 17179869184.B }
  withLabel: mem32gib { memory = 34359738368.B }
  withLabel: mem64gib { memory = 68719476736.B }
  withLabel: mem128gib { memory = 137438953472.B }
  withLabel: mem256gib { memory = 274877906944.B }
  withLabel: mem512gib { memory = 549755813888.B }
  withLabel: mem1tib { memory = 1099511627776.B }
  withLabel: mem2tib { memory = 2199023255552.B }
  withLabel: mem4tib { memory = 4398046511104.B }
  withLabel: mem8tib { memory = 8796093022208.B }
  withLabel: mem16tib { memory = 17592186044416.B }
  withLabel: mem32tib { memory = 35184372088832.B }
  withLabel: mem64tib { memory = 70368744177664.B }
  withLabel: mem128tib { memory = 140737488355328.B }
  withLabel: mem256tib { memory = 281474976710656.B }
  withLabel: mem512tib { memory = 562949953421312.B }
  withLabel: cpu1 { cpus = 1 }
  withLabel: cpu2 { cpus = 2 }
  withLabel: cpu5 { cpus = 5 }
  withLabel: cpu10 { cpus = 10 }
  withLabel: cpu20 { cpus = 20 }
  withLabel: cpu50 { cpus = 50 }
  withLabel: cpu100 { cpus = 100 }
  withLabel: cpu200 { cpus = 200 }
  withLabel: cpu500 { cpus = 500 }
  withLabel: cpu1000 { cpus = 1000 }
}


