Hi everyone, I have a question about the `BIOBAMB...
# nostupidquestions
i
Hi everyone, I have a question about the
BIOBAMBAM_BAMMERGE
module and the ext.args directive. I would like to use the module to merge some bam files and ideally get an index for the merged file at the same time. I should be able to specify this using the ext.args directive, so I looked at the bammerge software and its arguments and this the help string:
Copy code
This is biobambam2 version 2.0.185.
biobambam2 is distributed under version 3 of the GNU General Public License.

Key=Value pairs:

I=<[filename]>           : input file, can be set multiple times
SO=<[coordinate]>]       : sort order (coordinate or queryname)
level=<[6]>              : compression settings for output bam file (1=fast,2=2,3=3,4=4,5=5,6=6,7=7,8=8,9=best,10=10,11=11,12=12)
verbose=<[1]>            : print progress report
md5=<[0]>                : create md5 check sum (default: 0)
md5filename=<filename>   : file name for md5 check sum (no checksum is computed if md5filename is unset)
index=<[0]>              : create BAM index (default: 0)
indexfilename=<filename> : file name for BAM index file (no BAM index is produced if indexfilename is unset)
tmpfile=<filename>       : prefix for temporary files, default: create files in current directory
IL=<filename>            : name of file containing input file names
So, if I understand correctly, I would need to write something like the following in my
modules.config
file for this module:
Copy code
withName: 'BIOBAMBAM_BAMMERGE' {
        ext.args   = { 'index=1 indexfilename=[filename]'}
    }
Is that how the ext.args directive works? Is there any good way to set a sensible value for the filename based on what the bam file is called?
✅ 1
s
Probably
Copy code
withName: 'BIOBAMBAM_BAMMERGE' {
        ext.args   = { "index=1 indexfilename=${meta.id}.bam.bai"}
    }
Note that the tests for this module do have a test that includes this: github.com/nf-core/modules/blob/…/nextflow.config
You could update the module to generate the module via a value channel, like samtools sort does: github.com/nf-core/modules/blob/…/main.nf
i
Thank you, I'll try that and see if it works.
Yes that worked exactly as expected, thank you for your help!