Hi everyone! Hope you’re all doing great. I’m curr...
# modules
r
Hi everyone! Hope you’re all doing great. I’m currently writing a module for CIRI2. The input/output channels are ready, but I’ve hit a roadblock with writing the
nf-test
. CIRI2 strictly requires a SAM file generated by BWA-MEM using the
-T 19
flag. Since the
nf-core/test-datasets
repo doesn't host raw, uncompressed SAM files for Homo sapiens, I'm weighing my options according to nf-core guidelines: 1. Chain modules in `setup`: If I run
BWA_MEM
in the setup block, I will also need to chain
BWA_INDEX
before it since pre-computed BWA index directories aren't available for the human test genome. This feels quite heavy for a single module unit test. 2. Local asset: Should I just include a tiny, heavily-truncated mock SAM file directly inside the module's
tests/assets/
directory? Has anyone encountered a similar tool dependency issue during testing? What is the recommended or preferred approach by maintainers in this scenario? Any guidance would be highly appreciated. Thanks in advance!
s
A few options: 1. Add a suitable file to test-datasets. 2. I think there should be a bwa index somewhere? Let me see.
mmm, interesting, the only modules that I can find (bamcmp and umitools/group) both regenerate the index
I would say that making the sam file for test-datasets would be the easiest.
👍 1
r
Thanks for the tip Simon! Where is the pre-computed BWA index located in
test-datasets
? I couldn't find a
bwa/
directory under
homo_sapiens/genome/
.
Thanks for the pointers @Simon Pearce! I saw the mention of the
delete_me
folder in the README for temporary or niche datasets. Since uncompressed SAM files and tool-specific BWA indexes are quite specific to CIRI2 module, would it be safest/preferred for me to upload these to the
delete_me
folder, or should I place them directly into the standard
genomics/homo_sapiens/
directory structure? Let me know what works best!
s
Yeah, I don't think it exists, at least if it does there is no example using it 😐
No, please don't put anything in
delete_me
, it is a terrible place
Do you just need a sam file rather than a bam file?
r
Yes. So CIRI2 actually requires unsorted SAM file, generated by bwa-mem (using -T 19 option). CIRI2 doesn't work on bam.
s
-T INT Don’t output alignment with score lower than INT. This option only affects output. [30]
r
Here is a complete documentation of CIRI2 for reference: ciri-cookbook.readthedocs.io/en/latest/… Can I use the chr1 fasta to build the BWA index and SAM file, and then submit a PR for these datasets to the
test-datasets
repo? Would that be acceptable by nf-core?
s
I don't think you need the bwa index at all
I'm not convinced you need the -T either
oh, it needs the index for the tool?
image.png
ok, so it works on bam files, and it works with just the genome fasta
so you can test it with the current files
r
It seems like the tool output zero circular RNAs. The documentation explicitly states to use sam file. And before running CIRI2, bwa-mem should be run with -T 19 flag. And bwa-mem requires bwa index files.
Found another way to test CIRI2 module. Since the standard
test-datasets
are heavily downsampled and yield 0 circular RNAs, I was wondering if I could use the official CIRI2 sample dataset instead? It includes a tiny, pre-aligned
test.sam
and a matching
chr1.fa
that are guaranteed to output circular RNAs, which would allow me to write solid
nf-test
assertions against non-empty files. If that works, would it be okay if I submit a PR to add both the
.sam
and
.fa
files to the
test-datasets
repo simultaneously?
m
Yes
s
In the nf-core modules we are testing that the tool is plumbed in correctly. We are not trying to test that the tool works properly.
sam and bam are the same data, just one is compressed so it is considerably smaller than the other
the -T filter is entirely optional here, it will just mean that there is less rubbish for the tool to go through
But provided the files are small, you can add them to test-datasets if you really wish.
r
Thank you @Simon Pearce and @Matthieu Muffato for helping me work through this! I’m going to look into how I can make this testing workflow smoother. Also, just a quick heads-up: I noticed the link to the test-dataset guidelines in the documentation is currently broken, so I wanted to pass that along!
s
What link?
r
s
and where did the link come from?
r
github.com/nf-core/test-datasets/blob/…/USE_EXISTING_DATA.md From here. In test-datasets repo. Check your proposed test data follows the guidelines
@Simon Pearce I shared the wrong link yesterday. github.com/nf-core/test-datasets/blob/…/ADD_NEW_DATA.md Here the guidelines hyperlink for test data is broken. Can you please check for this issue.
s
Could you please make an issue on https://github.com/nf-core/website/issues
r
Sure. Here's the issue link for reference: github.com/nf-core/website/issues/4306
🙌 1
Hi @Simon Pearce! Regarding this PR: github.com/nf-core/modules/pull/12224 I ran CIRI2 on the author's official test dataset in its native SAM format, and it successfully identified 6 circular RNAs. When converting that exact same file to BAM (preserving all headers and flags via
samtools view -h -b
), CIRI2 ran without throwing a terminal error, but returned 0 circular RNAs.
CIRI2.pl
is a Perl script designed to parse plain text CIGAR strings, SAM headers, and BWA-MEM alignment tags. When given a binary BAM file, the Perl script reads compressed binary stream data instead of text. It doesn't crash, but it fails to recognize any reads or alignment tags, silently yielding zero candidate circular RNAs. If we force the module to take a BAM file directly to satisfy channel format conventions, the module will technically run without error, but anyone running this module on real-world sample data will receive zero predictions, even when circular RNAs are present. Is the primary goal of an nf-core module just to execute cleanly without crashing, or is it to ensure the underlying tool accurately detects real biological signals for users? Looking forward to your review. Thanks!
s
Ok, fair enough. Then you probably want to incorporate a check that the input file is actually a sam file
frankly, if the code is that shoddy, you shouldn't be using it
m
@razmia.sabahat. Could you add samtools to the container, and pipe
samtools view -h
into CIRI2 if the input is BAM/CRAM ? Then module users wouldn’t have to convert their file to SAM before running the module. It’s rare for tools to require SAM. Forcing a conversion would increase disk usage quite notably
r
That's a great idea! I wasn't sure if we were allowed to pipe another tool like
samtools
inside a single nf-core module, which is why I didn't implement that in the first place. It gives us the best of both worlds by keeping the channel inputs flexible while avoiding huge SAM files on disk. I'll update the container to include
samtools
and add the streaming logic into the script block. Thanks!
@Matthieu Muffato Tested process substitution (
<(...)
) to avoid materializing a SAM file but it fails, because CIRI2.pl does two full passes over the input (see its own log: 'First scanning' / 'Second scanning'), which requires a seekable file, not a pipe. I've kept the conversion but added a cleanup step (
rm
after CIRI2 runs) so the intermediate SAM doesn't persist in the final work/output directory, minimizing the disk footprint while still working with the tool's actual requirements.
m
oh, no, that’s a pity. I think doing the conversion in the module and deleting the SAM file at the end is a good compromise
👍 1