Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add handling of output_bam param #316

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ process {

// Files to be used for pretext, likely to be deleted once the hic workflow is complete.
// .bed, .hr.pretext, .lr.pretext, needs centromere
withName: 'REFORMAT_INTERSECT|SEQTK_CUTN|GAP_LENGTH|PRETEXT_INGEST_HIRES|PRETEXT_INGEST_SNDRD|COOLER_ZOOMIFY|COV_FOLDER|UCSC_BEDGRAPHTOBIGWIG|BED2BW_NORMAL|BED2BW_AVGCOV|EXTRACT_TELO|JUICER_TOOLS_PRE|SNAPSHOT_SRES|PRETEXT_GRAPH' {
withName: 'REFORMAT_INTERSECT|SEQTK_CUTN|GAP_LENGTH|PRETEXT_INGEST_HIRES|PRETEXT_INGEST_SNDRD|COOLER_ZOOMIFY|COV_FOLDER|UCSC_BEDGRAPHTOBIGWIG|BED2BW_NORMAL|BED2BW_AVGCOV|EXTRACT_TELO|JUICER_TOOLS_PRE|SNAPSHOT_SRES|PRETEXT_GRAPH|SAMTOOLS_MERGE_OUTPUT_BAM' {
publishDir = [
path: { "${params.outdir}/hic_files" },
mode: params.publish_dir_mode,
Expand Down Expand Up @@ -366,6 +366,10 @@ process {
ext.prefix = { "${meta.id}_hic_bwamem2_merge" }
}

withName: ".*:.*:HIC_BWAMEM2:SAMTOOLS_MERGE_OUTPUT_BAM" {
ext.prefix = { "${meta.id}_hic_bwamem2_merge" }
}

withName: ".*:.*:HIC_MINIMAP2:CRAM_FILTER_MINIMAP2_FILTER5END_FIXMATE_SORT" {
ext.args = ""
ext.args1 = ""
Expand All @@ -378,6 +382,10 @@ process {
ext.prefix = { "${meta.id}_hic_minimap2_merge" }
}

withName: ".*:.*:HIC_MINIMAP2:SAMTOOLS_MERGE_OUTPUT_BAM" {
ext.prefix = { "${meta.id}_hic_minimap2_merge" }
}

withName: ".*:.*:GENERATE_SORTED_GENOME:GNU_SORT" {
ext.prefix = { "${meta.id}_len_sorted" }
ext.suffix = { "genome" }
Expand Down
19 changes: 17 additions & 2 deletions subworkflows/local/hic_bwamem2.nf
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
//
include { BWAMEM2_INDEX } from '../../modules/nf-core/bwamem2/index/main'
include { CRAM_FILTER_ALIGN_BWAMEM2_FIXMATE_SORT } from '../../modules/local/cram_filter_align_bwamem2_fixmate_sort'
include { SAMTOOLS_MERGE_OUTPUT_BAM } from '../../modules/nf-core/samtools/merge/main'
include { SAMTOOLS_MERGE } from '../../modules/nf-core/samtools/merge/main'

workflow HIC_BWAMEM2 {
take:
reference_tuple // Channel: tuple [ val(meta), path( file ) ]
csv_ch
reference_index
output_bam

main:
ch_versions = Channel.empty()
Expand Down Expand Up @@ -73,21 +75,34 @@ workflow HIC_BWAMEM2 {
],
file
)
}
.branch{
output : it[0].output_bam == "true"
no_output : it[0].output_bam != "true"
}
.set { collected_files_for_merge }

//
// MODULE: MERGE POSITION SORTED BAM FILES AND MARK DUPLICATES
//
SAMTOOLS_MERGE (
collected_files_for_merge,
collected_files_for_merge.no_output,
reference_tuple,
reference_index
)
ch_versions = ch_versions.mix ( SAMTOOLS_MERGE.out.versions.first() )
ch_mergedbam = SAMTOOLS_MERGE.out.bam


SAMTOOLS_MERGE_OUTPUT_BAM (
collected_files_for_merge.output,
reference_tuple,
reference_index
)
ch_versions = ch_versions.mix ( SAMTOOLS_MERGE_OUTPUT_BAM.out.versions.first() )
ch_mergedbam = ch_mergedbam.mix( SAMTOOLS_MERGE_OUTPUT_BAM.out.bam )

emit:
mergedbam = SAMTOOLS_MERGE.out.bam
mergedbam = ch_mergedbam
versions = ch_versions.ifEmpty(null)
}
7 changes: 5 additions & 2 deletions subworkflows/local/hic_mapping.nf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ workflow HIC_MAPPING {
avgcoverage_file // Channel: tuple [ val(meta), path( file ) ]
telo_file // Channel: tuple [ val(meta), path( file ) ]
repeat_density_file // Channel: tuple [ val(meta), path( file ) ]
output_bam // Channel: val
workflow_setting // Channel: val( { RAPID | FULL | RAPID_TOL } )

main:
Expand Down Expand Up @@ -90,7 +91,8 @@ workflow HIC_MAPPING {
HIC_MINIMAP2 (
ch_aligner.minimap2,
GENERATE_CRAM_CSV.out.csv,
reference_index
reference_index,
output_bam
)
ch_versions = ch_versions.mix( HIC_MINIMAP2.out.versions )
mergedbam = HIC_MINIMAP2.out.mergedbam
Expand All @@ -101,7 +103,8 @@ workflow HIC_MAPPING {
HIC_BWAMEM2 (
ch_aligner.bwamem2,
GENERATE_CRAM_CSV.out.csv,
reference_index
reference_index,
output_bam
)
ch_versions = ch_versions.mix( HIC_BWAMEM2.out.versions )
mergedbam = mergedbam.mix(HIC_BWAMEM2.out.mergedbam)
Expand Down
19 changes: 17 additions & 2 deletions subworkflows/local/hic_minimap2.nf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//
include { CRAM_FILTER_MINIMAP2_FILTER5END_FIXMATE_SORT } from '../../modules/local/cram_filter_minimap2_filter5end_fixmate_sort'
include { SAMTOOLS_MERGE } from '../../modules/nf-core/samtools/merge/main'
include { SAMTOOLS_MERGE_OUTPUT_BAM } from '../../modules/nf-core/samtools/merge/main'
include { MINIMAP2_INDEX } from '../../modules/nf-core/minimap2/index/main'


Expand All @@ -19,6 +20,7 @@ workflow HIC_MINIMAP2 {
reference_tuple // Channel: tuple [ val(meta), path( file ) ]
csv_ch
reference_index
output_bam

main:
ch_versions = Channel.empty()
Expand Down Expand Up @@ -83,20 +85,33 @@ workflow HIC_MINIMAP2 {
file
)
}
.branch{
output : it[0].output_bam == "true"
no_output : it[0].output_bam != "true"
}
.set { collected_files_for_merge }

//
// MODULE: MERGE POSITION SORTED BAM FILES AND MARK DUPLICATES
//
SAMTOOLS_MERGE (
collected_files_for_merge,
collected_files_for_merge.no_output,
reference_tuple,
reference_index
)
ch_versions = ch_versions.mix ( SAMTOOLS_MERGE.out.versions.first() )
ch_mergedbam = SAMTOOLS_MERGE.out.bam


SAMTOOLS_MERGE_OUTPUT_BAM (
collected_files_for_merge.output,
reference_tuple,
reference_index
)
ch_versions = ch_versions.mix ( SAMTOOLS_MERGE_OUTPUT_BAM.out.versions.first() )
ch_mergedbam = ch_mergedbam.mix( SAMTOOLS_MERGE_OUTPUT_BAM.out.bam )

emit:
mergedbam = SAMTOOLS_MERGE.out.bam
mergedbam = ch_mergedbam
versions = ch_versions.ifEmpty(null)
}
2 changes: 2 additions & 0 deletions subworkflows/local/yaml_input.nf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ workflow YAML_INPUT {
busco_gene: ( data.busco )
teloseq: ( data.telomere )
map_order: ( data.map_order)
output_bam: ( data.output_bam)
}
.set{ group }

Expand Down Expand Up @@ -217,6 +218,7 @@ workflow YAML_INPUT {
assembly_id = tolid_version
reference_ch = ref_ch
map_order_ch = group.map_order
output_bam_ch = group.output_bam

read_ch = read_ch

Expand Down
1 change: 1 addition & 0 deletions workflows/treeval.nf
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ workflow TREEVAL {
READ_COVERAGE.out.ch_covbw_avg,
TELO_FINDER.out.bedgraph_file,
REPEAT_DENSITY.out.repeat_density,
YAML_INPUT.out.output_bam_ch,
params.entry
)
ch_versions = ch_versions.mix( HIC_MAPPING.out.versions )
Expand Down
1 change: 1 addition & 0 deletions workflows/treeval_rapid.nf
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ workflow TREEVAL_RAPID {
READ_COVERAGE.out.ch_covbw_avg,
TELO_FINDER.out.bedgraph_file,
REPEAT_DENSITY.out.repeat_density,
YAML_INPUT.out.output_bam_ch,
params.entry
)
ch_versions = ch_versions.mix( HIC_MAPPING.out.versions )
Expand Down
1 change: 1 addition & 0 deletions workflows/treeval_rapid_tol.nf
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ workflow TREEVAL_RAPID_TOL {
READ_COVERAGE.out.ch_covbw_avg,
TELO_FINDER.out.bedgraph_file,
REPEAT_DENSITY.out.repeat_density,
YAML_INPUT.out.output_bam_ch,
params.entry
)
ch_versions = ch_versions.mix( HIC_MAPPING.out.versions )
Expand Down
Loading