{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "https://raw.githubusercontent.com/nf-core/pixelator/master/nextflow_schema.json",
    "title": "nf-core/pixelator pipeline parameters",
    "description": "Pipeline for analysis of Molecular Pixelation assays",
    "type": "object",
    "definitions": {
        "input_output_options": {
            "title": "Input/output options",
            "type": "object",
            "fa_icon": "fas fa-terminal",
            "description": "Define where the pipeline should find input data and save output data.",
            "required": ["input", "outdir"],
            "properties": {
                "input": {
                    "type": "string",
                    "format": "file-path",
                    "schema": "assets/schema_input.json",
                    "mimetype": "text/csv",
                    "exists": true,
                    "pattern": "^\\S+\\.(csv|tsv)$",
                    "description": "Path to comma-separated file containing information about the samples in the experiment.",
                    "help_text": "You will need to create a design file with information about the samples in your experiment before running the pipeline. Use this parameter to specify its location. It has to be a comma-separated file with 3 columns, and a header row. See [usage docs](https://nf-co.re/pixelator/usage#samplesheet-input).",
                    "fa_icon": "fas fa-file-csv"
                },
                "input_basedir": {
                    "type": "string",
                    "format": "directory-path",
                    "exists": false,
                    "description": "Path to a local or remote directory that is the \"current working directory\" for relative paths defined in the input samplesheet",
                    "fa_icon": "fas fa-folder"
                },
                "outdir": {
                    "type": "string",
                    "format": "directory-path",
                    "default": "./results",
                    "description": "The output directory where the results will be saved. You have to use absolute paths to storage on Cloud infrastructure.",
                    "fa_icon": "fas fa-folder-open"
                },
                "email": {
                    "type": "string",
                    "description": "Email address for completion summary.",
                    "fa_icon": "fas fa-envelope",
                    "help_text": "Set this parameter to your e-mail address to get a summary e-mail with details of the run sent to you when the workflow exits. If set in your user config file (`~/.nextflow/config`) then you don't need to specify this on the command line for every run.",
                    "pattern": "^([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$"
                }
            }
        },
        "preqc_options": {
            "title": "QC/Filtering/Trimming options",
            "type": "object",
            "fa_icon": "fas fa-terminal",
            "properties": {
                "trim_front": {
                    "fa_icon": "fas backward-step",
                    "type": "integer",
                    "description": "Trim N bases from the front of the reads",
                    "default": 0
                },
                "trim_tail": {
                    "fa_icon": "fas forward-step",
                    "type": "integer",
                    "description": "Trim N bases from the tail of the reads",
                    "default": 0
                },
                "max_length": {
                    "fa_icon": "fas up-right-and-down-left-from-center",
                    "type": "integer",
                    "description": "The maximum length of a read",
                    "help_text": "Reads longer then given length will be trimmed to the given length. If you set this argument it will overrule the value from the chosen design"
                },
                "min_length": {
                    "fa_icon": "fas down-left-and-up-right-to-center",
                    "type": "integer",
                    "description": "The minimum length (bases) of a read",
                    "help_text": "Reads shorter then given length will be discarded. If you set this argument it will overrule the value from the chosen design."
                },
                "max_n_bases": {
                    "fa_icon": "fas n",
                    "description": "The maximum number of Ns allowed in a read",
                    "help_text": "The default value of 0 means any reads with N in it will be filtered out",
                    "type": "integer",
                    "default": 0
                },
                "avg_qual": {
                    "fa_icon": "fas gauge",
                    "description": "Minimum avg. quality a read must have (0 will disable the filter)",
                    "type": "integer",
                    "default": 20
                },
                "dedup": {
                    "fa_icon": "fas clone",
                    "description": "Remove duplicated reads (exact same sequence)",
                    "type": "boolean",
                    "default": false
                },
                "remove_polyg": {
                    "fa_icon": "fas g",
                    "description": "Remove PolyG sequences (length of 10 or more)",
                    "type": "boolean",
                    "default": false
                }
            }
        },
        "adapterqc_options": {
            "title": "Adapter QC Options",
            "properties": {
                "adapterqc_mismatches": {
                    "fa_icon": "fas not-equal",
                    "description": "The number of mismatches allowed (in percentage) [default: 0.1; 0.0<=x<=0.9]",
                    "type": "number",
                    "default": 0.1,
                    "minimum": 0.0,
                    "maximum": 0.9
                }
            }
        },
        "demux_options": {
            "title": "Demux options",
            "properties": {
                "demux_mismatches": {
                    "fa_icon": "fas not-equal",
                    "description": "The number of mismatches allowed (as a fraction)",
                    "type": "number",
                    "default": 0.1,
                    "minimum": 0.0,
                    "maximum": 0.9
                },
                "demux_min_length": {
                    "fa_icon": "fas down-left-and-up-right-to-center",
                    "description": "The minimum length of the barcode that must overlap when matching",
                    "help_text": "If you set this argument it will overrule the value from the chosen design",
                    "type": "integer"
                }
            }
        },
        "collapse_options": {
            "title": "Collapse options",
            "properties": {
                "markers_ignore": {
                    "fa-icon": "fas fa-list",
                    "description": "A list of comma separated antibodies to discard",
                    "type": "string",
                    "pattern": "(\\S+)?(,\\S+)*"
                },
                "algorithm": {
                    "fa_icon": "fas code-fork",
                    "description": "The algorithm to use for collapsing (adjacency will peform error correction using the number of mismatches given)",
                    "default": "adjacency",
                    "enum": ["adjacency", "unique"],
                    "type": "string"
                },
                "max_neighbours": {
                    "fa_icon": "fas circle-nodes",
                    "description": "The maximum number of neighbors to use when searching for similar sequences. This number depends on the sequence depth and the ratio of erroneous molecules expected. A high value can make the algorithm slower. This is only used when algorithm is set to 'adjacency'",
                    "default": 60,
                    "minimum": 1,
                    "maximum": 250,
                    "type": "integer",
                    "hidden": true
                },
                "collapse_mismatches": {
                    "fa_icon": "fas not-equal",
                    "description": "The number of mismatches allowed when collapsing (adjacency)",
                    "type": "integer",
                    "default": 2,
                    "minimum": 0,
                    "maximum": 5
                },
                "collapse_min_count": {
                    "fa_icon": "fas more-than-equal",
                    "description": "Discard molecules with with a count (reads) lower than this value",
                    "default": 2,
                    "minimum": 1,
                    "type": "integer"
                },
                "collapse_use_counts": {
                    "description": "Use counts when collapsing (the difference in counts between two molecules must be more than double in order to be collapsed)",
                    "type": "boolean"
                }
            }
        },
        "graph_options": {
            "title": "Options for pixelator graph command.",
            "properties": {
                "multiplet_recovery": {
                    "description": "Activate the multiplet recovery using leiden community detection",
                    "type": "boolean",
                    "default": true
                },
                "leiden_iterations": {
                    "fa_icon": "fas repeat",
                    "description": "Number of iterations for the leiden algorithm, high values will decrease the variance of the results but increase the runtime [default: 10; 1<=x<=100]",
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 10,
                    "hidden": true
                },
                "graph_min_count": {
                    "fa_icon": "fas less-than-equal",
                    "description": "Discard edges (pixels) with a count (reads) lower than this, use 1 to disable",
                    "type": "integer",
                    "default": 2,
                    "minimum": 1,
                    "maximum": 50,
                    "hidden": true
                }
            }
        },
        "annotate_options": {
            "title": "Options for pixelator annotate command.",
            "properties": {
                "min_size": {
                    "description": "The minimum size (pixels) a component/cell can have (disabled by default)",
                    "type": "integer"
                },
                "max_size": {
                    "description": "The maximum size (pixels) a component/cell can have (disabled by default)",
                    "type": "integer"
                },
                "dynamic_filter": {
                    "description": " Enable the estimation of dynamic size filters using a log-rank approach both: estimate both min and max size, min: estimate min size (--min-size), max: estimate max size (--max-size)",
                    "type": "string",
                    "enum": ["both", "min", "max"],
                    "default": "min"
                },
                "aggregate_calling": {
                    "description": "Enable aggregate calling, information on potential aggregates will be added to the output data",
                    "type": "boolean",
                    "default": true
                }
            }
        },
        "analysis_options": {
            "title": "Options for pixelator analysis command.",
            "properties": {
                "skip_analysis": {
                    "description": "Skip analysis step",
                    "type": "boolean",
                    "default": false
                },
                "compute_polarization": {
                    "description": "Compute polarization scores matrix (clusters by markers)",
                    "type": "boolean",
                    "default": true
                },
                "compute_colocalization": {
                    "description": " Compute colocalization scores (marker by marker) for each component",
                    "type": "boolean",
                    "default": true
                },
                "use_full_bipartite": {
                    "description": "Use the bipartite graph instead of the one-node projection when computing polarization, coabundance and colocalization scores",
                    "type": "boolean",
                    "default": false
                },
                "polarization_normalization": {
                    "description": "Which approach to use to normalize the antibody counts.",
                    "help_text": "- `raw`: use the raw counts.\n- `CLR`: use the CLR-transformed counts.\n- `denoise`: use CLR-transformed counts and subtract the counts of control antibodies",
                    "type": "string",
                    "enum": ["raw", "clr", "denoise"],
                    "default": "clr"
                },
                "polarization_binarization": {
                    "fa_icon": "fas binary",
                    "description": "Transform the antibody counts to 0-1 (binarize) when computing polarization",
                    "type": "boolean",
                    "default": false
                },
                "colocalization_transformation": {
                    "type": "string",
                    "enum": ["raw", "clr", "log1p", "relative"],
                    "default": "log1p",
                    "description": "Select the type of transformation to use on the node by antibody counts matrix when computing colocalization"
                },
                "colocalization_neighbourhood_size": {
                    "type": "integer",
                    "description": "Select the size of the neighborhood to use when computing colocalization metrics on each component",
                    "default": 1,
                    "minimum": 0
                },
                "colocalization_n_permutations": {
                    "type": "integer",
                    "description": "Set the number of permutations use to compute the empirical p-value for the colocalization score",
                    "default": 50,
                    "minimum": 5
                },
                "colocalization_min_region_count": {
                    "type": "integer",
                    "description": "The minimum number of counts in a region for it to be concidered valid for computing colocalization",
                    "default": 5,
                    "minimum": 0
                }
            }
        },
        "report_options": {
            "title": "Options for pixelator report command.",
            "properties": {
                "skip_report": {
                    "description": "Skip report generation",
                    "type": "boolean",
                    "default": false
                }
            }
        },
        "global_config_options": {
            "title": "Global options",
            "type": "object",
            "description": "Global configuration options specific to nf-core/pixelator.",
            "properties": {
                "pixelator_container": {
                    "type": "string",
                    "format": "url",
                    "description": "Override the container image reference to use for all steps using the `pixelator` command.",
                    "help_text": "Use this to force the pipeline to use a different image version in all steps that use the pixelator command.\nThe pipeline is not garanteed to work when using different pixelator versions."
                }
            }
        },
        "institutional_config_options": {
            "title": "Institutional config options",
            "type": "object",
            "fa_icon": "fas fa-university",
            "description": "Parameters used to describe centralised config profiles. These should not be edited.",
            "help_text": "The centralised nf-core configuration profiles use a handful of pipeline parameters to describe themselves. This information is then printed to the Nextflow log when you run a pipeline. You should not need to change these values when you run a pipeline.",
            "properties": {
                "custom_config_version": {
                    "type": "string",
                    "description": "Git commit id for Institutional configs.",
                    "default": "master",
                    "hidden": true,
                    "fa_icon": "fas fa-users-cog"
                },
                "custom_config_base": {
                    "type": "string",
                    "description": "Base directory for Institutional configs.",
                    "default": "https://raw.githubusercontent.com/nf-core/configs/master",
                    "hidden": true,
                    "help_text": "If you're running offline, Nextflow will not be able to fetch the institutional config files from the internet. If you don't need them, then this is not a problem. If you do need them, you should download the files from the repo and tell Nextflow where to find them with this parameter.",
                    "fa_icon": "fas fa-users-cog"
                },
                "config_profile_name": {
                    "type": "string",
                    "description": "Institutional config name.",
                    "hidden": true,
                    "fa_icon": "fas fa-users-cog"
                },
                "config_profile_description": {
                    "type": "string",
                    "description": "Institutional config description.",
                    "hidden": true,
                    "fa_icon": "fas fa-users-cog"
                },
                "config_profile_contact": {
                    "type": "string",
                    "description": "Institutional config contact information.",
                    "hidden": true,
                    "fa_icon": "fas fa-users-cog"
                },
                "config_profile_url": {
                    "type": "string",
                    "description": "Institutional config URL link.",
                    "hidden": true,
                    "fa_icon": "fas fa-users-cog"
                }
            }
        },
        "max_job_request_options": {
            "title": "Max job request options",
            "type": "object",
            "fa_icon": "fab fa-acquisitions-incorporated",
            "description": "Set the top limit for requested resources for any single job.",
            "help_text": "If you are running on a smaller system, a pipeline step requesting more resources than are available may cause the Nextflow to stop the run with an error. These options allow you to cap the maximum resources requested by any single job so that the pipeline will run on your system.\n\nNote that you can not _increase_ the resources requested by any job using these options. For that you will need your own configuration file. See [the nf-core website](https://nf-co.re/usage/configuration) for details.",
            "properties": {
                "max_cpus": {
                    "type": "integer",
                    "description": "Maximum number of CPUs that can be requested for any single job.",
                    "default": 16,
                    "fa_icon": "fas fa-microchip",
                    "hidden": true,
                    "help_text": "Use to set an upper-limit for the CPU requirement for each process. Should be an integer e.g. `--max_cpus 1`"
                },
                "max_memory": {
                    "type": "string",
                    "description": "Maximum amount of memory that can be requested for any single job.",
                    "default": "128.GB",
                    "fa_icon": "fas fa-memory",
                    "pattern": "^\\d+(\\.\\d+)?\\.?\\s*(K|M|G|T)?B$",
                    "hidden": true,
                    "help_text": "Use to set an upper-limit for the memory requirement for each process. Should be a string in the format integer-unit e.g. `--max_memory '8.GB'`"
                },
                "max_time": {
                    "type": "string",
                    "description": "Maximum amount of time that can be requested for any single job.",
                    "default": "240.h",
                    "fa_icon": "far fa-clock",
                    "pattern": "^(\\d+\\.?\\s*(s|m|h|d|day)\\s*)+$",
                    "hidden": true,
                    "help_text": "Use to set an upper-limit for the time requirement for each process. Should be a string in the format integer-unit e.g. `--max_time '2.h'`"
                }
            }
        },
        "generic_options": {
            "title": "Generic options",
            "type": "object",
            "fa_icon": "fas fa-file-import",
            "description": "Less common options for the pipeline, typically set in a config file.",
            "help_text": "These options are common to all nf-core pipelines and allow you to customise some of the core preferences for how the pipeline runs.\n\nTypically these options would be set in a Nextflow config file loaded for all pipeline runs, such as `~/.nextflow/config`.",
            "properties": {
                "help": {
                    "type": "boolean",
                    "description": "Display help text.",
                    "fa_icon": "fas fa-question-circle",
                    "hidden": true
                },
                "version": {
                    "type": "boolean",
                    "description": "Display version and exit.",
                    "fa_icon": "fas fa-question-circle",
                    "hidden": true
                },
                "publish_dir_mode": {
                    "type": "string",
                    "default": "copy",
                    "description": "Method used to save pipeline results to output directory.",
                    "help_text": "The Nextflow `publishDir` option specifies which intermediate files should be saved to the output directory. This option tells the pipeline what method should be used to move these files. See [Nextflow docs](https://www.nextflow.io/docs/latest/process.html#publishdir) for details.",
                    "fa_icon": "fas fa-copy",
                    "enum": ["symlink", "rellink", "link", "copy", "copyNoFollow", "move"],
                    "hidden": true
                },
                "email_on_fail": {
                    "type": "string",
                    "description": "Email address for completion summary, only when pipeline fails.",
                    "fa_icon": "fas fa-exclamation-triangle",
                    "pattern": "^([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$",
                    "help_text": "An email address to send a summary email to when the pipeline is completed - ONLY sent if the pipeline does not exit successfully.",
                    "hidden": true
                },
                "plaintext_email": {
                    "type": "boolean",
                    "description": "Send plain-text email instead of HTML.",
                    "fa_icon": "fas fa-remove-format",
                    "hidden": true
                },
                "monochrome_logs": {
                    "type": "boolean",
                    "description": "Do not use coloured log outputs.",
                    "fa_icon": "fas fa-palette",
                    "hidden": true
                },
                "hook_url": {
                    "type": "string",
                    "description": "Incoming hook URL for messaging service",
                    "fa_icon": "fas fa-people-group",
                    "help_text": "Incoming hook URL for messaging service. Currently, MS Teams and Slack are supported.",
                    "hidden": true
                },
                "tracedir": {
                    "type": "string",
                    "description": "Directory to keep pipeline Nextflow logs and reports.",
                    "default": "${params.outdir}/pipeline_info",
                    "fa_icon": "fas fa-cogs",
                    "hidden": true
                },
                "validate_params": {
                    "type": "boolean",
                    "description": "Boolean whether to validate parameters against the schema at runtime",
                    "default": true,
                    "fa_icon": "fas fa-check-square",
                    "hidden": true
                },
                "validationShowHiddenParams": {
                    "type": "boolean",
                    "fa_icon": "far fa-eye-slash",
                    "description": "Show all params when using `--help`",
                    "hidden": true,
                    "help_text": "By default, parameters set as _hidden_ in the schema are not shown on the command line when a user runs with `--help`. Specifying this option will tell the pipeline to show all parameters."
                },
                "validationFailUnrecognisedParams": {
                    "type": "boolean",
                    "fa_icon": "far fa-check-circle",
                    "description": "Validation of parameters fails when an unrecognised parameter is found.",
                    "hidden": true,
                    "help_text": "By default, when an unrecognised parameter is found, it returns a warinig."
                },
                "validationLenientMode": {
                    "type": "boolean",
                    "fa_icon": "far fa-check-circle",
                    "description": "Validation of parameters in lenient more.",
                    "hidden": true,
                    "help_text": "Allows string values that are parseable as numbers or booleans. For further information see [JSONSchema docs](https://github.com/everit-org/json-schema#lenient-mode)."
                }
            }
        }
    },
    "allOf": [
        {
            "$ref": "#/definitions/input_output_options"
        },
        {
            "$ref": "#/definitions/preqc_options"
        },
        {
            "$ref": "#/definitions/adapterqc_options"
        },
        {
            "$ref": "#/definitions/demux_options"
        },
        {
            "$ref": "#/definitions/collapse_options"
        },
        {
            "$ref": "#/definitions/graph_options"
        },
        {
            "$ref": "#/definitions/annotate_options"
        },
        {
            "$ref": "#/definitions/analysis_options"
        },
        {
            "$ref": "#/definitions/report_options"
        },
        {
            "$ref": "#/definitions/global_config_options"
        },
        {
            "$ref": "#/definitions/institutional_config_options"
        },
        {
            "$ref": "#/definitions/max_job_request_options"
        },
        {
            "$ref": "#/definitions/generic_options"
        }
    ]
}
