Jim Downie
09/08/2026, 8:35 AM["view", "sort"] and it will construct a command that pipes the output of samtools view into samtools sort and then write an output BAM file, saving space on intermediate outputs.
Currently I've written this so that it also supports samtools fasta and samtools fastq as outputs, so you could pass in some BAMs, process them, and get the reads. But this adds quite a lot of complexity to the module, which will make maintenance more difficult. Is this something that folk would generally want to use in a module like this, or would you be happy to just fire the output into a separate samtools/fastq process if needed?
github.com/nf-core/modules/pull/11550Niklas Schandry
09/08/2026, 8:55 AMoutfmt) that can be bam fastq or fasta with e.g. bam as a default, to make this a bit more explicit, and also a bit more obvious?Jim Downie
09/08/2026, 9:09 AMsamtools stats ) are already not supported, with the mind that such tools should be run separately on the written file. This vastly simplifies the logic as a lot of samtools tools do not have a completely consistent interface.
Removing fast{a,q} would follow this logic as these also "non-standard" end-points, and could not be included in the middle of a pipeline chain. I included them for the moment as they seemed they would be used more frequently and hence be worth the complexity, though.
> Have you considered having another input (e.g. outfmt) that can be bam fastq or fasta with e.g. bam as a default, to make this a bit more explicit, and also a bit more obvious?
None of the other samtools modules operate this way, which would be inconsistent IMOSimon Pearce
09/08/2026, 9:30 AMNone of the other samtools modules operate this way, which would be inconsistent IMO (edited)Well, samtools sort has index type for instance, which is a value channel to determine the index type if present. I'd happily make them some of them take an input channel that is
bam/cram/sam to determine the output format.
But I don't think that you need to be worried about consistency with other modules with this one in particularSimon Pearce
09/08/2026, 9:30 AMNiklas Schandry
09/08/2026, 9:47 AMRemoving fast{a,q} would follow this logic as these also "non-standard" end-points, and could not be included in the middle of a pipeline chain. I included them for the moment as they seemed they would be used more frequently and hence be worth the complexity, though.Yes. Given that they cannot be part of the pipeline anyway, I thought controlling the output/endpoint in a different way might be clearer. This is mainly driven by my assumption that I would be annoyed by a module that allows me to construct a samtools pipeline, but then still needs to go into another samtools tool / module to format.
Niklas Schandry
09/08/2026, 9:53 AMfastq or fasta are used as an intermediate command in the pipeleine, which as I understand would result in a broken pipelineJim Downie
09/08/2026, 9:54 AMNiklas Schandry
09/08/2026, 10:00 AMJim Downie
09/08/2026, 10:01 AMJim Downie
09/08/2026, 10:02 AMNiklas Schandry
09/08/2026, 10:03 AMfastq or fasta as valid commands should simplify the get_file_output section?Jim Downie
09/08/2026, 10:04 AMNiklas Schandry
09/10/2026, 12:52 PM$command ? This would require the module user to craft the correct command, but I would argue that someone who is able to correctly piece together samtools subcommands into a pipechain is probably also able to add in -@ ${task.cpu} ?Jim Downie
09/11/2026, 8:18 AMNiklas Schandry
09/11/2026, 8:20 AMMatthieu Muffato
09/11/2026, 8:21 AMMatthieu Muffato
09/11/2026, 8:22 AMsamtools fasta/q for the outputNiklas Schandry
09/11/2026, 8:25 AMNiklas Schandry
09/11/2026, 8:27 AMNiklas Schandry
09/11/2026, 8:29 AMNiklas Schandry
09/11/2026, 8:36 AMmap of input values and resulting commands. This would not really change much in terms of logic, but would allow you to essentially have a tabular overview of input -> command in the script, i.e. you would do something like commandmap.get(command) for each of the commands?Jim Downie
09/11/2026, 8:39 AMNiklas Schandry
09/11/2026, 8:51 AMcommandmap = [
fasta: "fasta" + "-0 ${prefix}_other.fasta.gz -1 ${prefix}_1.fasta.gz " + (single_end ? "-2 ${prefix}_2.fasta.gz" : "") + "-s ${prefix}_singleton.fasta.gz"
]
and then using commandmap.get("fasta")Niklas Schandry
09/11/2026, 8:52 AMJim Downie
09/11/2026, 8:55 AMNiklas Schandry
09/11/2026, 9:00 AMJim Downie
09/11/2026, 9:01 AMJim Downie
09/11/2026, 9:02 AMNiklas Schandry
09/11/2026, 9:03 AMJim Downie
09/11/2026, 9:03 AMJim Downie
09/11/2026, 9:03 AMNiklas Schandry
09/11/2026, 9:04 AM