{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "bedtools_spacing",
  "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",
  "type": "object",
  "$defs": {
    "inputs": {
      "title": "Inputs",
      "type": "object",
      "description": "No description",
      "properties": {
        "input": {
          "type": "string",
          "format": "path",
          "exists": true,
          "description": "Input file containing genomic intervals for spacing analysis.\n\n**Format:** BED, GFF, VCF, or BAM file\n**Content:** Genomic intervals to analyze for gap spacing\n**Requirements:** Must be sorted by chromosome and start coordinate (sort -k1,1 -k2,2n)\n**Output:** Original intervals with gap distances appended as last column\n",
          "help_text": "Type: `file`, multiple: `False`, required, direction: `input`, example: `\"sorted_features.bed\"`. "
        }
      }
    },
    "outputs": {
      "title": "Outputs",
      "type": "object",
      "description": "No description",
      "properties": {
        "output": {
          "type": "string",
          "format": "path",
          "description": "Output file with gap spacing information appended.\n\n**Format:** Same format as input with additional spacing column\n**Content:** Original intervals plus gap distances in the last column\n**Gap values:** \n- \".\" for first interval on each chromosome\n- \"0\" for adjacent intervals \n- \"-1\" for overlapping intervals\n- Positive integers for gap sizes\n",
          "help_text": "Type: `file`, multiple: `False`, required, default: `\"$id.$key.output.bed\"`, direction: `output`, example: `\"intervals_with_spacing.bed\"`. ",
          "default": "$id.$key.output.bed"
        }
      }
    },
    "format options": {
      "title": "Format Options",
      "type": "object",
      "description": "No description",
      "properties": {
        "output_bed": {
          "type": "boolean",
          "description": "Convert BAM input to BED format output.\n\n**Usage:** Only applicable when input is BAM format\n**Effect:** Output genomic coordinates in BED format instead of maintaining BAM format\n**Applications:** Converting alignment data to interval format with spacing information\n**Default:** false (maintain input format)\n",
          "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ",
          "default": false
        },
        "include_header": {
          "type": "boolean",
          "description": "Include the original file header in output.\n\n**Usage:** Preserves metadata and format information from input\n**Applications:** Maintaining file structure and annotations\n**Formats:** Particularly relevant for VCF and GFF files\n**Default:** false (no header included)\n",
          "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ",
          "default": false
        }
      }
    },
    "performance options": {
      "title": "Performance Options",
      "type": "object",
      "description": "No description",
      "properties": {
        "no_buffer": {
          "type": "boolean",
          "description": "Disable output buffering for real-time processing.\n\n**Effect:** Each line printed immediately instead of buffered\n**Trade-off:** Slower output but enables real-time processing\n**Applications:** Pipeline integration, streaming analysis\n**Default:** false (buffered output for performance)\n",
          "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ",
          "default": false
        },
        "input_buffer": {
          "type": "string",
          "description": "Amount of memory to allocate for input buffer.\n\n**Format:** Integer with optional K/M/G suffix\n**Examples:** \"1G\", \"512M\", \"2048K\"\n**Usage:** Larger buffers can improve I/O performance for large files\n**Note:** Currently has no effect with compressed files\n",
          "help_text": "Type: `string`, multiple: `False`, example: `\"1G\"`. "
        }
      }
    },
    "nextflow input-output arguments": {
      "title": "Nextflow input-output arguments",
      "type": "object",
      "description": "Input/output parameters for Nextflow itself. Please note that both publishDir and publish_dir are supported but at least one has to be configured.",
      "properties": {
        "publish_dir": {
          "type": "string",
          "description": "Path to an output directory.",
          "help_text": "Type: `string`, multiple: `False`, required, example: `\"output/\"`. "
        }
      }
    }
  },
  "allOf": [
    {
      "$ref": "#/$defs/inputs"
    },
    {
      "$ref": "#/$defs/outputs"
    },
    {
      "$ref": "#/$defs/format options"
    },
    {
      "$ref": "#/$defs/performance options"
    },
    {
      "$ref": "#/$defs/nextflow input-output arguments"
    }
  ]
}
