"change_name" process and configuration of output file name#177
Merged
Conversation
- CHANGE_NAME is always called and is the only place where the published file name is set - All downstream modules use the renamed BAMs as input and copy its name to the output
We don't publish anything from CHANGE_NAME itself. Instead we make SAMTOOLS_INDEX publish its input file.
Contributor
|
Warning Newer version of the nf-core template is available. Your pipeline is using an old version of the nf-core template: 3.2.1. For more documentation on how to update your pipeline, please see the nf-core documentation and Synchronisation documentation. |
Base automatically changed from
hhoang-read-coverage_review
to
hhoang-read-coverage
July 4, 2025 09:39
Contributor
|
Hi @muffato, I have added a commit to revert ch_for_stats (both file and index) for statistics processes as we discussed. I also edited the condition in |
Contributor
|
@sanger-tolsoft fix linting |
sainsachiko
approved these changes
Jul 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I found it a bit confusing to have so many channels of BAM files in
subworkflows/local/convert_stats.nf, and also the fact that we define the name of the output files multiple times inconf/modules.config.The core of my proposal is to pass all BAM files through
change_name, define the output name there just once, and then to make all subsequent steps use something likeinput.baseNameas their "task prefix".To avoid having to make a channel that combines BAM files with the input fasta, it can simply be passed as an extra input channel in
change_name.The channels used in the module are:
bam: list of input BAM filesch_bams_for_renaming: list of BAM files, now compressed withcrumbleif requested. ready to go throughchange_namech_renamed_bams. Same BAM files asch_bams_for_renamingbut now renamed.ch_renamed_bamsis used in the conversion to CRAM,blobtk_depthand all the samtools *stats processesCHANGE_NAME.out.file. This is becauseCHANGE_NAME.out.fileis just[meta, bam]whereas as isch_renamed_bamsis[meta, bam, []]. Maybe you'd want to introduce another variable name to make the distinction clearer ? Or do amapfromch_renamed_bamson the fly ?I hoped publishing the files would be trivial but it wasn't.
Because
CHANGE_NAMEis now used for everything, it'll make a BAM file even whenoutfmtis set tocram. I therefore fully removedCHANGE_NAMEfrom the publishing rule with the objective of doing something like this:SAMTOOLS_CRAMSAMTOOLS_INDEXThe problems were that:
SAMTOOLS_CRAMis an instance ofsamtools/view, which puts the input BAM file in an output channel. So I had to add((task.process =~ /SAMTOOLS_CRAM/) && filename.endsWith(".bam"))to exclude itSAMTOOLS_INDEXto output the input file as well.So overall, I think it's maybe a bit simpler in terms of channels and processes in the sub-workflow, but publishing the output files is more complex and maybe harder to maintain.
What do you think ? Is it worth it at all ?
PR checklist
nf-core lint).nextflow run . -profile test,docker --outdir <OUTDIR>).docs/usage.mdis updated.docs/output.mdis updated.CHANGELOG.mdis updated.README.mdis updated (including new tool citations and authors/contributors).