Add PyPOLCA polishing and use polished assemblies for long-read binning#1048
Conversation
|
Hi @Harshita-sriv, thanks for this! |
|
Thanks for the review. I investigated the CI failures and found that the current implementation does not define ch_polished_assemblies when run_pypolca is not enabled, which causes the test workflows to fail. I'll address this together with the requested migration to the official nf-core PyPOLCA module, removal of debug statements, and formatting fixes |
Merge remote-tracking branch 'upstream/dev' into add-polishing-module
|
Hi @Harshita-sriv! I think this looks fine, but it would be ideal to wire it up in some test. I'll think what would be the best option here and I'll come back to you. |
d4straub
left a comment
There was a problem hiding this comment.
Thanks for the addition, I think thats absolutely desired!
Looks good but I have some concerns with multiple samples.
|
I noticed that the remaining lint failure is due to modifications in The changes were introduced because PyPOLCA was failing during testing, and with the modifications the pipeline completes successfully on the test dataset. Would it be acceptable to keep these modifications to the PyPOLCA module, or would you prefer that the implementation uses the upstream module unchanged and handles the required logic elsewhere? |
Some of the changes are not acceptable: the output block and the versioning must be kept as it was originally. Additionally the line Generally, small changes on nf-core modules can be done and accepted by the linting via https://nf-co.re/docs/nf-core-tools/cli/modules/patch |
|
@d4straub I restored the PyPOLCA module to the upstream nf-core implementation and moved the coassembly-specific logic into the workflow layer ( The remaining CI issue appears to be the Could you advise whether there is an additional module sync/patch step expected for this module? |
|
Looks good. |
dialvarezs
left a comment
There was a problem hiding this comment.
Hi again @Harshita-sriv! This is looking good!
A few last things:
Regarding the testing setup:
I think the best option is to use the longreadonly_alternatives but changing the samplesheet so it uses the hybrid one that has LR and SR data. Then disable SPAdes, SPAdes hybrid and MEGAHIT at least. That way we can get this tested in that profile.
Also I left a comment regarding the pypolca module requiring gzipped input (that will need updating the nf-core module).
|
Hey @dialvarezs I'm still seeing the remaining CI failures, and I haven't been able to reproduce/update the snapshots locally. Since you made the latest changes, could you take a look and let me know whether there's anything else I should update on my side? |
|
Hi @Harshita-sriv, it just needed to regenerate the snapshot and exclude the VCF, because it has the date. |
|
For me this looks good to merge now. Can you give it a final look @d4straub? |
|
Hey, @dialvarezs! |
2056f30 to
5b6382a
Compare
5b6382a to
c92845b
Compare
|
Hey @d4straub and @dialvarezs, I've addressed the review comments, updated MAG to the latest merged PyPOLCA module revision, and regenerated the affected snapshots. The longreadonly_alternatives test passes locally with Docker. I had to rerun the CI jobs after canceling a workflow while investigating a long-running NF-test shard. The CI checks have now been completed successfully. 🎉 Do you think this is good to go? Please say yes! 😄 |
| "Assembly/PYPOLCA/minigut/minigut/minigut.report", | ||
| "Assembly/PYPOLCA/minigut/minigut/minigut.vcf", | ||
| "Assembly/PYPOLCA/minigut/minigut/minigut_pypolca.fasta" |
There was a problem hiding this comment.
I am still a bit concerned here: In this current test, only one assembler (FLYE) is run, produces "Assembly/FLYE/FLYE-minigut.assembly.fasta.gz" and corrected to file "Assembly/PYPOLCA/minigut/minigut/minigut_pypolca.fasta". But if two assemblers are run, FLYE and metaMDBG, both corrected assemblies will be named to "Assembly/PYPOLCA/minigut/minigut/minigut_pypolca.fasta", overwriting each other.
I think the file name must include the assembler. Or did I get something wrong?
There was a problem hiding this comment.
Done with the changes. meta2.assembler came in handy! I've updated the naming to preserve the assembler in the PyPOLCA outputs and regenerated the snapshots.
| ch_polished_assemblies = PYPOLCA_RUN.out.polished | ||
| .map { meta, polished -> | ||
| [meta.id, polished] | ||
| } | ||
| .join( | ||
| ch_longread_assemblies.map { meta, assembly -> | ||
| [meta.id, meta] | ||
| } | ||
| ) | ||
| .map { id, polished, meta -> | ||
| [meta, polished] | ||
| } |
There was a problem hiding this comment.
If there are multiple assemblers enabled, this join could be problematic. We're not using the assembler for the join, so, if we have two assemblies for the same sample, the join will do a cross product, producing 4 outputs instead of 2 (each combination of original assembler + poslished one).
The problem is that pypolca emits the reads meta, not the assembly one, so we can't get that info easily.
In my opinion, we should update the module so it emits the meta from the assembly, not the one from the reads. The output is more closely related to the assembly than the reads, so it makes more sense. If we have that change, we can remove this whole block, because we will have the meta from the assembly here already, and will prevent the issue I'm describing.
There was a problem hiding this comment.
Well, I guess in this case I would just swap the inputs: make the assembly the first, because it's the primary one and leave the reads as the second input.
The other option is using meta2 in the outputs, but I think this feels like a poorer design.
There was a problem hiding this comment.
I've refactored the module to use the assembly metadata as the primary input, updated the MAG integration/tests, and verified the output structure locally. CI is now passing.
8fab6cd to
03b1a05
Compare
d4straub
left a comment
There was a problem hiding this comment.
No further comments, looks perfect now!
That was quite a journey, but a successful one ;)
There was a problem hiding this comment.
Hi @Harshita-sriv!
As a finishing touches I updated some variable names and moved some things around to improve semantics, and also updated output docs.
I think this is good to merge now.
You did a wonderful job! Thanks for contributing this!
Feel free to push the merge button :D
Summary
This PR adds a PyPOLCA polishing module and integrates polished assemblies into the long-read MAG workflow.
Changes
run_pypolcaparameter.ch_polished_assembliesinstead of rawch_longread_assemblies.