- Notifications
You must be signed in to change notification settings - Fork 55
Refactor - 3 #751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Refactor - 3 #751
Conversation
|
| @nf-core-bot fix linting |
fellen31 left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean!
| .map { it -> | ||
| def meta = it[0] | ||
| def vcf = it[1] | ||
| def tbi = it[2] | ||
| | ||
| def hasRohCall = (it.size() == 6) | ||
| | ||
| if (hasRohCall) { | ||
| def rohcall = it[3] | ||
| def rohcallindex = it[4] | ||
| def interval = it[5] | ||
| return [ | ||
| meta + [prefix: meta.id + "_rhocall", scatterid: interval.baseName], | ||
| rohcall, | ||
| rohcallindex, | ||
| interval | ||
| ] | ||
| } else { | ||
| return [it[0] + [prefix: it[0].id + "_rhocall", scatterid:it[5].baseName], it[3], it[4], it[5]] | ||
| def interval = it[4] | ||
| return [ | ||
| meta + [prefix: meta.id, scatterid: interval.baseName], | ||
| vcf, | ||
| tbi, | ||
| interval | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is "it" really accepted here? Thought you would need .map { meta, vcf, tbi ...etc }. But difficult (impossible?) if there are variable number of elements. Is there any other way it could be written?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, parser seemed to accept "it". I expanded this block because it makes it clear what's happening here.
Nextflow doesn't support the spread operator for destructuring parameters in closures so it is not possible to expand the items when there are variable number of items. So something like {meta, vcf, tbi, *rest -> ....} doesn't work. Other solutions would probably add unnecessary logic which I don't want. 😅
| .set { ch_for_mix } | ||
| | ||
| ch_for_mix.merged.mix(ch_for_mix.cadd) | ||
| ch_for_mix.vcfanno.mix(ch_for_mix.cadd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are we mixing in ch_for_mix? 😄 Perhaps it could have another name.
PR checklist
Fix issues missed in the previous 2 PRs.
nf-core pipelines lint).nextflow run . -profile test,docker --outdir <OUTDIR>).nextflow run . -profile test_singleton,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).