Skip to content

Commit

Permalink
fix the case of duplicate files
Browse files Browse the repository at this point in the history
  • Loading branch information
nvnieuwk committed Jul 28, 2023
1 parent 84080d3 commit 21349a9
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 0 deletions.
1 change: 1 addition & 0 deletions assets/samplesheet.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cram,crai
https://github.com/CenterForMedicalGeneticsGhent/nf-cmgg-test-datasets/raw/main/data/genomics/homo_sapiens/illumina/cram/test.cram,https://github.com/CenterForMedicalGeneticsGhent/nf-cmgg-test-datasets/raw/main/data/genomics/homo_sapiens/illumina/cram/test.cram.crai
https://github.com/CenterForMedicalGeneticsGhent/nf-cmgg-test-datasets/raw/main/data/genomics/homo_sapiens/illumina/cram/test2.cram,
https://github.com/CenterForMedicalGeneticsGhent/nf-cmgg-test-datasets/raw/main/data/genomics/homo_sapiens/illumina/cram/test.cram,
5 changes: 5 additions & 0 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
"installed_by": ["modules"],
"patch": "modules/nf-core/samtools/index/samtools-index.diff"
},
"samtools/merge": {
"branch": "master",
"git_sha": "0460d316170f75f323111b4a2c0a2989f0c32013",
"installed_by": ["modules"]
},
"tabix/bgzip": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
Expand Down
56 changes: 56 additions & 0 deletions modules/nf-core/samtools/merge/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 73 additions & 0 deletions modules/nf-core/samtools/merge/meta.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions subworkflows/local/prep_alignments/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Prepare the alignment files
//

include { SAMTOOLS_MERGE } from '../../../modules/nf-core/samtools/merge/main'
include { SAMTOOLS_INDEX } from '../../../modules/nf-core/samtools/index/main'
include { SAMTOOLS_CONVERT } from '../../../modules/nf-core/samtools/convert/main'

Expand All @@ -17,6 +18,24 @@ workflow PREP_ALIGNMENTS {
ch_versions = Channel.empty()

ch_cram
.groupTuple() // No size needed here because it cannot create a bottleneck
.branch { meta, cram, crai ->
multiple: cram.size() > 1
return [ meta, cram ]
single: cram.size() == 1
return [ meta, cram[0], crai[0] ]
}
.set { ch_merge_input}

SAMTOOLS_MERGE(
ch_merge_input.multiple,
ch_fasta,
ch_fai
)
ch_versions = ch_versions.mix(SAMTOOLS_MERGE.out.versions.first())

SAMTOOLS_MERGE.out.bam.map { it + [[]] }
.mix(ch_merge_input.single)
.branch { meta, cram, crai ->
extension = cram.extension
cram: extension == "cram"
Expand All @@ -36,6 +55,7 @@ workflow PREP_ALIGNMENTS {
.branch { meta, bam, bai ->
index: bai
no_index: !bai
return [ meta, bam ]
}
.set { ch_index_input }

Expand Down

0 comments on commit 21349a9

Please sign in to comment.