{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "sgdemux",
  "description": "Demultiplex sequence data generated on Singular Genomics' sequencing instruments.\n",
  "type": "object",
  "$defs": {
    "arguments": {
      "title": "Arguments",
      "type": "object",
      "description": "No description",
      "properties": {
        "read_structures": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Read structures, one per input FASTQ",
          "help_text": "Type: `string`, multiple: `True`. "
        },
        "allowed_mismatches": {
          "type": "integer",
          "description": "Number of allowed mismatches between the observed barcode and the expected barcode",
          "help_text": "Type: `integer`, multiple: `False`, example: `1`. "
        },
        "min_delta": {
          "type": "integer",
          "description": "The minimum allowed difference between an observed barcode and the second closest expected barcode",
          "help_text": "Type: `integer`, multiple: `False`, example: `2`. "
        },
        "free_ns": {
          "type": "integer",
          "description": "Number of N's to allow in a barcode without counting against the allowed_mismatches",
          "help_text": "Type: `integer`, multiple: `False`, example: `1`. "
        },
        "max_no_calls": {
          "type": "integer",
          "description": "Max no-calls (N's) in a barcode before it is considered unmatchable.\nA barcode with total N's greater than 'max_no_call' will be considered unmatchable.\n",
          "help_text": "Type: `integer`, multiple: `False`. "
        },
        "quality_mask_threshold": {
          "type": "array",
          "items": {
            "type": "integer"
          },
          "description": "Mask template bases with quality scores less than specified value(s).\nSample barcode/index and UMI bases are never masked",
          "help_text": "Type: `integer`, multiple: `True`. "
        },
        "filter_control_reads": {
          "type": "boolean",
          "description": "Filter out control reads",
          "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ",
          "default": false
        },
        "filter_failing_quality": {
          "type": "boolean",
          "description": "Filter reads failing quality filter\n",
          "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ",
          "default": false
        },
        "output_types": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The types of output FASTQs to write.\nFor each read structure, all segment types listed will be output to a FASTQ file.\n\nThese may be any of the following:\n - `T` - Template bases\n - `B` - Sample barcode bases\n - `M` - Molecular barcode bases\n - `S` - Skip bases\n",
          "help_text": "Type: `string`, multiple: `True`, example: `[\"T\"]`, choices: ``T`, `B`, `S`, `M``. "
        },
        "undetermined_sample_name": {
          "type": "string",
          "description": "The sample name for undetermined reads (reads that do not match an expected barcode)\n",
          "help_text": "Type: `string`, multiple: `False`, example: `\"Undetermined\"`. "
        },
        "most_unmatched_to_output": {
          "type": "integer",
          "description": "Output the most frequent \"unmatched\" barcodes up to this number.\nIf set to 0 unmatched barcodes will not be collected, improving overall performance.\n",
          "help_text": "Type: `integer`, multiple: `False`, example: `1000`. "
        },
        "override_matcher": {
          "type": "string",
          "description": "If the sample barcodes are > 12 bp long, a cached hamming distance matcher is used.\nIf the barcodes are less than or equal to 12 bp long, all possible matches are precomputed.\nThis option allows for overriding that heuristic.\n",
          "help_text": "Type: `string`, multiple: `False`, choices: ``cached-hamming-distance`, `pre-compute``. ",
          "enum": [
            "cached-hamming-distance",
            "pre-compute"
          ]
        },
        "skip_read_name_check": {
          "type": "boolean",
          "description": "If this is true, then all the read names across FASTQs will not be enforced to be the same.\nThis may be useful when the read names are known to be the same and performance matters.\nRegardless, the first read name in each FASTQ will always be checked.\n",
          "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ",
          "default": false
        },
        "sample_barcode_in_fastq_header": {
          "type": "boolean",
          "description": "If this is true, then the sample barcode is expected to be in the FASTQ read header.\nFor dual indexed data, the barcodes must be `+` (plus) delimited",
          "help_text": "Type: `boolean_true`, multiple: `False`, default: `false`. ",
          "default": false
        },
        "metric_prefix": {
          "type": "string",
          "description": "Prepend this prefix to all output metric file names\n",
          "help_text": "Type: `string`, multiple: `False`. "
        },
        "lane": {
          "type": "array",
          "items": {
            "type": "integer"
          },
          "description": "Select a subset of lanes to demultiplex",
          "help_text": "Type: `integer`, multiple: `True`. "
        }
      }
    },
    "input": {
      "title": "Input",
      "type": "object",
      "description": "No description",
      "properties": {
        "fastqs": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "format": "path",
          "exists": true,
          "description": "Path to the input FASTQs, or path prefix if not a file",
          "help_text": "Type: `file`, multiple: `True`, required, direction: `input`, example: `[\"sample1_r1.fq;sample1_r2.fq;sample2_r1.fq;sample2_r2.fq\"]`. "
        },
        "sample_metadata": {
          "type": "string",
          "format": "path",
          "exists": true,
          "description": "Path to the sample metadata CSV file including sample names and barcode sequences",
          "help_text": "Type: `file`, multiple: `False`, required, direction: `input`. "
        }
      }
    },
    "output": {
      "title": "Output",
      "type": "object",
      "description": "No description",
      "properties": {
        "sample_fastq": {
          "type": "string",
          "format": "path",
          "description": "The directory containing demultiplexed sample FASTQ files.",
          "help_text": "Type: `file`, multiple: `False`, required, default: `\"$id.$key.sample_fastq\"`, direction: `output`, example: `\"output\"`. ",
          "default": "$id.$key.sample_fastq"
        },
        "metrics": {
          "type": "string",
          "format": "path",
          "description": "Demultiplexing summary statisitcs:\n  - control_reads_omitted: The number of reads that were omitted for being control reads.\n  - failing_reads_omitted: The number of reads that were omitted for having failed QC.\n  - total_templates: The total number of template reads that were output.\n",
          "help_text": "Type: `file`, multiple: `False`, default: `\"$id.$key.metrics.tsv\"`, direction: `output`, example: `\"metrics.tsv\"`. ",
          "default": "$id.$key.metrics.tsv"
        },
        "most_frequent_unmatched": {
          "type": "string",
          "format": "path",
          "description": "It contains the (approximate) counts of the most prevelant observed barcode sequences\nthat did not match to one of the expected barcodes",
          "help_text": "Type: `file`, multiple: `False`, default: `\"$id.$key.most_frequent_unmatched.tsv\"`, direction: `output`, example: `\"most_frequent_unmatched.tsv\"`. ",
          "default": "$id.$key.most_frequent_unmatched.tsv"
        },
        "sample_barcode_hop_metrics": {
          "type": "string",
          "format": "path",
          "description": "File containing the frequently observed barcodes that are unexpected\ncombinations of expected barcodes in a dual-indexed run.\n",
          "help_text": "Type: `file`, multiple: `False`, default: `\"$id.$key.sample_barcode_hop_metrics.tsv\"`, direction: `output`, example: `\"sample_barcode_hop_metrics.tsv\"`. ",
          "default": "$id.$key.sample_barcode_hop_metrics.tsv"
        },
        "per_project_metrics": {
          "type": "string",
          "format": "path",
          "description": "Aggregates the metrics by project (aggregates the metrics across samples with the same project) and\nhas the same columns as `--metrics`",
          "help_text": "Type: `file`, multiple: `False`, default: `\"$id.$key.per_project_metrics.tsv\"`, direction: `output`, example: `\"per_project_metrics.tsv\"`. ",
          "default": "$id.$key.per_project_metrics.tsv"
        },
        "per_sample_metrics": {
          "type": "string",
          "format": "path",
          "description": "Tab-separated file containing statistics per sample.\n",
          "help_text": "Type: `file`, multiple: `False`, default: `\"$id.$key.per_sample_metrics.tsv\"`, direction: `output`, example: `\"per_sample_metrics.tsv\"`. ",
          "default": "$id.$key.per_sample_metrics.tsv"
        }
      }
    },
    "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/arguments"
    },
    {
      "$ref": "#/$defs/input"
    },
    {
      "$ref": "#/$defs/output"
    },
    {
      "$ref": "#/$defs/nextflow input-output arguments"
    }
  ]
}
