Assembly evaluation¶
Objectives
Evaluating the resource consumption of various assemblies¶
Check to see if your assembly jobs have completed. If you have multiple jobs running or queued, the easiest way to check this is to simply run the squeue command.
Terminal output
If there are no jobs listed, either everything running has completed or failed. To get a list of all jobs we have run in the last day, we can use the sacct command. By default this will report all jobs for the day but we can add a parameter to tell the command to report all jobs run since the date we are specifying.
Terminal output
JobID JobName Partition Account AllocCPUS State ExitCode
------------ ---------- ---------- ---------- ---------- ---------- --------
9996006 spades_as+ milan nesi02659 24 FAILED 255:0
9996006.bat+ batch nesi02659 24 FAILED 255:0
9996006.ext+ extern nesi02659 24 COMPLETED 0:0
9996013 spades_as+ milan nesi02659 24 TIMEOUT 0:0
9996013.bat+ batch nesi02659 24 CANCELLED 0:15
9996013.ext+ extern nesi02659 24 COMPLETED 0:0
9996014 spades_as+ milan nesi02659 24 CANCELLED+ 0:0
9996014.bat+ batch nesi02659 24 CANCELLED 0:15
9996014.ext+ extern nesi02659 24 COMPLETED 0:0
10014267 spades_as+ milan nesi02659 32 RUNNING 0:0
10014267.ba+ batch nesi02659 32 RUNNING 0:0
10014267.ex+ extern nesi02659 32 RUNNING 0:0
Each job has been broken up into several lines, but the main ones to keep an eye on are the base JobID values.
We can see here the time elapsed for each job, and the number of CPU hours used during the run. If we want a more detailed breakdown of the job we can use the nn_seff command
Terminal output
Here we see some of the same information, but we also get some information regarding how well our job used the resources we allocated to it. You can see here that my CPU and memory usage was inefficient yet the job ran out of time. In the future, I can request more time and fewer CPUs (cores). As the job did not finish I still don't know the typical memory requirement of this task.
CPU efficiency is harder to interpret as it can be impacted by the behaviour of the program. For example, mapping tools like bowtie and BBMap can more or less use all of their threads, all of the time and achieve nearly 100% efficiency. More complicated processes, like those performed in SPAdes go through periods of multi-thread processing and periods of single-thread processing, drawing the average efficiency down.
Interpretation of Peak Mem and MaxRSS
nn_seff reports the MaxRSS memory used. This is, however, not all the
memory used by a task: It does not include file caching and temporary
files stored in RAM ( /tmp and by default $TMPDIR reside in RAM). Cf.
TMPDIR and
MaxRSS.
For example, SPAdes always needs several GB more than MaxRSS/Peak Mem is actually showing.
Evaluating the assemblies using BBMap¶
Evaluating the quality of a raw metagenomic assembly is quite a tricky process. Since, by definition, our community is a mixture of different organisms, the genomes from some of these organisms assemble better than those of others. It is possible to have an assembly that looks 'bad' by traditional metrics that still yields high-quality genomes from individual species, and the converse is also true.
A few quick checks I recommend are to see how many contigs or scaffolds your data were assembled into, and then see how many contigs or scaffolds you have above a certain minimum length threshold. We will use seqmagick for performing the length filtering, and then just count sequence numbers using grep.
These steps will take place in the 3.assembly_evaluation/ folder, which contains copies of our SPAdes and IDBA-UD assemblies.
Navigate to working directory
Remember to update <YOUR FOLDER> to your own folder
Terminal
Terminal output
Choice of software: sequence file manipulation
The tool seqtk is also available on NeSI and performs many of the same functions as seqmagick. My choice of seqmagick is mostly cosmetic as the parameter names are more explicit so it's easier to understand what's happening in a command when I look back at my log files. Regardless of which tool you prefer, we strongly recommend getting familiar with either seqtk or seqmagick as both perform a lot of common FASTA and FASTQ file manipulations.
As we can see here, the SPAdes assembly has completed with fewer contigs assembled than the IDBA-UD, both in terms of total contigs assembled and contigs above the 1,000 bp size. This doesn't tell us a lot though - has SPAdes managed to assemble fewer reads, or has it managed to assemble the sequences into longer (and hence fewer) contigs? We can check this by looking at the N50/L50 (see more information about this statistic here) of the assembly using the stats.sh tool that comes with BBMap.
Terminal
This gives quite a verbose output:
Terminal output
A C G T N IUPAC Other GC GC_stdev
0.2541 0.2475 0.2453 0.2531 0.0018 0.0000 0.0000 0.4928 0.0958
Main genome scaffold total: 934
Main genome contig total: 2703
Main genome scaffold sequence total: 34.293 MB
Main genome contig sequence total: 34.231 MB 0.182% gap
Main genome scaffold N/L50: 53/160.826 KB
Main genome contig N/L50: 107/72.909 KB
Main genome scaffold N/L90: 302/15.325 KB
Main genome contig N/L90: 812/4.643 KB
Max scaffold length: 1.222 MB
Max contig length: 1.045 MB
Number of scaffolds > 50 KB: 152
% main genome in scaffolds > 50 KB: 77.10%
Minimum Number Number Total Total Scaffold
Scaffold of of Scaffold Contig Contig
Length Scaffolds Contigs Length Length Coverage
-------- -------------- -------------- -------------- -------------- --------
All 934 2,703 34,293,018 34,230,627 99.82%
1 KB 934 2,703 34,293,018 34,230,627 99.82%
2.5 KB 744 2,447 33,967,189 33,909,776 99.83%
5 KB 581 2,131 33,379,814 33,328,450 99.85%
10 KB 394 1,585 32,031,121 31,994,989 99.89%
25 KB 236 916 29,564,265 29,545,757 99.94%
50 KB 152 599 26,441,339 26,429,391 99.95%
100 KB 92 415 22,238,822 22,230,143 99.96%
250 KB 31 153 12,606,774 12,603,418 99.97%
500 KB 6 32 4,821,355 4,821,095 99.99%
1 MB 1 2 1,221,548 1,221,538 100.00%
N50 and L50 in BBMap
Unfortunately, the N50 and L50 values generated by stats.sh are switched. N50 should be a length and L50 should be a count. The results table below shows the corrected values based on stats.sh outputs.
But what we can highlight here is that the statistics for the SPAdes assembly, with short contigs removed, yielded an N50 of 72.5 kbp at the contig level. We will now compute those same statistics from the other assembly options.
Terminal
| Assembly | N50 (contig) | L50 (contig) |
|---|---|---|
| SPAdes (filtered) | 72.9 kbp | 107 |
| SPAdes (unfiltered) | 72.3 kbp | 108 |
| IDBA-UD (filtered) | 103.9 kbp | 82 |
| IDBA-UD (unfiltered) | 96.7 kbp | 88 |
