Skip to content

Commit

Permalink
Update pipeline to use MIXED_INPUT
Browse files Browse the repository at this point in the history
  • Loading branch information
Lfulcrum committed Dec 18, 2024
1 parent 42492c6 commit f08ba34
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 2 deletions.
40 changes: 40 additions & 0 deletions modules/validate.nf
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
// Map of valid parameters for which to skip validation
skipValidationParams = [
// From common config
input: 'skip',
tracedir: 'skip',
max_memory: 'skip',
max_cpus: 'skip',
max_time: 'skip',
max_retries: 'skip',
retry_strategy: 'skip',
queue_size: 'skip',
submit_rate_limit: 'skip',
// From mixed input config
outdir: 'skip',
manifest_of_reads: 'skip',
manifest_of_lanes: 'skip',
manifest: 'skip',
save_metadata: 'skip',
combine_same_id_crams: 'skip',
dehumanising_method: 'skip',
cleanup_intermediate_files_irods_extractor: 'skip',
save_fastqs: 'skip',
save_method: 'skip',
raw_reads_prefix: 'skip',
preexisting_fastq_tag: 'skip',
split_sep_for_ID_from_fastq: 'skip',
lane_plex_sep: 'skip',
start_queue: 'skip',
irods_subset_to_skip: 'skip',
short_metacsv_name: 'skip',
studyid: 'skip',
runid: 'skip',
laneid: 'skip',
plexid: 'skip',
target: 'skip',
type: 'skip'
]

// Map of valid parameters and their value types
validParams = [
help: 'boolean',
Expand Down Expand Up @@ -31,6 +69,8 @@ validParams = [
lite: 'boolean'
]

validParams += skipValidationParams

// Validate whether all provided parameters are valid
void validate(Map params) {
// Ensure only one or none of the alternative workflows is selected
Expand Down
18 changes: 17 additions & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
nextflow.enable.dsl=2

// Import mixed input params
includeConfig "https://raw.githubusercontent.com/sanger-pathogens/nextflow-commons/cb60d523f202dace1b1efd02a5ae03f8a4b049a6/configs/nextflow.config"
includeConfig "$projectDir/assorted-sub-workflows/irods_extractor/subworkflows/irods.config"
includeConfig "$projectDir/assorted-sub-workflows/mixed_input/subworkflows/mixed_input.config"

// Default parameters that can be overridden
params {
// Show help message
Expand All @@ -13,6 +18,8 @@ params {
reads = "$projectDir/input"
// Default output directory
output = "$projectDir/output"
// To allow mixed input to work without warnings
outdir = output

// Default databases directory for saving all the required databases
db = "$projectDir/databases"
Expand Down Expand Up @@ -63,8 +70,11 @@ params {
lite = false
}

// Set auto-retry and process container images
process {
// Avoid use of `-o pipefail` as this fails version info collation
shell = ['/bin/bash', '-eu']

// Set auto-retry and process container images
maxRetries = 2
errorStrategy = { task.attempt <= process.maxRetries ? 'retry' : 'ignore' }

Expand Down Expand Up @@ -192,4 +202,10 @@ profiles {
}
}

// Profile for Sanger
sanger {
singularity {
runOptions = '--bind /lustre,/nfs,/data,/software,/tmp'
}
}
}
14 changes: 13 additions & 1 deletion workflows/pipeline.nf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ include { MLST } from "$projectDir/modules/mlst"
include { PBP_RESISTANCE; PARSE_PBP_RESISTANCE; GET_ARIBA_DB; OTHER_RESISTANCE; PARSE_OTHER_RESISTANCE } from "$projectDir/modules/amr"
include { GENERATE_SAMPLE_REPORT; GENERATE_OVERALL_REPORT } from "$projectDir/modules/output"

// Import subworkflows
include { MIXED_INPUT } from "$projectDir/assorted-sub-workflows/mixed_input/mixed_input"

// Main pipeline workflow
workflow PIPELINE {
main:
Expand All @@ -29,8 +32,17 @@ workflow PIPELINE {
// Get path to ARIBA database, generate from reference sequences and metadata if ncessary
GET_ARIBA_DB(params.ariba_ref, params.ariba_metadata, params.db)

// Obtain input from manifests and iRODS params
MIXED_INPUT
| map { meta, R1, R2 -> [meta.ID, [R1, R2]] }
| set { raw_read_pairs_ch }

// Get read pairs into Channel raw_read_pairs_ch
raw_read_pairs_ch = Channel.fromFilePairs("$params.reads/*_{,R}{1,2}{,_001}.{fq,fastq}{,.gz}", checkIfExists: true)
if (params.reads) {
Channel.fromFilePairs("$params.reads/*_{,R}{1,2}{,_001}.{fq,fastq}{,.gz}", checkIfExists: true)
| mix(raw_read_pairs_ch)
| set { raw_read_pairs_ch }
}

// Basic input files validation
// Output into Channel FILE_VALIDATION.out.result
Expand Down

0 comments on commit f08ba34

Please sign in to comment.