I am in the process of adding a second module, but...
# modules
r
I am in the process of adding a second module, but when I push I keep getting errors about a different snapshot. I don't think I understand how the snapshot things works on github. Even if I do:
nf-test test --tag coptr/map --profile conda --update-snapshot
and do it again as
nf-test test --tag coptr/map --profile conda
it works fine locally. I also do this:
nf-test test --tag coptr/map --profile conda
and it works fine, but when I push it I get an error in term of different snapshots: "java.lang.RuntimeException: Different Snapshot". Any suggestions?
l
The idea is that you create the snapshot locally using
nf-core modules test coptr/map
(assuming no snapshot file exists). The test will then run and produce a snapshot file that contains the hashes of the outputs of your module. It will then automatically run a second time to check if it always gives you the same hashes (which means you script is deterministic and produces the same output each time). The snapshot file is then commited to GitHub and the CI will do the same tests and will also check if the hashes agree with the ones you created locally. If. thats the case, the tests succeeds.
I just checked the CI results and it seems like Conda, Singularity and Docker give completely different hashes for
test_1.bam
, which usually is a indicator, that your method is probably not deterministic (gives not the same output with same input). Does the testing locally finish without errors?
j
I think there can be problems with the header being different as they can embed the path of the aligner binary (causing the problem Leon says)
Fortunately there is a plugin for that :) https://nvnieuwk.github.io/nft-bam/latest/
👍 1
➕ 1
r
Thanks!! I am testing the plugin now.
Unfortunately I spoke too soon, after looking at this carefully, the issue is that the coptr map program puts the reads in a different order when it's paired end, so I just have it check if the first read is the same. I tried using getStatistics(include:["readCount"]) to compare the number of reads but this gives me an error:
Copy code
Test [51b76c12] 'sarscov2 - paired end' groovy.lang.MissingMethodException: No signature of method: vnieuwk.nf.test.bam.AlignmentFile.getStatistics() is applicable for argument types: (LinkedHashMap) values: [[include:[readCount]]]
but I can't find examples of getStatistics on nf-core modules
j
Any ideas @Nicolas Vannieuwkerke?
n
Yeah the method is very new, can you show me the PR of the code snippet where you use it?
r
Hi @Nicolas Vannieuwkerke, so it's on the PR yet as it's not working. Should I push it even if it breaks?
n
Yeah pushing to a PR doesn't break the original repo code so you can safely push it 🙂 can you send me the link to that PR when you pushed the changes there?
r
Will do!!
Hi @Nicolas Vannieuwkerke, ok, this is the PR in question: https://github.com/nf-core/modules/pull/6935 Please check the map/tests/main.nf.test test file, the first test (single end) is the one that has the getStatistics(include:["readCount"]) part which is not correct
n
I see the issue! You need to update the
nft-bam
version in the
nf-test.config
file in the root of the repo, creating a config on the module level will not work
r
Hi @Nicolas Vannieuwkerke, thank you. I just did some updating and testing, now I get a different error:
Copy code
Test [d3acd541] 'sarscov2 - single end test' java.lang.RuntimeException: A snapshot with id 'sarscov2 - single end test' already exists. Snapshot ids have to be unique, and a test can only have one unnamed snapshot.
If I remove the assertion
{ assert snapshot(process.out.bam.collect{bam(it[1]).getStatistics(include:["readCount"])}).match() }
it works fine, so not sure what is happening. The reason that I want this assertion is that the program jumbles the reads every time, but I can at least know that each time is the same number of reads. Thank you!
n
I posted a fix in the PR 🙂
✅ 1
r
Thanks @Nicolas Vannieuwkerke, that worked!!
n
Awesome, glad to hear that