{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "bedtools_tag",
  "description": "Annotate BAM alignments with tags based on overlaps with genomic intervals.\n\nbedtools tag reads alignments from a BAM file and annotates them with custom tags \nbased on their overlap with intervals from one or more BED/GFF/VCF files. Each \nalignment that overlaps with an interval receives a tag in the BAM record, making \nthis tool essential for marking reads that overlap with specific genomic features \nlike genes, enhancers, or repetitive elements.\n\nThis tool is commonly used for:\n- Tagging reads that overlap with specific genomic features\n- Annotating alignments with gene names or functional regions\n- Marking reads for downstream filtering based on overlap patterns\n- Quality control by identifying reads in problematic regions\n- Single-cell RNA-seq analysis for feature assignment\n- ChIP-seq analysis for peak annotation and read classification\n",
  "type": "object",
  "$defs": {
    "inputs": {
      "title": "Inputs",
      "type": "object",
      "description": "No description",
      "properties": {
        "input": {
          "type": "string",
          "format": "path",
          "exists": true,
          "description": "Input BAM file to annotate with tags.\n\n**Format:** BAM file with aligned sequencing reads\n**Content:** Alignments that will be tagged based on overlaps\n**Requirements:** Must be a valid BAM file (indexed .bai file recommended)\n**Usage:** Each alignment overlapping with annotation files will receive tags\n**Output:** Tagged BAM file with additional tag fields\n",
          "help_text": "Type: `file`, multiple: `False`, required, direction: `input`, example: `\"alignments.bam\"`. "
        },
        "files": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "format": "path",
          "exists": true,
          "description": "BED/GFF/VCF annotation files for tagging overlapping alignments.\n\n**Format:** BED, GFF, or VCF files with genomic intervals\n**Content:** Genomic features used for alignment annotation\n**Usage:** Alignments overlapping these intervals receive tags\n**Multiple files:** Each file can have its own label for distinction\n**Requirements:** Files should have consistent chromosome naming with BAM\n",
          "help_text": "Type: `file`, multiple: `True`, required, direction: `input`, example: `[\"genes.bed\";\"enhancers.bed\";\"repeats.bed\"]`. "
        },
        "labels": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Labels corresponding to each annotation file.\n\n**Format:** String labels for each annotation file\n**Usage:** Must provide one label per annotation file in --files\n**Content:** These labels will be used as tag values in the BAM output\n**Order:** Must match the order of files in --files parameter\n**Applications:** Distinguish overlaps from different annotation sources\n**Note:** Required unless --use_names, --use_scores, or --use_intervals is specified\n",
          "help_text": "Type: `string`, multiple: `True`, example: `[\"GENE\";\"ENHANCER\";\"REPEAT\"]`. "
        }
      }
    },
    "outputs": {
      "title": "Outputs",
      "type": "object",
      "description": "No description",
      "properties": {
        "output": {
          "type": "string",
          "format": "path",
          "description": "Output BAM file with tagged alignments.\n\n**Format:** BAM file with original alignments plus overlap tags\n**Content:** All original alignment data plus custom tags for overlaps\n**Tags:** Alignments overlapping annotation files receive additional tag fields\n**Preservation:** Non-overlapping alignments remain unchanged\n**Indexing:** Output can be indexed like any standard BAM file\n",
          "help_text": "Type: `file`, multiple: `False`, required, default: `\"$id.$key.output.bam\"`, direction: `output`, example: `\"tagged_alignments.bam\"`. ",
          "default": "$id.$key.output.bam"
        }
      }
    },
    "overlap options": {
      "title": "Overlap Options",
      "type": "object",
      "description": "No description",
      "properties": {
        "min_overlap": {
          "type": "number",
          "description": "Minimum overlap required as a fraction of the alignment.\n\n**Default:** 1E-9 (essentially 1 base pair)\n**Range:** 0.0 to 1.0\n**Usage:** Alignment must overlap at least this fraction of its length\n**Example:** 0.5 requires alignment to overlap 50% of its length with feature\n**Applications:** Filter spurious overlaps, require substantial overlap\n",
          "help_text": "Type: `double`, multiple: `False`, example: `0.1`. "
        }
      }
    },
    "strand options": {
      "title": "Strand Options",
      "type": "object",
      "description": "No description",
      "properties": {
        "same_strand": {
          "type": "boolean",
          "description": "Require overlaps on the same strand.\n\n**Usage:** Only tag alignments that overlap features on the same strand\n**Applications:** Strand-specific RNA-seq analysis, sense transcript tagging\n**Default:** false (overlaps reported without respect to strand)\n**Interaction:** Mutually exclusive with --opposite_strand\n",
          "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ",
          "default": false
        },
        "opposite_strand": {
          "type": "boolean",
          "description": "Require overlaps on the opposite strand.\n\n**Usage:** Only tag alignments that overlap features on the opposite strand\n**Applications:** Antisense transcript detection, strand-specific filtering\n**Default:** false (overlaps reported without respect to strand)\n**Interaction:** Mutually exclusive with --same_strand\n",
          "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ",
          "default": false
        }
      }
    },
    "tag options": {
      "title": "Tag Options",
      "type": "object",
      "description": "No description",
      "properties": {
        "tag_name": {
          "type": "string",
          "description": "Specify the BAM tag name to use for annotations.\n\n**Default:** \"YB\" \n**Format:** Two-character string (standard BAM tag format)\n**Usage:** Custom tag name for storing overlap information\n**Examples:** \"YK\", \"ZZ\", \"XG\"\n**Standards:** Follow BAM tag naming conventions\n",
          "help_text": "Type: `string`, multiple: `False`, example: `\"YK\"`. "
        },
        "use_names": {
          "type": "boolean",
          "description": "Use the name field from annotation files to populate tags.\n\n**Usage:** Instead of labels, use the name column from BED/GFF files\n**Applications:** Gene name tagging, feature-specific annotation\n**Requirements:** Annotation files must have name fields (4th column in BED)\n**Default:** false (uses --labels values instead)\n",
          "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ",
          "default": false
        },
        "use_scores": {
          "type": "boolean",
          "description": "Use the score field from annotation files to populate tags.\n\n**Usage:** Instead of labels, use the score column from annotation files\n**Applications:** Confidence scoring, quantitative tagging\n**Requirements:** Annotation files must have score fields (5th column in BED)\n**Default:** false (uses --labels values instead)\n",
          "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ",
          "default": false
        },
        "use_intervals": {
          "type": "boolean",
          "description": "Use full interval information to populate tags.\n\n**Content:** Include interval coordinates, name, score, and strand in tags\n**Format:** Full genomic interval description as tag value\n**Applications:** Detailed annotation tracking, interval provenance\n**Requirements:** Still requires --labels to identify source files\n**Default:** false (uses --labels values instead)\n",
          "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ",
          "default": false
        }
      }
    },
    "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/overlap options"
    },
    {
      "$ref": "#/$defs/strand options"
    },
    {
      "$ref": "#/$defs/tag options"
    },
    {
      "$ref": "#/$defs/nextflow input-output arguments"
    }
  ]
}
