{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "https://raw.githubusercontent.com/nf-core/molkart/master/nextflow_schema.json",
    "title": "nf-core/molkart pipeline parameters",
    "description": "An analysis pipeline for Molecular Cartography data from Resolve Biosciences.",
    "type": "object",
    "definitions": {
        "segmentation_methods_and_options": {
            "title": "Segmentation methods and options",
            "type": "object",
            "description": "Define which segmentation methods should be used and how.",
            "default": "",
            "properties": {
                "segmentation_method": {
                    "type": "string",
                    "description": "List of segmentation tools to apply to the image written as a comma separated string: mesmer,cellpose,ilastik would run all three options.",
                    "default": "mesmer",
                    "fa_icon": "fas fa-border-all"
                },
                "segmentation_min_area": {
                    "type": "integer",
                    "description": "Minimum area size (in pixels) for segmentation masks.",
                    "fa_icon": "fas fa-chart-area"
                },
                "segmentation_max_area": {
                    "type": "integer",
                    "description": "Maximum area size (in pixels) for segmenation masks.",
                    "fa_icon": "fas fa-chart-area"
                },
                "cellpose_diameter": {
                    "type": "integer",
                    "default": 30,
                    "description": "Cell diameter, if 0 will use the diameter of the training labels used in the model, or with built-in model will estimate diameter for each image.",
                    "fa_icon": "far fa-circle"
                },
                "cellpose_chan": {
                    "type": "integer",
                    "default": 0,
                    "description": "Specifies the channel to be segmented by Cellpose.",
                    "fa_icon": "fas fa-dice-one"
                },
                "cellpose_chan2": {
                    "type": "integer",
                    "description": "Specifies nuclear channel index for Cellpose if using pretrained models such as cyto.",
                    "fa_icon": "fas fa-dice-two"
                },
                "cellpose_pretrained_model": {
                    "type": "string",
                    "default": "cyto",
                    "description": "Pretrained Cellpose model to be used for segmentation.",
                    "fa_icon": "fas fa-address-card"
                },
                "cellpose_custom_model": {
                    "type": "string",
                    "description": "Custom Cellpose model can be provided by the user.",
                    "fa_icon": "far fa-address-card"
                },
                "cellpose_flow_threshold": {
                    "type": "number",
                    "default": 0.4,
                    "description": "Flow error threshold for Cellpose.",
                    "fa_icon": "fas fa-border-style"
                },
                "cellpose_edge_exclude": {
                    "type": "boolean",
                    "default": true,
                    "description": "Should cells detected near image edges be excluded.",
                    "fa_icon": "fas fa-border-none"
                },
                "cellpose_save_flows": {
                    "type": "boolean",
                    "description": "Should flow fields from Cellpose be saved?",
                    "fa_icon": "fas fa-arrows-alt",
                    "hidden": true
                },
                "mesmer_image_mpp": {
                    "type": "number",
                    "default": 0.138,
                    "description": "Pixel size in microns for segmentation with Mesmer.",
                    "fa_icon": "fas fa-camera"
                },
                "mesmer_compartment": {
                    "type": "string",
                    "default": "whole-cell",
                    "description": "Compartment to be segmented with Mesmer (nuclear, whole-cell)",
                    "fa_icon": "fas fa-border-all"
                },
                "ilastik_pixel_project": {
                    "type": "string",
                    "description": "Provide ilastik with a pixel classification project to produce probability maps.",
                    "format": "file-path",
                    "fa_icon": "fas fa-camera"
                },
                "ilastik_multicut_project": {
                    "type": "string",
                    "description": "Provide ilastik with a multicut project to create segmentation masks.",
                    "format": "file-path",
                    "fa_icon": "fas fa-cut"
                }
            },
            "required": ["segmentation_method"],
            "fa_icon": "fas fa-border-all"
        },
        "image_preprocessing": {
            "title": "Image preprocessing",
            "type": "object",
            "description": "Defines gridsize for Mindagap and should contrast adjustment be applied and how.",
            "default": "",
            "fa_icon": "fas fa-adjust",
            "properties": {
                "mindagap_boxsize": {
                    "type": "integer",
                    "default": 3,
                    "description": "Box size used by Mindagap to overcome gaps, a larger number allows to overcome large gaps, but results in less fine details in the filled grid.",
                    "fa_icon": "fab fa-dropbox"
                },
                "mindagap_loopnum": {
                    "type": "integer",
                    "default": 40,
                    "description": "Loop number performed by Mindagap. Lower values are faster, but the result is less good.",
                    "fa_icon": "fas fa-circle-notch"
                },
                "clahe_cliplimit": {
                    "type": "number",
                    "default": 0.01,
                    "description": "Contrast limit for localized changes in contrast by CLAHE.",
                    "fa_icon": "fas fa-border-style"
                },
                "clahe_nbins": {
                    "type": "integer",
                    "default": 256,
                    "description": "Number of histogram bins to be used by CLAHE.",
                    "fa_icon": "fas fa-ruler-combined"
                },
                "clahe_pixel_size": {
                    "type": "number",
                    "default": 0.138,
                    "description": "Pixel size to be used by CLAHE.",
                    "fa_icon": "fas fa-camera"
                },
                "clahe_kernel": {
                    "type": "number",
                    "default": 25,
                    "description": "Kernel size to be used by CLAHE.",
                    "fa_icon": "far fa-object-group"
                },
                "skip_clahe": {
                    "type": "boolean",
                    "description": "Specifies whether contrast-limited adaptive histogram equalization should be skipped.",
                    "fa_icon": "fab fa-buromobelexperte"
                },
                "mindagap_tilesize": {
                    "type": "integer",
                    "default": 2144,
                    "description": "Tile size (distance between gridlines) for Mindagap.",
                    "fa_icon": "fas fa-th",
                    "hidden": true
                },
                "mindagap_edges": {
                    "type": "boolean",
                    "description": "Should Mindagap blur area around grid for smoother transitions between tiles with different exposures.",
                    "fa_icon": "fas fa-th-large",
                    "hidden": true
                },
                "clahe_pyramid_tile": {
                    "type": "integer",
                    "description": "Tile size used for pyramid generation (must be divisible by 16).",
                    "fa_icon": "fas fa-cubes",
                    "hidden": true,
                    "default": 1072
                }
            }
        },
        "training_subset_options": {
            "title": "Training subset options",
            "type": "object",
            "description": "Define whether a cropped training set for segmentation methods should be created.",
            "default": "",
            "fa_icon": "fas fa-running",
            "properties": {
                "create_training_subset": {
                    "type": "boolean",
                    "description": "Create subset for training a segmentation model.",
                    "fa_icon": "fas fa-running"
                },
                "crop_size_x": {
                    "type": "integer",
                    "default": 400,
                    "description": "Indicates crop size on x axis.",
                    "fa_icon": "fas fa-crop-alt"
                },
                "crop_size_y": {
                    "type": "integer",
                    "default": 400,
                    "description": "Indicates crop size on y axis.",
                    "fa_icon": "fas fa-crop-alt"
                },
                "crop_amount": {
                    "type": "integer",
                    "default": 4,
                    "description": "Number of crops you would like to extract.",
                    "fa_icon": "fas fa-hashtag"
                },
                "crop_nonzero_fraction": {
                    "type": "number",
                    "default": 0.4,
                    "description": "Indicates fraction of pixels per crop above global threshold to ensure tissue and not only background is selected.",
                    "fa_icon": "fas fa-percentage"
                }
            }
        },
        "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",
                    "exists": true,
                    "mimetype": "text/csv",
                    "pattern": "^\\S+\\.csv$",
                    "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/molkart/usage#samplesheet-input).",
                    "fa_icon": "fas fa-file-csv",
                    "schema": "/assets/schema_input.json"
                },
                "outdir": {
                    "type": "string",
                    "format": "directory-path",
                    "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})$"
                },
                "multiqc_title": {
                    "type": "string",
                    "description": "MultiQC report title. Printed as page header, used for filename if not otherwise specified.",
                    "fa_icon": "fas fa-file-signature"
                }
            },
            "help_text": ""
        },
        "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
                },
                "max_multiqc_email_size": {
                    "type": "string",
                    "description": "File size limit when attaching MultiQC reports to summary emails.",
                    "pattern": "^\\d+(\\.\\d+)?\\.?\\s*(K|M|G|T)?B$",
                    "default": "25.MB",
                    "fa_icon": "fas fa-file-upload",
                    "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
                },
                "multiqc_config": {
                    "type": "string",
                    "format": "file-path",
                    "description": "Custom config file to supply to MultiQC.",
                    "fa_icon": "fas fa-cog",
                    "hidden": true
                },
                "multiqc_logo": {
                    "type": "string",
                    "description": "Custom logo file to supply to MultiQC. File name must also be set in the MultiQC config file",
                    "fa_icon": "fas fa-image",
                    "hidden": true
                },
                "multiqc_methods_description": {
                    "type": "string",
                    "description": "Custom MultiQC yaml file containing HTML including a methods description.",
                    "fa_icon": "fas fa-cog"
                },
                "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/segmentation_methods_and_options"
        },
        {
            "$ref": "#/definitions/image_preprocessing"
        },
        {
            "$ref": "#/definitions/training_subset_options"
        },
        {
            "$ref": "#/definitions/input_output_options"
        },
        {
            "$ref": "#/definitions/institutional_config_options"
        },
        {
            "$ref": "#/definitions/max_job_request_options"
        },
        {
            "$ref": "#/definitions/generic_options"
        }
    ]
}
