name: bedtools_cluster
namespace: bedtools
description: |
  Cluster overlapping or nearby genomic intervals.
  
  This tool groups genomic intervals into clusters based on overlap
  or proximity within a specified distance. Each cluster is assigned
  a unique cluster ID, making it useful for analyzing genomic feature
  distributions and relationships.

keywords: [genomics, intervals, clustering, overlap, proximity, grouping]
links:
  homepage: https://bedtools.readthedocs.io/
  documentation: https://bedtools.readthedocs.io/en/latest/content/tools/cluster.html
  repository: https://github.com/arq5x/bedtools2
references:
  doi: 10.1093/bioinformatics/btq033
license: MIT

requirements:
  commands: [bedtools]

authors:
  - __merge__: /src/_authors/robrecht_cannoodt.yaml
    roles: [author, maintainer]

argument_groups:
  - name: Inputs
    arguments:
      - name: --input
        alternatives: [-i]
        type: file
        description: |
          Input file in BED, GFF, or VCF format.
          
          **BED format:** Standard genomic interval format
          **GFF format:** Gene feature format with annotations
          **VCF format:** Variant call format
          **Requirements:** Must be sorted by chromosome and position
        required: true
        example: intervals.bed
    
  - name: Outputs
    arguments:
      - name: --output
        type: file
        direction: output
        description: |
          Output file with cluster assignments.
          
          Contains original intervals with an additional column showing
          the cluster ID for each interval. Intervals in the same cluster
          have the same cluster ID number.
        required: true
        example: clustered.bed

  - name: Clustering Options
    arguments:
      - name: --distance
        alternatives: [-d]
        type: integer
        description: |
          Maximum distance between features for clustering.
          
          **Default:** 0 (only overlapping and book-ended features clustered)
          **Positive values:** Cluster features within specified distance
          **Use case:** Group nearby but non-overlapping features
        default: 0
        example: 1000

      - name: --strand
        alternatives: [-s]
        type: boolean_true
        description: |
          Force strandedness in clustering.
          
          **Default:** Clustering ignores strand information
          **When enabled:** Only cluster features on the same strand
          **Use case:** Strand-specific analysis of genomic features

resources:
  - type: bash_script
    path: script.sh
test_resources:
  - type: bash_script
    path: test.sh
  - path: /src/_utils/test_helpers.sh

engines:
  - type: docker
    image: quay.io/biocontainers/bedtools:2.31.1--h13024bc_3
    setup:
      - type: docker
        run: |
          bedtools --version 2>&1 | head -1 | sed 's/.*bedtools v/bedtools: /' > /var/software_versions.txt

runners:
  - type: executable
  - type: nextflow
