Skip to content

Commit

Permalink
validate input in main.nf
Browse files Browse the repository at this point in the history
  • Loading branch information
maxulysse committed Aug 25, 2023
1 parent 6355a33 commit 1be5ebc
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 32 deletions.
32 changes: 31 additions & 1 deletion main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,36 @@ else if (WorkflowMain.isSynapseId(ch_input)) { input_type = 'synapse' }
else { exit 1, 'Ids provided via --input not recognised please make sure they are either SRA / ENA / GEO / DDBJ or Synapse ids!' }
if (params.input_type != input_type) { exit 1, "Ids auto-detected as ${input_type}. Please provide '--input_type ${input_type}' as a parameter to the pipeline!" }

/*
========================================================================================
VALIDATE INPUTS
========================================================================================
*/

if (params.input_type == 'sra') {
def valid_params = [
ena_metadata_fields : ['run_accession', 'experiment_accession', 'library_layout', 'fastq_ftp', 'fastq_md5']
]

def summary_params = NfcoreSchema.paramsSummaryMap(workflow, params)

// Validate input parameters
WorkflowSra.initialise(params, valid_params)
}

if (params.input_type == 'synapse') {

def summary_params = NfcoreSchema.paramsSummaryMap(workflow, params)

// Create channel for synapse config
if (params.synapse_config) {
ch_synapse_config = file(params.synapse_config, checkIfExists: true)
} else {
exit 1, 'Please provide a Synapse config file for download authentication!'
}

}

/*
========================================================================================
IMPORT MODULES
Expand Down Expand Up @@ -84,7 +114,7 @@ workflow NFCORE_FETCHNGS {
// WORKFLOW: Download FastQ files for Synapse ids
//
} else if (params.input_type == 'synapse') {
SYNAPSE ( ch_ids )
SYNAPSE(ch_ids, ch_synapse_config)
ch_versions = ch_versions.mix(SYNAPSE.out.versions)
}

Expand Down
15 changes: 0 additions & 15 deletions workflows/sra/main.nf
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/*
========================================================================================
VALIDATE INPUTS
========================================================================================
*/

def valid_params = [
ena_metadata_fields : ['run_accession', 'experiment_accession', 'library_layout', 'fastq_ftp', 'fastq_md5']
]

def summary_params = NfcoreSchema.paramsSummaryMap(workflow, params)

// Validate input parameters
WorkflowSra.initialise(params, valid_params)

/*
========================================================================================
IMPORT LOCAL MODULES/SUBWORKFLOWS
Expand Down
18 changes: 2 additions & 16 deletions workflows/synapse/main.nf
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/*
========================================================================================
VALIDATE INPUTS
========================================================================================
*/

def summary_params = NfcoreSchema.paramsSummaryMap(workflow, params)

// Create channel for synapse config
if (params.synapse_config) {
ch_synapse_config = file(params.synapse_config, checkIfExists: true)
} else {
exit 1, 'Please provide a Synapse config file for download authentication!'
}

/*
========================================================================================
IMPORT LOCAL MODULES/SUBWORKFLOWS
Expand All @@ -34,7 +19,8 @@ include { SYNAPSE_MERGE_SAMPLESHEET } from '../../modules/local/synapse_merge_sa
workflow SYNAPSE {

take:
ids // channel: [ ids ]
ids // channel: [ ids ]
ch_synapse_config // channel: [ synapse_config ]

main:
ch_versions = Channel.empty()
Expand Down

0 comments on commit 1be5ebc

Please sign in to comment.