Skip to content

Commit

Permalink
refactor: Use fromSamplesheet instead of input_check
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundmiller committed Aug 25, 2023
1 parent 16007cf commit 7910cc1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 98 deletions.
3 changes: 2 additions & 1 deletion 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
32 changes: 0 additions & 32 deletions modules/local/samplesheet_check.nf

This file was deleted.

44 changes: 0 additions & 44 deletions subworkflows/local/input_check.nf

This file was deleted.

44 changes: 23 additions & 21 deletions workflows/methylseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

include { paramsSummaryLog; paramsSummaryMap } from 'plugin/nf-validation'
include { paramsSummaryLog; paramsSummaryMap; fromSamplesheet } from 'plugin/nf-validation'

def logo = NfcoreTemplate.logo(workflow, params.monochrome_logs)
def citation = '\n' + WorkflowMain.citation(workflow) + '\n'
Expand Down Expand Up @@ -35,7 +35,6 @@ ch_multiqc_custom_methods_description = params.multiqc_methods_description ? fil
//
// SUBWORKFLOWS: Consisting of a mix of local and nf-core/modules
//
include { INPUT_CHECK } from '../subworkflows/local/input_check'
include { PREPARE_GENOME } from '../subworkflows/local/prepare_genome'

// Aligner: bismark or bismark_hisat
Expand Down Expand Up @@ -84,31 +83,34 @@ workflow METHYLSEQ {
ch_versions = ch_versions.mix(PREPARE_GENOME.out.versions)

//
// SUBWORKFLOW: Read in samplesheet, validate and stage input files
// Create input channel from input file provided through params.input
//
INPUT_CHECK (
file(params.input)
)
.reads
.map {
meta, fastq ->
Channel
.fromSamplesheet("input")
.map {
meta, fastq_1, fastq_2 ->
if (!fastq_2) {
return [ meta + [ single_end:true ], [ fastq_1 ] ]
} else {
return [ meta + [ single_end:false ], [ fastq_1, fastq_2 ] ]
}
}
.groupTuple()
.map {
meta, fastq ->
def meta_clone = meta.clone()
meta_clone.id = meta_clone.id.split('_')[0..-2].join('_')
[ meta_clone, fastq ]
}
.groupTuple(by: [0])
.branch {
meta, fastq ->
}
.groupTuple(by: [0])
.branch {
meta, fastq ->
single: fastq.size() == 1
return [ meta, fastq.flatten() ]
return [ meta, fastq.flatten() ]
multiple: fastq.size() > 1
return [ meta, fastq.flatten() ]
}
.set { ch_fastq }
ch_versions = ch_versions.mix(INPUT_CHECK.out.versions)
// TODO: OPTIONAL, you can use nf-validation plugin to create an input channel from the samplesheet with Channel.fromSamplesheet("input")
// See the documentation https://nextflow-io.github.io/nf-validation/samplesheets/fromSamplesheet/
// ! There is currently no tooling to help you write a sample sheet schema
return [ meta, fastq.flatten() ]
}
.set { ch_fastq }

//
// MODULE: Concatenate FastQ files from same sample if required
Expand Down

0 comments on commit 7910cc1

Please sign in to comment.