Skip to content

Commit d169eef

Browse files
authored
Merge pull request #2 from mahesh-panchal/input_workflow
Input workflow
2 parents f2f19c7 + 28e0137 commit d169eef

File tree

5 files changed

+47
-19
lines changed

5 files changed

+47
-19
lines changed

assets/samplesheet.csv

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
sample,fastq_1,fastq_2
2-
SAMPLE_PAIRED_END,/path/to/fastq/files/AEG588A1_S1_L002_R1_001.fastq.gz,/path/to/fastq/files/AEG588A1_S1_L002_R2_001.fastq.gz
3-
SAMPLE_SINGLE_END,/path/to/fastq/files/AEG588A4_S4_L003_R1_001.fastq.gz,
1+
sample,lane,project,fastq_1,fastq_2,rundir
2+
SAMPLE_PAIRED_END,1,P001,/path/to/fastq/files/AEG588A1_S1_L002_R1_001.fastq.gz,/path/to/fastq/files/AEG588A1_S1_L002_R2_001.fastq.gz,/path/to/rundir
3+
SAMPLE_SINGLE_END,2,P002,/path/to/fastq/files/AEG588A4_S4_L003_R1_001.fastq.gz,,/path/to/rundir

assets/schema_input.json

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,19 @@
1111
"type": "string",
1212
"pattern": "^\\S+$",
1313
"errorMessage": "Sample name must be provided and cannot contain spaces",
14-
"meta": ["id"]
14+
"meta": ["sample"]
15+
},
16+
"lane": {
17+
"type": "integer",
18+
"pattern": "^\\d+$",
19+
"errorMessage": "Lane ID must be a number",
20+
"meta": ["lane"]
21+
},
22+
"project": {
23+
"type": "string",
24+
"pattern": "^\\S+$",
25+
"errorMessage": "Project ID cannot contain spaces",
26+
"meta": ["project"]
1527
},
1628
"fastq_1": {
1729
"type": "string",
@@ -26,8 +38,18 @@
2638
"exists": true,
2739
"pattern": "^\\S+\\.f(ast)?q\\.gz$",
2840
"errorMessage": "FastQ file for reads 2 cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'"
41+
},
42+
"rundir": {
43+
"type": "string",
44+
"format": "path",
45+
"exists": true,
46+
"errorMessage": "Run directory must be a path",
47+
"meta": ["rundir"]
2948
}
3049
},
31-
"required": ["sample", "fastq_1"]
50+
"required": ["sample", "lane", "fastq_1"],
51+
"dependentRequired": {
52+
"fastq_2": ["fastq_1"]
53+
}
3254
}
3355
}

conf/test.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ params {
2222
// Input data
2323
// TODO nf-core: Specify the paths to your test data on nf-core/test-datasets
2424
// TODO nf-core: Give any required params for the test so that command line flags are not needed
25-
input = 'https://raw.githubusercontent.com/nf-core/test-datasets/viralrecon/samplesheet/samplesheet_test_illumina_amplicon.csv'
25+
input = 'https://raw.githubusercontent.com/KarNair/test-datasets/seqinspector/testdata/MiSeq/samplesheet.csv'
2626

2727
// Genome references
2828
genome = 'R64-1-1'

main.nf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ nextflow.enable.dsl = 2
1717
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1818
*/
1919

20-
include { SEQINSPECTOR } from './workflows/seqinspector'
20+
include { SEQINSPECTOR } from './workflows/seqinspector'
2121
include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_seqinspector_pipeline'
2222
include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_seqinspector_pipeline'
2323

@@ -32,7 +32,7 @@ include { getGenomeAttribute } from './subworkflows/local/utils_nfcore_seqi
3232
// TODO nf-core: Remove this line if you don't need a FASTA file
3333
// This is an example of how to use getGenomeAttribute() to fetch parameters
3434
// from igenomes.config using `--genome`
35-
params.fasta = getGenomeAttribute('fasta')
35+
// params.fasta = getGenomeAttribute('fasta')
3636

3737
/*
3838
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

subworkflows/local/utils_nfcore_seqinspector_pipeline/main.nf

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ workflow PIPELINE_INITIALISATION {
5757
pre_help_text = nfCoreLogo(monochrome_logs)
5858
post_help_text = '\n' + workflowCitation() + '\n' + dashedLine(monochrome_logs)
5959
def String workflow_command = "nextflow run ${workflow.manifest.name} -profile <docker/singularity/.../institute> --input samplesheet.csv --outdir <OUTDIR>"
60-
UTILS_NFVALIDATION_PLUGIN (
60+
UTILS_NFVALIDATION_PLUGIN ( // Validates parameters against $projectDir/nextflow_schema.json
6161
help,
6262
workflow_command,
6363
pre_help_text,
@@ -75,29 +75,33 @@ workflow PIPELINE_INITIALISATION {
7575
//
7676
// Custom validation for pipeline parameters
7777
//
78-
validateInputParameters()
78+
validateInputParameters() // Runs additional validation that is not done by $projectDir/nextflow_schema.json
7979

8080
//
8181
// Create channel from input file provided through params.input
8282
//
8383
Channel
84-
.fromSamplesheet("input")
84+
.fromSamplesheet("input") // Validates samplesheet against $projectDir/assets/schema_input.json. Path to validation schema is defined by $projectDir/nextflow_schema.json
8585
.map {
8686
meta, fastq_1, fastq_2 ->
87+
def id_string = "${meta.sample}_${meta.project ?: "ungrouped"}_${meta.lane}"
88+
def updated_meta = meta + [ id: id_string ]
8789
if (!fastq_2) {
88-
return [ meta.id, meta + [ single_end:true ], [ fastq_1 ] ]
90+
return [ updated_meta.id, updated_meta + [ single_end:true ], [ fastq_1 ] ]
8991
} else {
90-
return [ meta.id, meta + [ single_end:false ], [ fastq_1, fastq_2 ] ]
92+
return [ updated_meta.id, updated_meta + [ single_end:false ], [ fastq_1, fastq_2 ] ]
9193
}
9294
}
9395
.groupTuple()
9496
.map {
95-
validateInputSamplesheet(it)
96-
}
97-
.map {
98-
meta, fastqs ->
99-
return [ meta, fastqs.flatten() ]
97+
validateInputSamplesheet(it) // Applies additional group validation checks that schema_input.json cannot do.
10098
}
99+
.transpose() // Replace the map below
100+
// .map {
101+
// meta, fastqs ->
102+
// return [ meta, fastqs.flatten() ]
103+
// }
104+
.view()
101105
.set { ch_samplesheet }
102106

103107
emit:
@@ -151,7 +155,9 @@ workflow PIPELINE_COMPLETION {
151155
// Check and validate pipeline parameters
152156
//
153157
def validateInputParameters() {
154-
genomeExistsError()
158+
// genomeExistsError()
159+
160+
// TODO: Add code to further validate pipeline parameters here
155161
}
156162

157163
//

0 commit comments

Comments
 (0)