manifest {
  name = 'bedtools/bedtools_closest'
  mainScript = 'main.nf'
  nextflowVersion = '!>=20.12.1-edge'
  version = 'main'
  description = 'Find the closest feature in file B for each feature in file A.\n\nFor each interval in file A, this tool identifies the nearest feature in\nfile B, regardless of whether they overlap. Useful for associating genomic\nfeatures with their nearest neighbors, such as finding the closest gene\nto each SNP or the nearest regulatory element to each promoter.\n\n**Default behavior:** Reports closest feature regardless of strand or overlap\n**Distance reporting:** Optional distance calculation with various orientations\n**Multiple hits:** Configurable handling of ties and k-nearest neighbors\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 }
}


