{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "https://raw.githubusercontent.com/nf-core/pangenome/master/nextflow_schema.json",
    "title": "nf-core/pangenome pipeline parameters",
    "description": "The pangenome graph construction pipeline renders a collection of sequences into a pangenome graph. Its goal is to build a graph that is locally directed and acyclic while preserving large-scale variation. Maintaining local linearity is important for interpretation, visualization, mapping, comparative genomics, and reuse of pangenome graphs",
    "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", "n_haplotypes", "outdir"],
            "properties": {
                "input": {
                    "type": "string",
                    "format": "file-path",
                    "mimetype": "text/plain",
                    "pattern": "^\\S+\\.fn?a(sta)?(\\.gz)?$",
                    "description": "Path to BGZIPPED input FASTA to build the pangenome graph from.",
                    "help_text": "A FASTA file containing the sequences to build the pangenome graph from. Each sequence can be a full chromosome, a contig, or a very long read. The FASTA file must be BGZIPPED or WFMASH won't be able to process it. If you have your sequences in FASTA format, you can run: \n\nbgzip <SEQUENCES.fa> @<THREADS> > <SEQUENCES.fa.gz>\nsamtools faidx <SEQUENCES.fa.gz>\n\nIn order to ensure the most compatible functionality, please format your sequence identifiers so that they follow the https://github.com/pangenome/PanSN-spec. \n\npattern: ^\\S+\\.fn?a(sta)?(\\.gz)?$",
                    "fa_icon": "fas fa-file-csv"
                },
                "n_haplotypes": {
                    "type": "number",
                    "description": "The number of haplotypes in the input FASTA.",
                    "help_text": "The constructed graph is defined by the number of mappings per segment of each genome (--n_haplotypes <N> - 1). Ideally, you should set this to equal the number of haplotypes in the pangenome. Because that's the maximum number of secondary mappings and alignments that we expect. Keep in mind that the total work of alignment is proportional to N*N, and these multimappings can be highly redundant."
                },
                "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"
                }
            }
        },
        "wfmash_options": {
            "title": "Wfmash Options",
            "type": "object",
            "description": "Options for the all versus all alignment phase.",
            "default": "",
            "properties": {
                "wfmash_map_pct_id": {
                    "type": "number",
                    "default": 90,
                    "description": "Percent identity in the wfmash mashmap step.",
                    "help_text": "Use `mash dist` or `mash triangle` to explore the typical level of divergence between the sequences in your input (see https://pggb.readthedocs.io/en/latest/rst/tutorials/divergence_estimation.html#divergence-estimation for more information). Convert this to an approximate percent identity and provide it as --wfmash_map_pct_id <PCT>. A list of examples can be found at https://github.com/pangenome/pggb#example-builds-for-diverse-species."
                },
                "wfmash_segment_length": {
                    "type": "integer",
                    "default": 5000,
                    "description": "Segment length for mapping.",
                    "help_text": "Crucially, --wfmash_segment_length provides a kind of minimum alignment length filter. The `mashmap3` step in `wfmash` will only consider segments of this size. For small pangenome graphs, or where there are few repeats, --wfmash_segment_length can be set low (for example 500 when building a MHC pangenome graph). However, for larger contexts, with repeats, it can be very important to set this high (for instance 50k in the case of human genomes). A long segment length ensures that we represent long collinear regions of the input sequences in the structure of the graph. In general, this should at least be larger than transposons and other common repeats in your pangenome. A list of examples can be found at https://github.com/pangenome/pggb#example-builds-for-diverse-species."
                },
                "wfmash_block_length": {
                    "type": "string",
                    "default": "wfmash_segment_length * 5",
                    "description": "Minimum block length filter for mapping.",
                    "help_text": "By default, wfmash only keeps mappings with at least 5 times the size of a segment. This can be adjusted with --wfmash_block_length <BLOCK_LENGTH>."
                },
                "wfmash_mash_kmer": {
                    "type": "integer",
                    "default": 19,
                    "description": "Kmer size for mashmap."
                },
                "wfmash_mash_kmer_thres": {
                    "type": "number",
                    "default": 0.001,
                    "description": "Ignore the top % most-frequent kmers."
                },
                "wfmash_sparse_map": {
                    "type": "number",
                    "default": "1.0",
                    "description": "Keep this fraction of mappings (\"auto\" for giant component heuristic)."
                },
                "wfmash_merge_segments": {
                    "type": "boolean",
                    "description": "Merge successive mappings."
                },
                "wfmash_no_splits": {
                    "type": "boolean",
                    "description": "Disable splitting of input sequences during mapping.",
                    "hidden": true
                },
                "wfmash_exclude_delim": {
                    "type": "string",
                    "description": "Skip mappings between sequences with the same name prefix before the given delimiter character. [default: all-vs-all and !self].",
                    "hidden": true
                },
                "wfmash_temp_dir": {
                    "type": "string",
                    "description": "Set the directory where temporary files should be stored. Since everything runs in containers, we don't usually set this argument.",
                    "hidden": true
                },
                "wfmash_chunks": {
                    "type": "integer",
                    "default": 1,
                    "description": "The number of files to generate from the approximate wfmash mappings to scale across a whole cluster. It is recommended to set this to the number of available nodes. If only one machine is available, leave it at 1.",
                    "help_text": "This Nextflow pipeline version's major advantage is that it can distribute the usually computationally heavy all versus all alignment step across a whole cluster. It is capable of splitting the initial approximate alignments into problems of equal size. The base-level alignments are then distributed across several processes. Assuming you have a cluster with 10 nodes and you are the only one using it, we would recommend to set --wfmash_chunks 10. If you have a cluster with 20 nodes, but you have to share it with others, maybe setting it to --wfmash_chunks 10 could be a good fit, because then you don't have to wait too long for your jobs to finish."
                },
                "wfmash_only": {
                    "type": "boolean",
                    "description": "If this parameter is set, only the wfmash alignment step of the pipeline is executed. This option is offered for users who want to run wfmash on a cluster."
                }
            }
        },
        "seqwish_options": {
            "title": "Seqwish Options",
            "type": "object",
            "description": "",
            "default": "",
            "properties": {
                "seqwish_min_match_length": {
                    "type": "integer",
                    "default": 19,
                    "description": "Ignores exact matches below this length.",
                    "help_text": "Graph induction with seqwish often works better when we filter very short matches out of the input alignments. In practice, these often occur in regions of low alignment quality, which are typical of areas with large INDELs and structural variations in the wfmash alignments. This underalignment is then resolved in the smoothxg step. Removing short matches can simplify the graph and remove spurious relationships caused by short repeated homologies.\nA setting of --seqwish_min_match_length 47 is optimal for around 5% divergence, and we suggest lowering it for higher divergence and increasing it for lower divergence. Values up to --seqwish_min_match_length 311 work well for human haplotypes. In effect, setting --seqwish_min_match_length to N means that we can tolerate a local pairwise difference rate of no more than 1/N. Thus, INDELs which may be represented by complex series of edit operations will be opened into bubbles in the induced graph, and alignment regions with very low identity will be ignored. Using affine-gapped alignment (such as with minimap2) may reduce the impact of this step by representing large indels more precisely in the input alignments. However, it remains important due to local inconsistency in alignments in low-complexity sequence."
                },
                "seqwish_transclose_batch": {
                    "type": "integer",
                    "default": 10000000,
                    "description": "Number of base pairs to use for transitive closure batch.",
                    "help_text": "If you run out of memory during the seqwish step, you can lower this value. It will take longer, but it will use less memory."
                },
                "seqwish_sparse_factor": {
                    "type": "number",
                    "default": 0,
                    "description": "Keep this randomly selected fraction of input matches."
                },
                "seqwish_temp_dir": {
                    "type": "string",
                    "description": "Set the directory where temporary files should be stored. Since everything runs in containers, we don't usually set this argument.",
                    "hidden": true
                },
                "seqwish_paf": {
                    "type": "string",
                    "description": "Input PAF file. The wfmash alignment step is skipped."
                }
            }
        },
        "smoothxg_options": {
            "title": "Smoothxg options",
            "type": "object",
            "description": "Options for graph smoothing phase.",
            "default": "",
            "properties": {
                "skip_smoothxg": {
                    "type": "boolean",
                    "description": "Skip the graph smoothing step of the pipeline."
                },
                "smoothxg_max_path_jump": {
                    "type": "integer",
                    "default": 0,
                    "description": "Maximum path jump to include in the block.",
                    "hidden": true
                },
                "smoothxg_max_edge_jump": {
                    "type": "integer",
                    "default": 0,
                    "description": "Maximum edge jump before a block is broken.",
                    "hidden": true
                },
                "smoothxg_poa_length": {
                    "type": "string",
                    "default": "700,900,1100",
                    "description": "Maximum sequence length to put int POA. Is a comma-separated list. For each integer, SMOOTHXG wil be executed once.",
                    "help_text": "The last step in smoothxg refines the graph by running a partial order alignment (POA) across segments, so called blocks. The \"chunked\" POA process attempts to build an MSA for each collinear region in the sorted graph.\nThe length of these sub-problems greatly affects the total time and memory requirements of the pipeline, and is defined by -- smoothxg_poa_length <LEN1,LEN2,...>. Several passes of refinement can be defined by lengths >LEN1,LEN2,...>, and so on. Ideally, this target can be set above the length of transposon repeats in the pangenome, and base-level graph quality tends to improve as it is set higher. Higher values makes sense for lower-diversity pangenomes, but can require several GB of RAM per thread."
                },
                "smoothxg_block_id_min": {
                    "type": "string",
                    "description": "Minimum edit-based identity to cluster sequences.",
                    "hidden": true
                },
                "smoothxg_block_ratio_min": {
                    "type": "integer",
                    "default": 0,
                    "description": "Minimum 'smallest / largest' sequence length ration to cluster in a block.",
                    "hidden": true
                },
                "smoothxg_pad_max_depth": {
                    "type": "integer",
                    "default": 100,
                    "description": "Path depth at which we don't pad the POA problem."
                },
                "smoothxg_poa_padding": {
                    "type": "number",
                    "default": 0.001,
                    "description": "Pad each end of each seuqence in POA with 'smoothxg_poa_padding * longest_poa_seq' base pairs."
                },
                "smoothxg_poa_params": {
                    "type": "string",
                    "default": "1,19,39,3,81,1",
                    "description": "Score parameters for POA in the form of 'match,mismatch,gap1,ext1,gap2,ext2'. It may also be given as presets: 'asm5', 'asm10', 'asm15', 'asm20'. [default: 1,19,39,3,81,1 = asm5].",
                    "help_text": "For details of the different asm modes, please take a look at https://pggb.readthedocs.io/en/latest/rst/optional_parameters.html#homogenizing-and-ordering-the-graph."
                },
                "smoothxg_write_maf": {
                    "type": "boolean",
                    "description": "Write MAF output representing merged POA blocks."
                },
                "smoothxg_consensus_prefix": {
                    "type": "string",
                    "default": "Consensus_",
                    "description": "Use this prefix for consensus path names.",
                    "hidden": true
                },
                "smoothxg_temp_dir": {
                    "type": "string",
                    "description": "Set the directory where temporary files should be stored. Since everything runs in containers, we don't usually set this argument.",
                    "hidden": true
                },
                "smoothxg_keep_intermediate_files": {
                    "type": "boolean",
                    "description": "Keep intermediate graphs during SMOOTHXG.",
                    "hidden": true
                },
                "smoothxg_run_abpoa": {
                    "type": "boolean",
                    "description": "Run abPOA. [default: SPOA]."
                },
                "smoothxg_run_global_poa": {
                    "type": "boolean",
                    "description": "Run the POA in global mode. [default: local mode]."
                },
                "smoothxg_poa_cpus": {
                    "type": "integer",
                    "default": 0,
                    "description": "Number of CPUs for the potentially very memory expensive POA phase of SMOOTHXG. Default is 'task.cpus'."
                }
            }
        },
        "vg_deconstruct_options": {
            "title": "Vg Deconstruct Options",
            "type": "object",
            "description": "Options for calling variants against reference(s).",
            "default": "",
            "properties": {
                "vcf_spec": {
                    "type": "string",
                    "description": "Specify a set of VCFs to produce with --vcf_spec \"REF:DELIM[:LEN][,REF:DELIM:[LEN]]*\".",
                    "help_text": "The paths matching ^REF are used as a reference, while the sample haplotypes are derived from path names, e.g. when DELIM=# and with '-V chm13:#', a path named HG002#1#ctg would be assigned to sample HG002 phase 1. If LEN is specified and greater than 0, the VCFs are decomposed, filtering sites whose max allele length is greater than LEN."
                }
            }
        },
        "community": {
            "title": "Community",
            "type": "object",
            "description": "Options to run the partition algorithm for community detection.",
            "default": "",
            "properties": {
                "communities": {
                    "type": "boolean",
                    "help_text": "Pangenome graphs can represent all mutual alignments of collections of sequences. However, we can't really expect to pairwise map all sequences together and obtain well separated connected components. It is likely to get a giant connected component, and probably a few smaller ones, due to incorrect mappings or false homologies. This might unnecessarily increase the computational burden, as well as complicate the downstream analyzes. Therefore, it is recommended to split up the input sequences into communities in order to find the latent structure of their mutual relationship. For example, the communities can represent the different chromosomes of the input genomes.\n<Warning> If you know in advance that your sequences present particular rearrangements (like rare chromosome translocations), you might consider skipping this step or tuning it accordingly to your biological questions.\n",
                    "description": "Enable community detection."
                }
            }
        },
        "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",
                    "default": false,
                    "hidden": true
                },
                "version": {
                    "type": "boolean",
                    "description": "Display version and exit.",
                    "fa_icon": "fas fa-question-circle",
                    "default": false,
                    "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",
                    "default": false,
                    "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",
                    "default": false,
                    "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`",
                    "default": false,
                    "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.",
                    "default": false,
                    "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.",
                    "default": false,
                    "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)."
                },
                "show_hidden_params": {
                    "type": "boolean",
                    "fa_icon": "far fa-check-circle",
                    "description": "Do we want to display hidden parameters?",
                    "default": false,
                    "hidden": true,
                    "help_text": "Do we want to display hidden parameters?"
                },
                "schema_ignore_params": {
                    "type": "string",
                    "fa_icon": "far fa-check-circle",
                    "description": "Do we want to display hidden parameters?",
                    "default": "igenomes_base",
                    "hidden": true,
                    "help_text": "Do we want to display hidden parameters?"
                }
            }
        }
    },
    "allOf": [
        {
            "$ref": "#/definitions/input_output_options"
        },
        {
            "$ref": "#/definitions/wfmash_options"
        },
        {
            "$ref": "#/definitions/seqwish_options"
        },
        {
            "$ref": "#/definitions/smoothxg_options"
        },
        {
            "$ref": "#/definitions/vg_deconstruct_options"
        },
        {
            "$ref": "#/definitions/community"
        },
        {
            "$ref": "#/definitions/institutional_config_options"
        },
        {
            "$ref": "#/definitions/max_job_request_options"
        },
        {
            "$ref": "#/definitions/generic_options"
        }
    ]
}
