Skip to content

Commit c97a597

Browse files
AratzMatthiasZepper
andcommitted
Use samplesheet row in id
Co-authored-by: Matthias Zepper <[email protected]>
1 parent 2e269ec commit c97a597

File tree

1 file changed

+6
-4
lines changed
  • subworkflows/local/utils_nfcore_seqinspector_pipeline

1 file changed

+6
-4
lines changed

subworkflows/local/utils_nfcore_seqinspector_pipeline/main.nf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,21 @@ workflow PIPELINE_INITIALISATION {
8282
//
8383
Channel
8484
.fromSamplesheet("input") // Validates samplesheet against $projectDir/assets/schema_input.json. Path to validation schema is defined by $projectDir/nextflow_schema.json
85+
.toList()
86+
.flatMap { it.withIndex().collect { entry, idx -> entry + "${idx+1}" } }
8587
.map {
86-
meta, fastq_1, fastq_2 ->
88+
meta, fastq_1, fastq_2, idx ->
8789
def tags = meta.tags ? meta.tags.tokenize(":") : []
88-
def updated_meta = meta + [ id:meta.sample, tags:tags ]
90+
def updated_meta = meta + [ id:"${meta.sample}_${idx}", tags:tags ]
8991
if (!fastq_2) {
9092
return [
91-
updated_meta.id + fastq_1.toString().replaceAll('/', '_'),
93+
updated_meta.id,
9294
updated_meta + [ single_end:true ],
9395
[ fastq_1 ]
9496
]
9597
} else {
9698
return [
97-
updated_meta.id + fastq_1.toString().replaceAll('/', '_') + '_' + fastq_2.toString().replaceAll('/', '_'),
99+
updated_meta.id,
98100
updated_meta + [ single_end:false ],
99101
[ fastq_1, fastq_2 ]
100102
]

0 commit comments

Comments
 (0)