I've been using MEGAHIT to assemble metagenomes, with particular focus on specific genomic areas.

Sometimes all I get is gene fragments or pathway fragments (eg. if I know that genes A, B, C, D and E should be together, I only get A, B, C in one contig, and maybe D and E in another). That is understandable when the sequencing depth is low, and I'm assume that it's the best I can get.

However. In two of my metagenomes, the genes of interest seem to be abundant (depth of 100-300+ listed for MEGAHIT contigs). And I still have the same problem. I assume that these 'breaks' between contigs are due to natural sequence variation which breaks the assembly process. (while sequencing errors are also possible, I've used bbduk to clean my data prior to assembly)

I'd like to have larger contigs because I'm curious about the gene order. Things I've tried (did not work): visualizing assembly graphs with Bandage around Blast hits, starting with a smaller k-min (21 as opposed to 27).

So I guess I'm wondering if using even smaller k-mers might make a difference. Or if someone has another suggestion, I'm happy to listen! Thank you.

Megahit setting used:

megahit -r input_files.fastq --num-cpu-threads 32 --min-contig-len 300 --presets meta-large -o output
megahit -r input_files.fastq --num-cpu-threads 32 --min-contig-len 1500 --presets meta-sensitive -o output

Meta-large starts from minimum kmer size 27; meta-sensitive from 21.

  • 3
    $\begingroup$ Typically the tradeoff is smaller kmers getting you a more connected assembly graph, while longer kmers can span repeats more and perhaps connect more contigs. So I think the logical thing might be to try and increase kmer size. $\endgroup$
    – NatWH
    Mar 18, 2020 at 13:53
  • $\begingroup$ @NatWH Thank you, I can see how that would work. Considering that a MEGAHIT run goes all up to k-mer size 127 (maximum), and the results that I get are as such, shall I assume that nothing can be done just by changing k-mer size? (or even in general) $\endgroup$
    – Laura
    Mar 18, 2020 at 15:50
  • $\begingroup$ Does MEGAHIT build the results of the graph from larger kmer sizes on top of those from smaller in some way, akin to SPAdes? If so, then the method should already have accounted for this. If not, then perhaps you can try and manually increase kmer size. $\endgroup$
    – NatWH
    Mar 19, 2020 at 14:21

1 Answer 1


You can try s-aligner (free for 15 days) which usually gets quite larger contigs and quite larger NG50 for metagenomic data containing viruses (also phages). Indeed metaSPAdes also gets larger contigs, despite shorter than s-aligner. enter image description here

Ref. s-aligner: a greedy algorithm for non-greedy de novo genome assembly

  • 4
    $\begingroup$ Do I understand right that you are the developer of this commercial product? Please, disclose your conflict of interest. $\endgroup$ Aug 9, 2021 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.