diff --git a/main.nf b/main.nf index edb54fd8..ef79d02b 100644 --- a/main.nf +++ b/main.nf @@ -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 @@ -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) } diff --git a/workflows/sra/main.nf b/workflows/sra/main.nf index d4612cd0..d999d998 100644 --- a/workflows/sra/main.nf +++ b/workflows/sra/main.nf @@ -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 diff --git a/workflows/synapse/main.nf b/workflows/synapse/main.nf index 04bb32cb..30d05f4f 100644 --- a/workflows/synapse/main.nf +++ b/workflows/synapse/main.nf @@ -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 @@ -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()