Good afternoon everyone, I was wondering what the ...
# mag
j
Good afternoon everyone, I was wondering what the main motivations are for making changes to the mag pipeline, whether they are based on general acceptance, specific user needs, or even the goal of creating the best possible tool !?!? nextflow party😎. I’m currently considering adding a module to improve and facilitate my sediment metagenomics analyses for my master’s thesis, since I have to process a large number of samples. However, I’m unsure if it’s worth going through the effort of modifying the pipeline, especially if it may not be useful for others. I hope my question is clear. Greetings from Portugal!
d
Hi @João Bentes! Glad to hear you're interested in contributing to mag! 😁 In general terms, the development direction is guided by us the mag team. But since this is a community-oriented pipeline, we’re open to new features if they fit within the scope and can be useful for others. And especially if contributors are willing to help with the implementation! In your case, if your module could be broadly applicable (beyond your specific dataset), it’s definitely worth considering. Feel free to tell us more about it!
👍 1
this 1
j
For example,
module to improve and facilitate my sediment metagenomics
this depends how specific hte module is to sediment metagenomics - if it is JUST for that data type, probably not in scope. But if it would be used by multiple areas of metagenomics, we would definitely be open to it
j
I'm doing mostly long-read assemblies, and I was searching through literature and found this module "medaka" that is used to decrease indel errors from nanopore assemblies [https://doi.org/10.1186/s12864-024-10582-x] using a .bam input file, and I was considering using it to polish Flye assemblies. Still have to benchmark it on my own data. I see there is already a module in nf-core mag. Should I integrate it into a pipeline? Another tool that I was looking at is nanomotif, also for long reads [https://github.com/MicrobialDarkMatter/nanomotif?tab=readme-ov-file#documentation], and I think it would be pretty useful in terms of transforming metylation data that comes from nanopore, into giving better MAG results. The interest submodules from this tool are: Bin contamination and Include unbinned contigs. I would take the time and effort to try to implement them in the pipeline, but I wanted to know first the opinion of the mag team!! Cheers!
d
1. Regarding polishing, it makes sense to me. When we were exploring other pipelines for the article, we saw that some of them offer polishing options, which mag doesn’t have yet. The only drawback is that Medaka is very resource-hungry, so we should keep it as an optional step. We will also need to add a new round of mapping to get BAM files containing only the relevant set of reads for each bin. 2. Regarding methylation, it’s a bit more limited in scope because it requires methylation-enriched input (which basically means running basecalling with methylation enabled). It would also require adding two tools: modkit and nanomotif. But to be honest, if this doesn’t belong in mag, I don’t know where it should go, since it is closely related to the assembly itself. Thoughts? @James Fellows Yates @Jim Downie @Daniel Straub
this 1
🙏 1
j
Does Flye not already perform its own polishing? I know metaMDBG does.
d
Yes, it does. But Medaka is more specific, because it uses the same models from the basecalling. ONT in general recommends Flye + Medaka as an standard workflow for genome assembly
j
I think the methylation stuff is a bit niche, but it's not specific to a particular sample type or research area so it would still be valid. But it would be nice to hear from other people's experience in the area to make sure there are no other steps/toosl that would have to be integratied
j
ONT in general recommends Flye + Medaka as an standard workflow for genome assembly
Genome assembly, or metagenome assembly?
d
Afaik Medaka is recommended after Flye assembly. I am not aware of a distinction between genome/metagenome assembly in this regard though.
d
Genome assembly, or metagenome assembly?
Genome, but only because only because ONT doesn't have a public standard workflow for doing metagenomic assembly afaik. But in this case we would treat each bin as an independent genome. BTW, Medaka is a tool from ONT itself.
d
Nanomortif sounds interesting on the first quick look, but that would require several more steps if I understood correctly. I'd say Medaka is more desireable 😉
j
Thank you all for the replies! It's a fact that Medaka is resource-hungry, but I wanted to keep the same source of tools, namely from ONT, so every tool/result is compatible and benchmarked. There is also another tool that is faster and more accurate: metaCONNECT [https://doi.org/10.1371/journal.pone.0313515]. The benchmark is displayed in Fig. 2; however, this is very new and not mature, nor does it have a large community, unlike Medaka or Racon, if justifiable. Methylation is an output from ONT that is not yet used for anything meaningful, but in the future, with the development of more accurate and precise base-calling models, this information will be much more useful and viable for use in metagenomics+ epigenetics, where Nanomotif is the SOTA. Modkit is necessary for the creation of pileup files from the .bam that are input into nanomotif. For Medaka, high coverage is needed, and because of this, it is more suitable for single genomes than for metagenomics with different coverages, unlike metaCONNECT, which is much more suitable for low coverage variations.
j
> Genome, but only because only because ONT doesn't have a public standard workflow for doing metagenomic assembly afaik. But in this case we would treat each bin as an independent genome. BTW, Medaka is a tool from ONT itself. My concern is about what polishing does when you have closely-related strains. If you manage to get independently-resolved strains into separate bins, then mapping reads to each bin is likely to polish out the strain-level differences? And how precise does your mapping need to be to avoid this if you map to the whole genome assembly?
d
My concern is about what polishing does when you have closely-related strains.
This is a valid concern indeed, I guess we could limit that by being more strict in the mapping to select the reads to do the polishing (MQ 40? ). But yeah, unless someone has done this specific experiment to see the consequences, we won't be sure. How is your experience polishing the metagenomes @João Bentes? How much does improve the quality and by which metrics? What is the mean quality of your raw data? Are you somewhat aware of this problem with closely related strains? (Sorry for the bunch of questions, but having more info is always better)
> There is also another tool that is faster and more accurate: metaCONNECT I'm not so sure about this one. From their repo: 15 commits, last one 2 years ago. Seems like that kind of software that was only made for the paper and possibly is some way biased towards the study they published.
j
How much does improve the quality and by which metrics?
This would be something to consider anyway, MAG doesn't currently estimate QV for contigs or assemblies AFAIK?
j
> How is your experience polishing the metagenomes @João Bentes? I’m a master’s student in biotechnology with a background in biochemistry. For my thesis, I’m sequencing marine sediment samples from Ria Formosa using Nanopore. Then I’m assembling MAGs using nf-core/mag. After that, I will be building a curated MAG library and analyzing their functions using tools like MetaTraits, along with taxonomy, BGCs, ARGs, and temporal occurrence across 48 months (24 samples). The goal is to identify patterns, especially potential pathogens relevant to aquaculture. Overall, the objective is to create a curated database with as much information as possible extracted from MAGs, and even from read level taxonomy for the Ria Formosa. I'm in the middle of getting a big assembly done with flye to test with medaka and would like to try that tool metaCONNECT and the nanomotif one, to see if it gives me better results or not, but all of this is in a very early stage. I have a medium amount of data, samples ranging from 3.4 to 90 Gb. At this point, I’m just trying to figure out if it would be interesting or useful to the community to include these tools in the pipeline 🙂
j
Based on the discussion I would say - start by adding Medaka as an optional step, if it's recommended by ONT themselves, and we go from there?
j
I'd be wary unless there's an established metagenome option for this. Example: Difficulties with polishing with Medaka for even simple systems (though an old issue): https://github.com/nanoporetech/medaka/issues/303
👍 1
That's not to say it's a bad thing to consider adding to the pipeline, of course - but I would want to be confident it wasn't going to make assemblies /worse/
👍 1
j
Oh oof
MAybe @João Bentes if you're going to do it anyway, you could report back and see if it makes any different (I would say it should be opt-in anyway_)
👍 1
d
I did a quick search about what could we expect, but didn't find recent sources. The most comprehensive is this one: https://www.nature.com/articles/s41598-020-70491-3, but it's rather old (2020), and ONT raw quality has been increasing a lot lately.
🙏 1
d
So in my own personal use of Medaka in datasets, you can have issues with resolving true taxonomy when using medaka to polish bins. For example, if you have a mixture of closely related Bacillus species, but one MAG is particularly dominant in the sample, core/conserved gene alleles can be polished to represent the dominant allele in the read set. So, after polishing a bunch of my bins were identified as being Bacillus subtilis instead of various other species and subspecies via GTDB-Tk. I think you can reduce this risk with stringent cutoffs for mapping and subsetting reads, but I suspect it may only be worth the efforts in very specific use cases.
👍 1
Methylation aided binning though is a cool application of the technology, but I don't think the tools/workflows are very mature yet on that front? This tool also attempted to assemble and polish bins as well with Medaka, but has not been supported for some time: https://github.com/Hydro3639/NanoPhase
j
Did you map to the whole assembly when you did polishing, or to individual bins?
d
I was doing mapping to individual bins. Perhaps that was a mistake, but thought that would be a better approach.
I was also attempting to subset reads via minimap2 to filter ambiguous reads.
j
I will proceed with getting any result and hopefully a good conclusion @James Fellows Yates, and then I will let you guys know the outcome of this experiment to check if these tools could be useful or not, although deep research of this topic is necessary.
j
I think you’d be better off mapping to the whole assembly for polishing, to make sure you can locate all the places each read could arise from. But there might still be issues with chimerism depending on how the graph is resolved to contigs
j
@Jim Downie do you have any recomendations in which non-obvious metrics should be used to track the efficiency of medaka polishing?
d
That's probably a better approach, I was also attempting to avoid polishing bins unless there was sufficient coverage so likely a more robust and complicated approach would be necessary to actually validate this for Medaka on bins or assemblies before binning.
👍 1
j
@João Bentes For standard single-species assembly we use QV and kmer-completeness via Merqury but I think these are harder to define in a metagenome context!
👍 1
d
Could use a ground truth dataset like the Zymo Mock Community and compare to the reference genomes?
🙌 1
Doesn't necessarily help with the above closely related species issues with polishing, but it's a start. That also may not be as much of an issue with questions asked when sampling diverse environmental samples versus my use case with microbial mixtures.
j
At least one of the Zymo mocks has 5 closely related E. coli strains, I don’t think any assemblers currently can fully separate them. So it wouldn’t be a bad test
j
So, i ran a full mag pipeline on a subsample that had 5 giga base pairs (nanopore sequenced with r10 chem from marine sediment). I got the bin_summary and the assembly (flye). After this, i did medaka, on the already done assembly and then after medaka ran, i inputed the polished assembly into the same mag pipeline, but skiping assembly. I also did the "experimental" metaCONNET (instead of medaka) and followed the same procedure. The results are disapointing, and can be seen in this two figures.
d
Nice work @João Bentes! I guess since you are polishing the whole assembly, Medaka is introducing "cross-MAG corrections". This would explain why contamination goes up, and why you get less MAGs after this. So, polishing the whole assembly is definitively a bad idea.