{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "bedtools_sample",
  "description": "Take a random sample of records from BED/GFF/VCF/BAM files using reservoir sampling algorithm.\n\nbedtools sample uses the reservoir sampling algorithm to randomly select a specified number\nof records from genomic interval files. This is particularly useful for creating representative\nsubsets of large datasets for testing, quality control, or downstream analysis.\n\nThis tool is commonly used for:\n- Creating representative subsets of large genomic datasets\n- Quality control and validation with smaller sample sizes\n- Testing pipelines with manageable data volumes\n- Generating training datasets for machine learning applications\n- Reducing file sizes while maintaining statistical properties\n",
  "type": "object",
  "$defs": {
    "inputs": {
      "title": "Inputs",
      "type": "object",
      "description": "No description",
      "properties": {
        "input": {
          "type": "string",
          "format": "path",
          "exists": true,
          "description": "Input file to sample from.\n\n**Format:** BED, GFF, VCF, or BAM file\n**Content:** Genomic intervals or alignments to sample from\n**Usage:** Records will be randomly selected from this file\n**Requirements:** File must be in valid format for the specified type\n",
          "help_text": "Type: `file`, multiple: `False`, required, direction: `input`, example: `\"large_dataset.bed\"`. "
        }
      }
    },
    "outputs": {
      "title": "Outputs",
      "type": "object",
      "description": "No description",
      "properties": {
        "output": {
          "type": "string",
          "format": "path",
          "description": "Output file containing the sampled records.\n\n**Format:** Same format as input file\n**Content:** Randomly selected subset of input records\n**Size:** Contains exactly n records (unless input has fewer records)\n",
          "help_text": "Type: `file`, multiple: `False`, required, default: `\"$id.$key.output.bed\"`, direction: `output`, example: `\"sampled_subset.bed\"`. ",
          "default": "$id.$key.output.bed"
        }
      }
    },
    "sampling options": {
      "title": "Sampling Options",
      "type": "object",
      "description": "No description",
      "properties": {
        "number": {
          "type": "integer",
          "description": "Number of records to randomly sample.\n\n**Default:** 1,000,000\n**Range:** 1 to total number of records in input\n**Usage:** If input has fewer records than requested, all records are returned\n**Memory:** All selected records held in memory before output\n",
          "help_text": "Type: `integer`, multiple: `False`, example: `10000`. "
        },
        "seed": {
          "type": "integer",
          "description": "Integer seed for random number generation.\n\n**Usage:** Ensures reproducible random sampling\n**Range:** Any integer value\n**Default:** Automatically chosen seed (non-reproducible)\n**Applications:** Reproducible research, testing, validation\n",
          "help_text": "Type: `integer`, multiple: `False`, example: `42`. "
        }
      }
    },
    "strand options": {
      "title": "Strand Options",
      "type": "object",
      "description": "No description",
      "properties": {
        "strand_requirement": {
          "type": "string",
          "description": "Require records from specific strand orientation.\n\n**Values:** \"forward\", \"reverse\", or unspecified for both strands\n**Usage:** Only sample records from the specified strand\n**Requirements:** Input must contain strand information\n**Applications:** Strand-specific analyses, RNA-seq processing\n",
          "help_text": "Type: `string`, multiple: `False`, example: `\"forward\"`, choices: ``forward`, `reverse``. ",
          "enum": [
            "forward",
            "reverse"
          ]
        }
      }
    },
    "output format options": {
      "title": "Output 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 BAM\n**Applications:** Converting alignment data to interval format\n**Default:** false (maintain input format)\n",
          "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ",
          "default": false
        },
        "uncompressed_bam": {
          "type": "boolean",
          "description": "Write uncompressed BAM output.\n\n**Usage:** Only applicable when input is BAM format\n**Effect:** Output BAM file without compression\n**Trade-off:** Faster writing but larger file size\n**Default:** false (compressed BAM output)\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 from input file\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 processing\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\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/sampling options"
    },
    {
      "$ref": "#/$defs/strand options"
    },
    {
      "$ref": "#/$defs/output format options"
    },
    {
      "$ref": "#/$defs/performance options"
    },
    {
      "$ref": "#/$defs/nextflow input-output arguments"
    }
  ]
}
