sarek icon indicating copy to clipboard operation
sarek copied to clipboard

Fix issue when lane is 0

Open maxulysse opened this issue 5 months ago • 6 comments

close #1923

Issue was that with lane being 0 was interpreted as 0 the integer, not 0 the string, so the if statement was false.

PR checklist

  • [ ] This comment contains a description of changes (with reason).
  • [ ] If you've fixed a bug or added code that should be tested, add tests!
  • [ ] If you've added a new tool - have you followed the pipeline conventions in the contribution docs
  • [ ] If necessary, also make a PR on the nf-core/sarek branch on the nf-core/test-datasets repository.
  • [ ] Make sure your code lints (nf-core pipelines lint).
  • [ ] Ensure the test suite passes (nextflow run . -profile test,docker --outdir <OUTDIR>).
  • [ ] Check for unexpected warnings in debug mode (nextflow run . -profile debug,test,docker --outdir <OUTDIR>).
  • [ ] Usage Documentation in docs/usage.md is updated.
  • [ ] Output Documentation in docs/output.md is updated.
  • [ ] CHANGELOG.md is updated.
  • [ ] README.md is updated (including new tool citations and authors/contributors).

maxulysse avatar Jun 17 '25 09:06 maxulysse

@maxulysse , what is the functional change here?

SPPearce avatar Jun 17 '25 12:06 SPPearce

@maxulysse , what is the functional change here?

Fixing a bug, that is interpreting a 0 not as a string but as an integer, and so an if statement became false because of a 0 value that is not a false value, but a 0 integer and not a 0 string

maxulysse avatar Jun 17 '25 12:06 maxulysse

Currently the check has been modified to if ((meta.lane || meta.lane == 0) && fastq_2) { .... I wonder if there is a simpler, possibly even more robust way. What is the value of meta.lane when it has not been specified in the sample sheet? Would something like if (meta.lane != "" && fastq_2) { ... work?

tdanhorn avatar Jun 17 '25 17:06 tdanhorn

Currently the check has been modified to if ((meta.lane || meta.lane == 0) && fastq_2) { .... I wonder if there is a simpler, possibly even more robust way. What is the value of meta.lane when it has not been specified in the sample sheet? Would something like if (meta.lane != "" && fastq_2) { ... work?

yeah, so meta.lane != "" isn't working as expected unfortunately.

maxulysse avatar Jun 19 '25 15:06 maxulysse

Thanks for trying! I used the empty string ("") as test, because I don't know what the value of a missing lane would be (Groovy is not my native language), but thinking about it, there are probably better tests, maybe meta.lane != null, or would something like ! meta.lane.isEmpty() work?

tdanhorn avatar Jun 20 '25 20:06 tdanhorn

Thanks for trying! I used the empty string ("") as test, because I don't know what the value of a missing lane would be (Groovy is not my native language), but thinking about it, there are probably better tests, maybe meta.lane != null, or would something like ! meta.lane.isEmpty() work?

My main issue is that we rely on the existence of lane quite a lot. So I'm actually more thinking about a refactor of this whole logic

maxulysse avatar Jun 23 '25 07:06 maxulysse

Replaced by #1935

maxulysse avatar Jul 04 '25 12:07 maxulysse