Skip to content

Commit

Permalink
Merge pull request #63 from HarryHung/feature/better-tower-support
Browse files Browse the repository at this point in the history
Proper Nextflow Tower Support

Former-commit-id: ec1516c
  • Loading branch information
HarryHung authored Aug 11, 2023
2 parents bebbf19 + 9226c7f commit 10cc460
Show file tree
Hide file tree
Showing 7 changed files with 314 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ The development of this pipeline is part of the GPS Project ([Global Pneumococca
| Option | Values | Description |
| --- | ---| --- |
| `--assembler` | `"shovill"` or `"unicycler"`<br />(Default: `"shovill"`)| Using which SPAdes-based assembler to assemble the reads. |
| `--min_contig_length` | Any integer value<br />(Default: `500`) | Minimum legnth of contig to be included in the assembly |
| `--min_contig_length` | Any integer value<br />(Default: `500`) | Minimum legnth of contig to be included in the assembly. |

## Mapping
> ⚠️ `--ref_genome_bwa_db_local` does not accept user provided local database, directory content will be overwritten
Expand Down
2 changes: 1 addition & 1 deletion modules/info.nf
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ process SAVE {
|╔═══════════════════════════════════════════════════════════════════════════════════════════╗
|║ Read QC ║
|╟──────────────────────────────────────────────────────────────┬────────────────────────────╢
|${qcTextRow('Minimum bases in processed reads', String.format("%.0f", params.length_low * params.depth))}
|${qcTextRow('Minimum bases in processed reads', String.format("%.0f", Math.ceil(params.length_low * params.depth)))}
|╠══════════════════════════════════════════════════════════════╧════════════════════════════╣
|║ Taxonomy QC ║
|╟──────────────────────────────────────────────────────────────┬────────────────────────────╢
Expand Down
12 changes: 11 additions & 1 deletion modules/singularity.nf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,17 @@ void singularityPreflight(Path configPath, String singularityCacheDir) {
process.waitFor()

if (process.exitValue()) {
log.info("${container} cannot be pulled successfully. Check your Internet connection and re-run the pipeline.\n")
def errorMessage = new BufferedReader(new InputStreamReader(process.getErrorStream())).getText()

log.info(
"""
|Singularity Error Messages:
|${errorMessage}
|
|${container} cannot be pulled successfully. Resolve the above error and re-run the pipeline.
|
""".stripMargin()
)
System.exit(1)
}

Expand Down
4 changes: 2 additions & 2 deletions modules/validate.nf
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ void validate(Map params) {
validParams.put("singularity_cachedir", "path")
}

// Add params.maxretries when workflow.profile == 'lsf'
if (workflow.profile == 'lsf' ) {
// Add params.maxretries when workflow.profile contains 'lsf'
if (workflow.profile.split(',').contains('lsf')) {
validParams.put("maxretries", "int")
}

Expand Down
8 changes: 8 additions & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
nextflow.enable.dsl=2

// Default parameters that can be overridden
params {
// Show help message
Expand Down Expand Up @@ -190,5 +192,11 @@ profiles {
cacheDir = params.singularity_cachedir
}
}
sangertower {
tower {
enabled = true
endpoint = 'https://tower.internal.sanger.ac.uk/api/'
}
}

}
288 changes: 288 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,288 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://raw.githubusercontent.com/./master/nextflow_schema.json",
"title": "GPS Unified Pipeline Parameters",
"description": "",
"type": "object",
"definitions": {
"input_output": {
"title": "Input / Output",
"type": "object",
"description": "",
"default": "",
"properties": {
"reads": {
"type": "string",
"description": "Path to the input directory that contains the reads to be processed."
},
"output": {
"type": "string",
"description": "Path to the output directory that save the results."
},
"assembly_publish": {
"type": "string",
"description": "Method used by Nextflow to publish the generated assemblies.",
"hidden": true
}
},
"required": [
"reads",
"output",
"assembly_publish"
]
},
"qc_parameters": {
"title": "QC Parameters",
"type": "object",
"description": "",
"default": "",
"properties": {
"spneumo_percentage": {
"type": "number",
"description": "Minimum S. pneumoniae percentage in reads to pass Taxonomy QC.",
"hidden": true
},
"ref_coverage": {
"type": "number",
"description": "Minimum reference coverage percentage by the reads to pass Mapping QC.",
"hidden": true
},
"het_snp_site": {
"type": "integer",
"description": "Maximum non-cluster heterozygous SNP (Het-SNP) site count to pass Mapping QC.",
"hidden": true
},
"contigs": {
"type": "integer",
"hidden": true,
"description": "Maximum contig count in assembly to pass Assembly QC."
},
"length_low": {
"type": "integer",
"hidden": true,
"description": "Minimum assembly length to pass Assembly QC."
},
"length_high": {
"type": "integer",
"hidden": true,
"description": "Maximum assembly length to pass Assembly QC."
},
"depth": {
"type": "number",
"hidden": true,
"description": "Minimum sequencing depth to pass Assembly QC."
}
},
"required": [
"spneumo_percentage",
"ref_coverage",
"het_snp_site",
"contigs",
"length_low",
"length_high",
"depth"
]
},
"assembly": {
"title": "Assembly",
"type": "object",
"description": "",
"default": "",
"properties": {
"assembler": {
"type": "string",
"hidden": true,
"description": "Using which SPAdes-based assembler to assemble the reads."
},
"min_contig_length": {
"type": "integer",
"description": "Minimum legnth of contig to be included in the assembly.",
"hidden": true
}
},
"required": [
"assembler",
"min_contig_length"
]
},
"mapping": {
"title": "Mapping",
"type": "object",
"description": "",
"default": "",
"properties": {
"ref_genome": {
"type": "string",
"hidden": true,
"description": "Path to the reference genome for mapping."
},
"ref_genome_bwa_db_local": {
"type": "string",
"description": "Path to the directory where the reference genome FM-index database for BWA should be saved to.",
"hidden": true
}
},
"required": [
"ref_genome",
"ref_genome_bwa_db_local"
]
},
"taxonomy": {
"title": "Taxonomy",
"type": "object",
"description": "",
"default": "",
"properties": {
"kraken2_db_remote": {
"type": "string",
"hidden": true,
"description": "URL to a Kraken2 database."
},
"kraken2_db_local": {
"type": "string",
"hidden": true,
"description": "Path to the directory where the remote Kraken2 database should be saved to."
},
"kraken2_memory_mapping": {
"type": "boolean",
"hidden": true,
"description": "Using the memory mapping option of Kraken2 or not."
}
},
"required": [
"kraken2_db_remote",
"kraken2_db_local",
"kraken2_memory_mapping"
]
},
"serotype": {
"title": "Serotype",
"type": "object",
"description": "",
"default": "",
"properties": {
"seroba_db_remote": {
"type": "string",
"hidden": true,
"description": "URL to a SeroBA Git remote repository."
},
"seroba_db_local": {
"type": "string",
"hidden": true,
"description": "Path to the directory where SeroBA local repository should be saved to."
},
"seroba_kmer": {
"type": "integer",
"hidden": true,
"description": "Kmer size for creating the KMC database of SeroBA."
}
},
"required": [
"seroba_db_remote",
"seroba_db_local",
"seroba_kmer"
]
},
"lineage": {
"title": "Lineage",
"type": "object",
"description": "",
"default": "",
"properties": {
"poppunk_db_remote": {
"type": "string",
"hidden": true,
"description": "URL to a PopPUNK database."
},
"poppunk_ext_remote": {
"type": "string",
"hidden": true,
"description": "URL to a PopPUNK external clusters file."
},
"poppunk_db_local": {
"type": "string",
"hidden": true,
"description": "Path to the directory where the remote PopPUNK database and external clusters file should be saved to."
}
},
"required": [
"poppunk_db_remote",
"poppunk_ext_remote",
"poppunk_db_local"
]
},
"other_amr": {
"title": "Other AMR",
"type": "object",
"description": "",
"default": "",
"properties": {
"ariba_ref": {
"type": "string",
"hidden": true,
"description": "Path to the reference sequences for ARIBA."
},
"ariba_metadata": {
"type": "string",
"hidden": true,
"description": "Path to the metadata file for ARIBA."
},
"ariba_db_local": {
"type": "string",
"hidden": true,
"description": "Path to the directory where ARIBA reference database should be saved to."
}
},
"required": [
"ariba_ref",
"ariba_metadata",
"ariba_db_local"
]
},
"singularity": {
"title": "Singularity",
"type": "object",
"description": "",
"default": "",
"properties": {
"singularity_cachedir": {
"type": "string",
"description": "Path to the directory where Singularity images should be saved to.",
"hidden": true
}
},
"required": [
"singularity_cachedir"
]
}
},
"allOf": [
{
"$ref": "#/definitions/input_output"
},
{
"$ref": "#/definitions/qc_parameters"
},
{
"$ref": "#/definitions/assembly"
},
{
"$ref": "#/definitions/mapping"
},
{
"$ref": "#/definitions/taxonomy"
},
{
"$ref": "#/definitions/serotype"
},
{
"$ref": "#/definitions/lineage"
},
{
"$ref": "#/definitions/other_amr"
},
{
"$ref": "#/definitions/singularity"
}
]
}
3 changes: 3 additions & 0 deletions tower.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
reports:
results.csv:
display: "Overall Results"

0 comments on commit 10cc460

Please sign in to comment.