{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "id": "https://MikkelSchubert.github.io/adapterremoval/schemas/3.0.0-alpha3.json",
    "title": "AdapterRemoval",
    "description": "Summary statistics generated by AdapterRemoval",
    "type": "object",
    "additionalProperties": false,
    "properties": {
        "$schema": {
            "description": "The location of this schema",
            "$ref": "#/definitions/non-empty-string"
        },
        "meta": {
            "description": "Meta-data about the AdapterRemoval run that produced this JSON file",
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "command": {
                    "description": "The command-line (arguments) used to run AdapterRemoval",
                    "$ref": "#/definitions/non-empty-array-of-strings"
                },
                "runtime": {
                    "description": "Runtime in seconds",
                    "$ref": "#/definitions/non-negative-number"
                },
                "version": {
                    "description": "The version of AdapterRemoved used to create this report",
                    "$ref": "#/definitions/non-empty-string"
                },
                "timestamp": {
                    "description": "Timestamp indicating when the program execution started",
                    "$ref": "#/definitions/non-empty-string"
                }
            },
            "required": [
                "command",
                "runtime",
                "version"
            ]
        },
        "summary": {
            "description": "Summary statistics of input and output",
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "input": {
                    "description": "High-level summary statistics for input reads",
                    "$ref": "#/definitions/basic-summary"
                },
                "output": {
                    "description": "High-level summary statistics for output that passed filtering",
                    "$ref": "#/definitions/optional-basic-summary"
                }
            },
            "required": [
                "input",
                "output"
            ]
        },
        "input": {
            "description": "Detailed input file statistics",
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "read1": {
                    "description": "Detailed sequence statistics for input mate 1 reads",
                    "$ref": "#/definitions/detailed-sequence-statistics"
                },
                "read2": {
                    "description": "Detailed sequence statistics for input mate 2 reads, if running in paired-end mode",
                    "$ref": "#/definitions/optional-detailed-sequence-statistics"
                }
            },
            "required": [
                "read1",
                "read2"
            ]
        },
        "demultiplexing": {
            "description": "Detailed per-sample input/output file statistics",
            "oneOf": [
                {
                    "type": "null"
                },
                {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                        "assigned_reads": {
                            "description": "The number of reads that could unambiguously be assigned to a sample",
                            "$ref": "#/definitions/count"
                        },
                        "ambiguous_reads": {
                            "description": "The number of reads that could be assigned to multiple samples based on mismatch settings",
                            "$ref": "#/definitions/count"
                        },
                        "unassigned_reads": {
                            "description": "The number of reads that could not be assigned to a sample",
                            "$ref": "#/definitions/count"
                        },
                        "samples": {
                            "description": "Detailed statistics per demultiplexing sample",
                            "type": "object",
                            "additionalProperties": {
                                "description": "Demultiplexed sample",
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                    "barcodes": {
                                        "type": "array",
                                        "description": "The barcode pair(s) used to identify this sample",
                                        "minItems": 1,
                                        "items": {
                                            "$ref": "#/definitions/barcode-pair"
                                        }
                                    },
                                    "output": {
                                        "description": "Detailed statistics for each output file for a given sample",
                                        "type": "object",
                                        "additionalProperties": false,
                                        "properties": {
                                            "read1": {
                                                "description": "Detailed sequence statistics for mate 1 reads",
                                                "$ref": "#/definitions/detailed-sequence-statistics"
                                            },
                                            "read2": {
                                                "description": "Detailed sequence statistics for mate 2 reads, if running in paired-end mode",
                                                "$ref": "#/definitions/optional-detailed-sequence-statistics"
                                            },
                                            "merged": {
                                                "description": "Detailed sequence statistics for merged reads, if running in paired-end mode and merging is enabled",
                                                "$ref": "#/definitions/optional-detailed-sequence-statistics"
                                            },
                                            "singleton": {
                                                "description": "Detailed sequence statistics for paired reads where one mate was discarded",
                                                "$ref": "#/definitions/optional-detailed-sequence-statistics"
                                            },
                                            "discarded": {
                                                "description": "Detailed sequence statistics for discarded reads",
                                                "$ref": "#/definitions/optional-detailed-sequence-statistics"
                                            }
                                        },
                                        "required": [
                                            "discarded",
                                            "merged",
                                            "read1",
                                            "read2",
                                            "singleton"
                                        ]
                                    }
                                },
                                "required": [
                                    "barcodes",
                                    "output"
                                ]
                            }
                        }
                    },
                    "required": [
                        "ambiguous_reads",
                        "unassigned_reads",
                        "samples"
                    ]
                }
            ]
        },
        "processing": {
            "description": "Optional adapter and quality trimming statistics",
            "$ref": "#/definitions/optional-processing-statistics"
        },
        "analyses": {
            "description": "Analyses of input data",
            "$ref": "#/definitions/analyses-statistics"
        },
        "output": {
            "description": "Detailed output file statistics",
            "oneOf": [
                {
                    "type": "null"
                },
                {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                        "read1": {
                            "description": "Detailed sequence statistics for mate 1 reads",
                            "$ref": "#/definitions/detailed-sequence-statistics"
                        },
                        "read2": {
                            "description": "Detailed sequence statistics for mate 2 reads, if running in paired-end mode",
                            "$ref": "#/definitions/optional-detailed-sequence-statistics"
                        },
                        "merged": {
                            "description": "Detailed sequence statistics for merged reads, if running in paired-end mode and merging is enabled",
                            "$ref": "#/definitions/optional-detailed-sequence-statistics"
                        },
                        "unidentified1": {
                            "description": "Detailed sequence statistics for mate 1 reads that could not be mapped to a sample, if demultiplexing is enabled",
                            "$ref": "#/definitions/optional-detailed-sequence-statistics"
                        },
                        "unidentified2": {
                            "description": "Detailed sequence statistics for mate 2 reads that could not be mapped to a sample, if running in paired-end mode and demultiplexing is enabled",
                            "$ref": "#/definitions/optional-detailed-sequence-statistics"
                        },
                        "singleton": {
                            "description": "Detailed sequence statistics for paired reads where one mate was discarded",
                            "$ref": "#/definitions/optional-detailed-sequence-statistics"
                        },
                        "discarded": {
                            "description": "Detailed sequence statistics for discarded reads",
                            "$ref": "#/definitions/optional-detailed-sequence-statistics"
                        }
                    },
                    "required": [
                        "read1",
                        "read2",
                        "merged",
                        "unidentified1",
                        "unidentified2",
                        "singleton",
                        "discarded"
                    ]
                }
            ]
        }
    },
    "definitions": {
        "unit-interval": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
        },
        "optional-unit-interval": {
            "oneOf": [
                {
                    "type": "null"
                },
                {
                    "$ref": "#/definitions/unit-interval"
                }
            ]
        },
        "array-of-unit-intervals": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/unit-interval"
            }
        },
        "count": {
            "type": "integer",
            "minimum": 0
        },
        "optional-count": {
            "oneOf": [
                {
                    "type": "null"
                },
                {
                    "$ref": "#/definitions/count"
                }
            ]
        },
        "array-of-counts": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/count"
            }
        },
        "optional-array-of-counts": {
            "oneOf": [
                {
                    "type": "null"
                },
                {
                    "$ref": "#/definitions/array-of-counts"
                }
            ]
        },
        "non-negative-number": {
            "type": "number",
            "minimum": 0
        },
        "optional-non-negative-number": {
            "oneOf": [
                {
                    "type": "null"
                },
                {
                    "$ref": "#/definitions/non-negative-number"
                }
            ]
        },
        "array-of-non-negative-numbers": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/non-negative-number"
            }
        },
        "optional-array-of-non-negative-numbers": {
            "oneOf": [
                {
                    "type": "null"
                },
                {
                    "$ref": "#/definitions/array-of-non-negative-numbers"
                }
            ]
        },
        "average-phred-score": {
            "type": "number",
            "minimum": 0,
            "maximum": 126
        },
        "optional-average-phred-score": {
            "oneOf": [
                {
                    "type": "null"
                },
                {
                    "$ref": "#/definitions/average-phred-score"
                }
            ]
        },
        "array-of-optional-average-phred-scores": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/optional-average-phred-score"
            }
        },
        "non-empty-string": {
            "type": "string",
            "minLength": 1
        },
        "array-of-non-empty-strings": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/non-empty-string"
            }
        },
        "optional-array-of-non-empty-strings": {
            "oneOf": [
                {
                    "type": "null"
                },
                {
                    "$ref": "#/definitions/array-of-non-empty-strings"
                }
            ]
        },
        "non-empty-array-of-non-empty-strings": {
            "$ref": "#/definitions/array-of-non-empty-strings",
            "minItems": 1
        },
        "non-empty-array-of-strings": {
            "type": "array",
            "items": {
                "type": "string"
            },
            "minItems": 1
        },
        "basic-summary": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "reads": {
                    "description": "Total number of input reads, including both mate 1 and mate 2 reads",
                    "$ref": "#/definitions/count"
                },
                "bases": {
                    "description": "Total number of input bases, summed across mate 1 and mate 2 reads",
                    "$ref": "#/definitions/count"
                },
                "mean_length": {
                    "description": "Mean length of input reads",
                    "$ref": "#/definitions/optional-non-negative-number"
                },
                "reads_sampled": {
                    "description": "Number of input reads sampled based on --report-sample-rate",
                    "$ref": "#/definitions/count"
                },
                "q20_rate": {
                    "description": "Fraction of bases with a Phred quality score of at least 20",
                    "$ref": "#/definitions/optional-unit-interval"
                },
                "q30_rate": {
                    "description": "Fraction of bases with a Phred quality score of at least 30",
                    "$ref": "#/definitions/optional-unit-interval"
                },
                "uncalled_rate": {
                    "description": "Fraction of bases called as 'N' in the input reads",
                    "$ref": "#/definitions/optional-unit-interval"
                },
                "gc_content": {
                    "description": "Mean GC content in the input reads",
                    "$ref": "#/definitions/optional-unit-interval"
                }
            },
            "required": [
                "reads",
                "bases",
                "mean_length",
                "reads_sampled",
                "q20_rate",
                "q30_rate",
                "uncalled_rate",
                "gc_content"
            ]
        },
        "optional-basic-summary": {
            "oneOf": [
                {
                    "type": "null"
                },
                {
                    "$ref": "#/definitions/basic-summary"
                }
            ]
        },
        "processing-statistics": {
            "type": "array",
            "additionalItems": false,
            "items": {
                "oneOf": [
                    {
                        "$ref": "#/definitions/processing-step-statistics"
                    },
                    {
                        "$ref": "#/definitions/processing-step-statistics-adapters"
                    },
                    {
                        "$ref": "#/definitions/processing-step-statistics-poly-x"
                    },
                    {
                        "$ref": "#/definitions/processing-step-statistics-merging"
                    }
                ]
            }
        },
        "optional-processing-statistics": {
            "oneOf": [
                {
                    "type": "null"
                },
                {
                    "$ref": "#/definitions/processing-statistics"
                }
            ]
        },
        "analyses-statistics": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "duplication": {
                    "$ref": "#/definitions/optional-duplication-statistics"
                },
                "insert_sizes": {
                    "$ref": "#/definitions/optional-array-of-counts"
                },
                "consensus_adapters": {
                    "$ref": "#/definitions/optional-consensus-adapters-statistics"
                }
            },
            "required": [
                "duplication",
                "insert_sizes",
                "consensus_adapters"
            ]
        },
        "detailed-sequence-statistics": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "filenames": {
                    "description": "List of input files read from/output files written to",
                    "$ref": "#/definitions/optional-array-of-non-empty-strings"
                },
                "input_reads": {
                    "description": "The number reads that went into producing the output, merged reads are counted as two reads",
                    "$ref": "#/definitions/count"
                },
                "output_reads": {
                    "description": "The number of reads output; merged reads are counted as one read",
                    "$ref": "#/definitions/count"
                },
                "reads_sampled": {
                    "description": "The number of reads sampled for detailed statistics; see --report-sample-rate",
                    "$ref": "#/definitions/count"
                },
                "lengths": {
                    "description": "Length distribution of reads written to output",
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/count"
                    }
                },
                "quality_curves": {
                    "description": "Per nucleotide and mean quality scores by position",
                    "$ref": "#/definitions/optional-sequence-quality-statistics"
                },
                "content_curves": {
                    "description": "Nucleotide composition of the sequences",
                    "$ref": "#/definitions/optional-nucleotide-content-statistics"
                },
                "quality_scores": {
                    "description": "Phred score distribution of reads written to output",
                    "$ref": "#/definitions/optional-array-of-counts"
                },
                "gc_content": {
                    "description": "Smoothed distribution of GC content per read",
                    "$ref": "#/definitions/optional-array-of-non-negative-numbers"
                },
                "duplication": {
                    "description": "Duplication estimates performed using the FastQC algorithm",
                    "$ref": "#/definitions/optional-duplication-statistics"
                }
            },
            "required": [
                "filenames",
                "input_reads",
                "output_reads",
                "reads_sampled",
                "lengths",
                "quality_curves",
                "content_curves",
                "quality_scores",
                "gc_content"
            ]
        },
        "optional-detailed-sequence-statistics": {
            "oneOf": [
                {
                    "type": "null"
                },
                {
                    "$ref": "#/definitions/detailed-sequence-statistics"
                }
            ]
        },
        "nucleotide-content-statistics": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "a": {
                    "description": "The fraction of adenine by position",
                    "$ref": "#/definitions/array-of-unit-intervals"
                },
                "c": {
                    "description": "The fraction of cytosine by position",
                    "$ref": "#/definitions/array-of-unit-intervals"
                },
                "g": {
                    "description": "The fraction of guanine by position",
                    "$ref": "#/definitions/array-of-unit-intervals"
                },
                "t": {
                    "description": "The fraction of thymine by position",
                    "$ref": "#/definitions/array-of-unit-intervals"
                },
                "n": {
                    "description": "The fraction of uncalled nucleotides by position",
                    "$ref": "#/definitions/array-of-unit-intervals"
                }
            },
            "required": [
                "a",
                "c",
                "g",
                "t",
                "n"
            ]
        },
        "optional-nucleotide-content-statistics": {
            "oneOf": [
                {
                    "type": "null"
                },
                {
                    "$ref": "#/definitions/nucleotide-content-statistics"
                }
            ]
        },
        "sequence-quality-statistics": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "a": {
                    "description": "Mean Phred quality-score by position for adenine",
                    "$ref": "#/definitions/array-of-optional-average-phred-scores"
                },
                "c": {
                    "description": "Mean Phred quality-score by position for cytosine",
                    "$ref": "#/definitions/array-of-optional-average-phred-scores"
                },
                "g": {
                    "description": "Mean Phred quality-score by position for guanine",
                    "$ref": "#/definitions/array-of-optional-average-phred-scores"
                },
                "t": {
                    "description": "Mean Phred quality-score by position for thymine",
                    "$ref": "#/definitions/array-of-optional-average-phred-scores"
                },
                "mean": {
                    "description": "Mean Phred quality-score by position",
                    "$ref": "#/definitions/array-of-optional-average-phred-scores"
                }
            },
            "required": [
                "a",
                "c",
                "g",
                "t",
                "mean"
            ]
        },
        "optional-sequence-quality-statistics": {
            "oneOf": [
                {
                    "type": "null"
                },
                {
                    "$ref": "#/definitions/sequence-quality-statistics"
                }
            ]
        },
        "processing-step-statistics": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "step": {
                    "description": "The name of the processing step",
                    "$ref": "#/definitions/non-empty-string"
                },
                "action": {
                    "description": "The action performed by the step",
                    "enum": [
                        "filter",
                        "trim"
                    ]
                },
                "reads": {
                    "description": "Number of reads modified by the processing step",
                    "$ref": "#/definitions/count"
                },
                "bases": {
                    "description": "Number of bases modified by the processing step",
                    "$ref": "#/definitions/count"
                }
            },
            "required": [
                "step",
                "action",
                "reads",
                "bases"
            ]
        },
        "adapter-list": {
            "type": "array",
            "items": {
                "type": "object",
                "additionalProperties": false,
                "description": "Per adapter (pair) statistics",
                "properties": {
                    "adapter1": {
                        "type": "string"
                    },
                    "adapter2": {
                        "type": "string"
                    },
                    "reads": {
                        "description": "Number of reads modified by the processing step",
                        "$ref": "#/definitions/count"
                    },
                    "bases": {
                        "description": "Number of bases modified by the processing step",
                        "$ref": "#/definitions/count"
                    }
                },
                "required": [
                    "reads",
                    "bases",
                    "adapter1",
                    "adapter2"
                ]
            }
        },
        "processing-step-statistics-adapters": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "step": {
                    "description": "The name of the processing step",
                    "const": "adapters"
                },
                "action": {
                    "description": "The action performed by the step",
                    "const": "trim"
                },
                "reads": {
                    "description": "Number of reads modified by the processing step",
                    "$ref": "#/definitions/count"
                },
                "bases": {
                    "description": "Number of bases modified by the processing step",
                    "$ref": "#/definitions/count"
                },
                "adapter_list": {
                    "$ref": "#/definitions/adapter-list"
                }
            },
            "required": [
                "step",
                "action",
                "reads",
                "bases",
                "adapter_list"
            ]
        },
        "processing-step-statistics-poly-x-counts": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "reads": {
                    "description": "Number of reads modified by the processing step",
                    "$ref": "#/definitions/count"
                },
                "bases": {
                    "description": "Number of bases modified by the processing step",
                    "$ref": "#/definitions/count"
                }
            },
            "required": [
                "reads",
                "bases"
            ]
        },
        "processing-step-statistics-poly-x": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "step": {
                    "description": "The name of the processing step",
                    "enum": [
                        "poly_x_pre",
                        "poly_x_post"
                    ]
                },
                "action": {
                    "description": "The action performed by the step",
                    "const": "trim"
                },
                "reads": {
                    "description": "Number of reads modified by the processing step",
                    "$ref": "#/definitions/count"
                },
                "bases": {
                    "description": "Number of bases modified by the processing step",
                    "$ref": "#/definitions/count"
                },
                "x": {
                    "type": "object",
                    "additionalProperties": false,
                    "minProperties": 1,
                    "properties": {
                        "a": {
                            "$ref": "#/definitions/processing-step-statistics-poly-x-counts"
                        },
                        "c": {
                            "$ref": "#/definitions/processing-step-statistics-poly-x-counts"
                        },
                        "g": {
                            "$ref": "#/definitions/processing-step-statistics-poly-x-counts"
                        },
                        "t": {
                            "$ref": "#/definitions/processing-step-statistics-poly-x-counts"
                        }
                    }
                }
            },
            "required": [
                "step",
                "action",
                "reads",
                "bases",
                "x"
            ]
        },
        "processing-step-statistics-merging": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "step": {
                    "description": "The name of the processing step",
                    "$ref": "#/definitions/non-empty-string"
                },
                "action": {
                    "description": "The action performed by the step",
                    "const": "merge"
                },
                "reads": {
                    "description": "Number of reads modified by the processing step",
                    "$ref": "#/definitions/count"
                },
                "bases": {
                    "description": "Number of bases modified by the processing step",
                    "$ref": "#/definitions/count"
                },
                "corrected": {
                    "description": "Number of mismatches where a higher-quality base was picked",
                    "$ref": "#/definitions/count"
                },
                "masked": {
                    "description": "Number of unresolvable mismatches where an 'N' was assigned",
                    "$ref": "#/definitions/count"
                },
                "unmasked": {
                    "description": "Number of 'N's that could be replaced by a base",
                    "$ref": "#/definitions/count"
                }
            },
            "required": [
                "step",
                "action",
                "reads",
                "bases",
                "corrected",
                "masked",
                "unmasked"
            ]
        },
        "duplication-statistics": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "labels": {
                    "description": "X-axis labels indicating the number of copies of a read (binned)",
                    "$ref": "#/definitions/non-empty-array-of-non-empty-strings"
                },
                "unique_sequences": {
                    "description": "The distribution of unique sequences by bin",
                    "$ref": "#/definitions/array-of-unit-intervals"
                },
                "total_sequences": {
                    "description": "The distribution of sequences by bin",
                    "$ref": "#/definitions/array-of-unit-intervals"
                },
                "unique_frac": {
                    "description": "The fraction of sequences that are unique (having zero duplicates)",
                    "$ref": "#/definitions/unit-interval"
                }
            }
        },
        "optional-duplication-statistics": {
            "oneOf": [
                {
                    "type": "null"
                },
                {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                        "read1": {
                            "$ref": "#/definitions/duplication-statistics"
                        },
                        "read2": {
                            "oneOf": [
                                {
                                    "type": "null"
                                },
                                {
                                    "$ref": "#/definitions/duplication-statistics"
                                }
                            ]
                        }
                    },
                    "required": [
                        "read1",
                        "read2"
                    ]
                }
            ]
        },
        "consensus-adapter-statistics": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "consensus": {
                    "description": "Consensus adapter sequences",
                    "type": "string"
                },
                "qualities": {
                    "description": "Phred encoded error rate for consensus adapter sequence",
                    "type": "string"
                },
                "kmers": {
                    "type": "object",
                    "additionalProperties": false,
                    "patternProperties": {
                        "[ACGT]{9}": {
                            "$ref": "#/definitions/count"
                        }
                    }
                }
            },
            "required": [
                "consensus",
                "qualities",
                "kmers"
            ]
        },
        "optional-consensus-adapters-statistics": {
            "oneOf": [
                {
                    "type": "null"
                },
                {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                        "aligned_pairs": {
                            "description": "Number of properly aligned reads",
                            "$ref": "#/definitions/count"
                        },
                        "pairs_with_adapters": {
                            "description": "Number of reads with adapter fragments",
                            "$ref": "#/definitions/count"
                        },
                        "read1": {
                            "$ref": "#/definitions/consensus-adapter-statistics"
                        },
                        "read2": {
                            "$ref": "#/definitions/consensus-adapter-statistics"
                        }
                    },
                    "required": [
                        "aligned_pairs",
                        "pairs_with_adapters",
                        "read1",
                        "read2"
                    ]
                }
            ]
        },
        "barcode-orientation": {
            "oneOf": [
                {
                    "type": "null"
                },
                {
                    "enum": [
                        "forward",
                        "reverse"
                    ]
                }
            ]
        },
        "barcode-pair": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "barcode1": {
                    "$ref": "#/definitions/non-empty-string"
                },
                "barcode2": {
                    "type": "string"
                },
                "orientation": {
                    "$ref": "#/definitions/barcode-orientation"
                },
                "reads": {
                    "description": "The number of reads identified containing these barcodes",
                    "$ref": "#/definitions/count"
                }
            },
            "required": [
                "barcode1",
                "barcode2",
                "orientation",
                "reads"
            ]
        }
    }
}