Repository navigation
Fix overflow in Tiara bin domain classification softmax (large eukaryotic bins labelled prokarya) - #1140
Conversation
Fix overflow in Tiara bin domain classification softmax Use log-sum-exp so large eukaryotic bins are no longer labelled prokarya. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
Thank you for this! Please feel free to add yourself to the Credits section of the Readme, if you would like: https://github.com/nf-core/mag/blob/dev/README.md#credits I have allowed the CI tests to run for this PR. You can skip this next time (and get permission to merge) by joining the nf-core GitHub organisation, see the documentation for more details: https://nf-co.re/docs/contributing/how-to-contribute#nf-core-slack-and-github Once the tests pass, we can merge this fix. |
❌ nf-test failed with latest Nextflow versionNote Tests with Nextflow's latest version failed but it will not cause a CI workflow failure.
See the full run for details. |
|
Hi @Farhana-Anika - the tests have failed as the Tiara summary file has changed. Could you please update the failing test snapshot? |
|
Thanks @prototaxites! I’ve updated the |
Closes #1139
bin/domain_classification.Rapplied a softmax to summed per-contig Tiara probabilities using plainexp(). For bins with many contigs the sums exceed ~709,exp()overflows toInf, and the probabilities becomeNaN;which.max()then skips theNaNand falls back to the first class (prokarya). This PR uses the standard log-sum-exp form (subtract the row maximum beforeexp()), which is mathematically identical but cannot overflow.eukarya.Tested on a 2-sample pilot (MEGAHIT + metaSPAdes; MetaBAT2, CONCOCT, SemiBin2): re-running the patched script on the 12 pilot
TIARA_CLASSIFYinputs, all 15 bins previously at0 NA 0 0changed fromprokaryatoeukarya(4.4–42.5 Mb; all Chlorophyta by CAT, 4–51% complete by BUSCOchlorophyta_odb10), and the other 94 bins kept their classification. This included two Nitrosomonas bins confirmed by GTDB-Tk, which correctly stayedprokarya.Acknowledgement
This bug was identified and the fix developed with the assistance of Claude Opus 5.5 (Anthropic), an AI model. I reviewed the change and tested it on our pilot data (see above).
PR checklist
nf-core pipelines lint).nextflow run . -profile test,docker --outdir <OUTDIR>).nextflow run . -profile debug,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).