manifest {
  name = 'bedtools/bedtools_spacing'
  mainScript = 'main.nf'
  nextflowVersion = '!>=20.12.1-edge'
  version = 'main'
  description = 'Calculate gaps between adjacent genomic intervals within each chromosome.\n\nbedtools spacing analyzes sorted genomic intervals and reports the gap length \nbetween each interval and its predecessor on the same chromosome. The gap distances \nare added as an additional column to the output, providing insight into the spatial \ndistribution of features.\n\nThis tool is commonly used for:\n- Analyzing spacing patterns in genomic features\n- Quality control of interval datasets and their density\n- Identifying clustering or regular spacing in genomic data\n- Preprocessing for downstream spatial analysis\n- Detecting overlapping or adjacent intervals in datasets\n- Statistical analysis of genomic feature distribution\n'
  author = 'Robrecht Cannoodt'
}

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 }
}


