{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "https://raw.githubusercontent.com/nf-core/sarek/master/assets/schema_input.json",
    "title": "nf-core/sarek pipeline - params.input schema",
    "description": "Schema for the file provided with params.input",
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "patient": {
                "type": "string",
                "pattern": "^\\S+$",
                "errorMessage": "Patient ID must be provided and cannot contain spaces",
                "meta": ["patient"]
            },
            "sample": {
                "type": "string",
                "pattern": "^\\S+$",
                "errorMessage": "Sample ID must be provided and cannot contain spaces",
                "meta": ["sample"]
            },
            "sex": {
                "errorMessage": "Sex cannot contain spaces",
                "meta": ["sex"],
                "default": "NA",
                "anyOf": [
                    {
                        "type": "string",
                        "pattern": "^\\S+$"
                    },
                    {
                        "type": "string",
                        "maxLength": 0
                    }
                ]
            },
            "status": {
                "type": "integer",
                "errorMessage": "Status can only be 0 (normal) or 1 (tumor). Defaults to 0, if none is supplied.",
                "meta": ["status"],
                "default": "0",
                "minimum": 0,
                "maximum": 1
            },
            "lane": {
                "type": "string",
                "pattern": "^\\S+$",
                "unique": ["patient", "sample"],
                "anyOf": [
                    {
                        "dependentRequired": ["bam"]
                    },
                    {
                        "dependentRequired": ["fastq_1"]
                    },
                    {
                        "dependentRequired": ["spring_1"]
                    }
                ],
                "meta": ["lane"]
            },
            "fastq_1": {
                "errorMessage": "Gzipped FastQ file for reads 1 cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'",
                "anyOf": [
                    {
                        "type": "string",
                        "pattern": "^\\S+\\.f(ast)?q\\.gz$"
                    },
                    {
                        "type": "string",
                        "maxLength": 0
                    }
                ],
                "format": "file-path",
                "exists": true
            },
            "fastq_2": {
                "errorMessage": "Gzipped FastQ file for reads 2 cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'",
                "dependentRequired": ["fastq_1"],
                "anyOf": [
                    {
                        "type": "string",
                        "pattern": "^\\S+\\.f(ast)?q\\.gz$"
                    },
                    {
                        "type": "string",
                        "maxLength": 0
                    }
                ],
                "format": "file-path",
                "exists": true
            },
            "spring_1": {
                "errorMessage": "Gzipped and spring-compressed FastQ file for reads 1 cannot contain spaces and must have extension '.fq.gz.spring' or '.fastq.gz.spring'",
                "anyOf": [
                    {
                        "type": "string",
                        "pattern": "^\\S+\\.f(ast)?q\\.gz.spring$"
                    },
                    {
                        "type": "string",
                        "maxLength": 0
                    }
                ],
                "format": "file-path",
                "exists": true
            },
            "spring_2": {
                "errorMessage": "Gzipped and spring-compressed FastQ file for reads 2 cannot contain spaces and must have extension '.fq.gz.spring' or '.fastq.gz.spring'",
                "dependentRequired": ["spring_1"],
                "anyOf": [
                    {
                        "type": "string",
                        "pattern": "^\\S+\\.f(ast)?q\\.gz.spring$"
                    },
                    {
                        "type": "string",
                        "maxLength": 0
                    }
                ],
                "format": "file-path",
                "exists": true
            },
            "table": {
                "errorMessage": "Recalibration table cannot contain spaces and must have extension '.table'",
                "anyOf": [
                    {
                        "type": "string",
                        "pattern": "^\\S+\\.table$"
                    },
                    {
                        "type": "string",
                        "maxLength": 0
                    }
                ],
                "format": "file-path",
                "exists": true
            },
            "cram": {
                "errorMessage": "CRAM file cannot contain spaces and must have extension '.cram'",
                "anyOf": [
                    {
                        "type": "string",
                        "pattern": "^\\S+\\.cram$"
                    },
                    {
                        "type": "string",
                        "maxLength": 0
                    }
                ],
                "format": "file-path",
                "exists": true
            },
            "crai": {
                "errorMessage": "CRAM index file cannot contain spaces and must have extension '.crai'",
                "anyOf": [
                    {
                        "type": "string",
                        "pattern": "^\\S+\\.crai$"
                    },
                    {
                        "type": "string",
                        "maxLength": 0
                    }
                ],
                "format": "file-path",
                "exists": true
            },
            "bam": {
                "errorMessage": "BAM file cannot contain spaces and must have extension '.bam'",
                "anyOf": [
                    {
                        "type": "string",
                        "pattern": "^\\S+\\.bam$"
                    },
                    {
                        "type": "string",
                        "maxLength": 0
                    }
                ],
                "format": "file-path",
                "exists": true
            },
            "bai": {
                "errorMessage": "BAM index file cannot contain spaces and must have extension '.bai'",
                "anyOf": [
                    {
                        "type": "string",
                        "pattern": "^\\S+\\.bai$"
                    },
                    {
                        "type": "string",
                        "maxLength": 0
                    }
                ],
                "format": "file-path",
                "exists": true
            },
            "vcf": {
                "errorMessage": "VCF file for reads 1 cannot contain spaces and must have extension '.vcf' or '.vcf.gz'",
                "anyOf": [
                    {
                        "type": "string",
                        "pattern": "^\\S+\\.vcf(\\.gz)?$"
                    },
                    {
                        "type": "string",
                        "maxLength": 0
                    }
                ],
                "format": "file-path",
                "exists": true
            },
            "variantcaller": {
                "type": "string"
            }
        },
        "required": ["patient", "sample"]
    }
}
