Skip to content

Commit

Permalink
update branch
Browse files Browse the repository at this point in the history
  • Loading branch information
mirpedrol committed Feb 23, 2023
1 parent fc7bf54 commit c623783
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 657 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
- Turn on automatic clean up of intermediate files in `work/` on successful pipeline completion in full-test config ([#2163](https://github.com/nf-core/tools/pull/2163)) [Contributed by @jfy133]
- Add documentation to `usage.md` on how to use `params.yml` files, based on nf-core/ampliseq text ([#2173](https://github.com/nf-core/tools/pull/2173/)) [Contributed by @jfy133, @d4straub]
- Make jobs automatically resubmit for a much wider range of exit codes (now `104` and `130..145`) ([#2170](https://github.com/nf-core/tools/pull/2170))
- Remove shcema validation from `lib` folder and use Nextflow nf-validation plugin instead ([#1771](https://github.com/nf-core/tools/pull/1771/))
- Generate input channel from input file using Nextflow nf-validation plugin ([#1771](https://github.com/nf-core/tools/pull/1771/))

### Linting

Expand Down
3 changes: 2 additions & 1 deletion nf_core/pipeline-template/assets/schema_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"sample": {
"type": "string",
"pattern": "^\\S+$",
"errorMessage": "Sample name must be provided and cannot contain spaces"
"errorMessage": "Sample name must be provided and cannot contain spaces",
"meta": ["id"]
},
"fastq_1": {
"type": "string",
Expand Down
528 changes: 0 additions & 528 deletions nf_core/pipeline-template/lib/NfcoreSchema.groovy

This file was deleted.

43 changes: 0 additions & 43 deletions nf_core/pipeline-template/lib/WorkflowMain.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -18,60 +18,17 @@ class WorkflowMain {
" https://github.com/${workflow.manifest.name}/blob/master/CITATIONS.md"
}

//
// Generate help string
//
public static String help(workflow, params, log) {
{% if igenomes -%}
def command = "nextflow run ${workflow.manifest.name} --input samplesheet.csv --genome GRCh37 -profile docker"
{% else -%}
def command = "nextflow run ${workflow.manifest.name} --input samplesheet.csv --fasta reference.fa -profile docker"
{% endif -%}
def help_string = ''
help_string += NfcoreTemplate.logo(workflow, params.monochrome_logs)
help_string += NfcoreSchema.paramsHelp(workflow, params, command)
help_string += '\n' + citation(workflow) + '\n'
help_string += NfcoreTemplate.dashedLine(params.monochrome_logs)
return help_string
}

//
// Generate parameter summary log string
//
public static String paramsSummaryLog(workflow, params, log) {
def summary_log = ''
summary_log += NfcoreTemplate.logo(workflow, params.monochrome_logs)
summary_log += NfcoreSchema.paramsSummaryLog(workflow, params)
summary_log += '\n' + citation(workflow) + '\n'
summary_log += NfcoreTemplate.dashedLine(params.monochrome_logs)
return summary_log
}

//
// Validate parameters and print summary to screen
//
public static void initialise(workflow, params, log) {
// Print help to screen if required
if (params.help) {
log.info help(workflow, params, log)
System.exit(0)
}

// Print workflow version and exit on --version
if (params.version) {
String workflow_version = NfcoreTemplate.version(workflow)
log.info "${workflow.manifest.name} ${workflow_version}"
System.exit(0)
}

// Print parameter summary log to screen
log.info paramsSummaryLog(workflow, params, log)

// Validate workflow parameters via the JSON schema
if (params.validate_params) {
NfcoreSchema.validateParameters(workflow, params, log)
}

// Check that a -profile or Nextflow config has been provided to run the pipeline
NfcoreTemplate.checkConfigProvided(workflow, log)

Expand Down
31 changes: 0 additions & 31 deletions nf_core/pipeline-template/modules/local/samplesheet_check.nf

This file was deleted.

4 changes: 4 additions & 0 deletions nf_core/pipeline-template/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ params {
max_cpus = 16
max_time = '240.h'

// Schema validation default options
fail_unrecognised_params = false
lenient_mode = false

}

// Load base.config by default for all pipelines
Expand Down
44 changes: 0 additions & 44 deletions nf_core/pipeline-template/subworkflows/local/input_check.nf

This file was deleted.

36 changes: 26 additions & 10 deletions nf_core/pipeline-template/workflows/pipeline.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,36 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

def summary_params = NfcoreSchema.paramsSummaryMap(workflow, params)
include { validateParameters } from 'plugin/nf-validation'
include { paramsHelp } from 'plugin/nf-validation'
include { paramsSummaryLog } from 'plugin/nf-validation'
include { paramsSummaryMap } from 'plugin/nf-validation'
include { validateAndConvertSamplesheet } from 'plugin/nf-validation'

def logo = NfcoreTemplate.logo(workflow, params.monochrome_logs)
def citation = '\n' + WorkflowMain.citation(workflow) + '\n'
def summary_params = paramsSummaryMap(workflow)

// Print help message if needed
if (params.help) {
def String command = "nextflow run ${workflow.manifest.name} --input samplesheet.csv --genome GRCh37 -profile docker"
log.info logo + paramsHelp(command) + citation + NfcoreTemplate.dashedLine(params.monochrome_logs)
System.exit(0)
}

// Validate input parameters
validateParameters()

// Print parameter summary log to screen
log.info logo + paramsSummaryLog(workflow) + citation

Workflow{{ short_name[0]|upper }}{{ short_name[1:] }}.initialise(params, log)

// TODO nf-core: Add all file path parameters for the pipeline to the list below
// Check input path parameters to see if they exist
def checkPathParamList = [ params.input, params.multiqc_config, params.fasta ]
for (param in checkPathParamList) { if (param) { file(param, checkIfExists: true) } }

// Check mandatory parameters
if (params.input) { ch_input = file(params.input) } else { exit 1, 'Input samplesheet not specified!' }

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CONFIG FILES
Expand All @@ -37,7 +54,6 @@ ch_multiqc_custom_methods_description = params.multiqc_methods_description ? fil
//
// SUBWORKFLOW: Consisting of a mix of local and nf-core/modules
//
include { INPUT_CHECK } from '../subworkflows/local/input_check'

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -66,18 +82,18 @@ workflow {{ short_name|upper }} {
ch_versions = Channel.empty()

//
// SUBWORKFLOW: Read in samplesheet, validate and stage input files
// Create input channel from input file
//
INPUT_CHECK (
ch_input
ch_input = Channel.validateAndConvertSamplesheet(
file(params.input, checkIfExists:true),
file("${projectDir}/assets/schema_input.json", checkIfExists:true)
)
ch_versions = ch_versions.mix(INPUT_CHECK.out.versions)

//
// MODULE: Run FastQC
//
FASTQC (
INPUT_CHECK.out.reads
ch_input
)
ch_versions = ch_versions.mix(FASTQC.out.versions.first())

Expand Down

0 comments on commit c623783

Please sign in to comment.