<p>It's important to always consider read length and quality jointly with high-error read data, and current long-read technologies (e.g., MinION and PacBio) have high error rates. <strong><em>Considering read length and quality jointly will help you determine how successful the run was, how many reads were 'high quality', whether the longer reads are 'real' (or just pore noise), etc.</em></strong></p>

<p>I've had a recent spike of interest in similar plots and came across a project called <a href="https://github.com/conchoecia/pauvre" rel="nofollow noreferrer">pauvre</a> (french for 'poor', play on 'pore') through the Oxford Nanopore Technologies (ONT) community that I think is even better than MinKNOW's base calling plot.  Plus, you can generate these plots from a fastq file when ever you want to, unlike with MinKNOW. </p>

<p><strong><em>[Note: I am not the original author, but I am now contributing because I liked (and needed) it.]</em></strong></p>

<p><a href="https://i.sstatic.net/Jl7JS.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Jl7JS.png" alt="My description"></a></p>

<p>Pauvre will also report useful statistics:</p>

<pre><code>fastq stats for fastq_runid_bb8b8ddedb22bdd6802b2bfa2b4e424c92c30d28_0.fastq
numReads: 2164829
numBasepairs: 4970615217
meanLen: 2296.077527139557
medianLen: 1495.0
minLen: 5
maxLen: 392031
N50: 3450
L50: 402786

                               Basepairs &gt;= bin by mean PHRED and length
minLen          Q0          Q5         Q10         Q15       Q17.5         Q20      Q21.5  Q25  Q25.5  Q30
     0  4970615217  4970611559  4835461771  3889995868  2900103275  1087779109  165637656  429      0    0
 50000    11531044    11531044      270324      160128       50729       50729          0    0      0    0
100000     6260554     6260554           0           0           0           0          0    0      0    0
150000     3504240     3504240           0           0           0           0          0    0      0    0
200000     2501101     2501101           0           0           0           0          0    0      0    0
250000     1609592     1609592           0           0           0           0          0    0      0    0
300000     1033423     1033423           0           0           0           0          0    0      0    0
350000      392031      392031           0           0           0           0          0    0      0    0

                    Number of reads &gt;= bin by mean Phred+Len
minLen       Q0       Q5      Q10      Q15    Q17.5     Q20  Q21.5  Q25  Q25.5  Q30
     0  2164829  2164605  2083436  1626706  1183812  435687  77341    1      0    0
 50000      109      109        5        3        1       1      0    0      0    0
100000       36       36        0        0        0       0      0    0      0    0
150000       15       15        0        0        0       0      0    0      0    0
200000        9        9        0        0        0       0      0    0      0    0
250000        5        5        0        0        0       0      0    0      0    0
300000        3        3        0        0        0       0      0    0      0    0
350000        1        1        0        0        0       0      0    0      0    0
</code></pre>

<p><strong><em>These plots and stats would be equally useful with PacBio, but that's not super easy (though it is possible) with current raw output from the Sequel sequencer: <a href="https://bioinformatics.stackexchange.com/questions/885/which-quality-score-encoding-does-pacbio-use/888">Which quality score encoding does PacBio use?</a></em></strong></p>

<p>Pauvre currently uses Biopython to parse the fastq and <code>matplotlib</code> for the actual plot, and will let you choose the output image format (e.g., .png, .pdf, etc.). You can also choose whether the background is transparent or white (for .png output). </p>

<p>The parser is currently super slow because it's using <code>SeqIO.parse</code>, but we're changing parsers to speed that up. We're also adding some extra features (e.g., choose whether to include y-axes in margin histograms, print some stats directly to the plot for documentation, etc.)</p>

<p>Purple is currently the only color choice (which I personally love), but adding options to change that will be super easy.</p>

CC BY-SA 3.0
2017-06-24T18:16:49.600Z
2017-06-24T22:07:08.513Z
2017-06-24T22:07:08.513Z
Mark Ebbert
<p>I also wrote a package to create various plots from Oxford Nanopore sequencing data and alignments: <a href="https://github.com/wdecoster/NanoPlot" rel="noreferrer">NanoPlot</a>. It can be installed through pip (see also <a href="https://github.com/wdecoster/NanoPlot" rel="noreferrer">the README on Github</a>). In addition to multiple plots also a limited NanoStats output is created (see also <a href="https://github.com/wdecoster/nanostat" rel="noreferrer">NanoStat</a>). Data can be presented using:</p>

<ul>
<li>A fastq file (optionally compressed)</li>
<li>A bam file</li>
<li>The sequencing_summary.txt file generated by albacore</li>
</ul>

<p>Using optional flags you can:</p>

<ul>
<li>Log transform the read lengths</li>
<li>Use aligned reads rather than sequenced reads</li>
<li>Downsample the reads</li>
<li>Set a maximum read length</li>
</ul>

<p>I've added an example below, plotting log transformed read length vs average read quality (using a kernel density estimate). More examples can be found in the <a href="https://gigabaseorgigabyte.wordpress.com/2017/06/01/example-gallery-of-nanoplot/" rel="noreferrer">gallery on my blog</a>.</p>

<p>I welcome all feedback and suggestions!</p>

<p><a href="https://i.sstatic.net/ZwsHX.png" rel="noreferrer"><img src="https://i.sstatic.net/ZwsHX.png" alt="enter image description here"></a></p>

CC BY-SA 3.0
2017-06-26T09:51:54.100Z
2017-06-26T09:51:54.100Z
Wouter De Coster
<p>How do you generate read-length vs read-quality plot (heat map with histograms in the margin) for long-read sequencing data from the Oxford Nanopore Technologies (ONT) MinION? The MinKNOW software from ONT provides a plot like this during base calling.</p>

<p>This would also be very helpful for PacBio data.</p>

<python><ngs><fastq><nanopore><pacbio>
How do you generate read-length vs read-quality plot for long-read sequencing data (e.g., MinION)?
# How do you generate read-length vs read-quality plot for long-read sequencing data (e.g., MinION)?

(Asked by: username_0 on 2017-06-24)

How do you generate read-length vs read-quality plot (heat map with histograms in the margin) for long-read sequencing data from the Oxford Nanopore Technologies (ONT) MinION? The MinKNOW software from ONT provides a plot like this during base calling.

This would also be very helpful for PacBio data.

**Tags:** python, ngs, fastq, nanopore, pacbio

---

## 2 answers

### Answer by username_1 on 2017-06-26. Score: 6

I also wrote a package to create various plots from Oxford Nanopore sequencing data and alignments: [NanoPlot](https://github.com/wdecoster/NanoPlot). It can be installed through pip (see also [the README on Github](https://github.com/wdecoster/NanoPlot)). In addition to multiple plots also a limited NanoStats output is created (see also [NanoStat](https://github.com/wdecoster/nanostat)). Data can be presented using:

* A fastq file (optionally compressed)
* A bam file
* The sequencing\_summary.txt file generated by albacore

Using optional flags you can:

* Log transform the read lengths
* Use aligned reads rather than sequenced reads
* Downsample the reads
* Set a maximum read length

I've added an example below, plotting log transformed read length vs average read quality (using a kernel density estimate). More examples can be found in the [gallery on my blog](https://gigabaseorgigabyte.wordpress.com/2017/06/01/example-gallery-of-nanoplot/).

I welcome all feedback and suggestions!

[![enter image description here](https://i.sstatic.net/ZwsHX.png)](https://i.sstatic.net/ZwsHX.png)


---

### Answer by username_0 on 2017-06-24. Score: 4

It's important to always consider read length and quality jointly with high-error read data, and current long-read technologies (e.g., MinION and PacBio) have high error rates. Considering read length and quality jointly will help you determine how successful the run was, how many reads were 'high quality', whether the longer reads are 'real' (or just pore noise), etc.
I've had a recent spike of interest in similar plots and came across a project called pauvre (french for 'poor', play on 'pore') through the Oxford Nanopore Technologies (ONT) community that I think is even better than MinKNOW's base calling plot.  Plus, you can generate these plots from a fastq file when ever you want to, unlike with MinKNOW. 
[Note: I am not the original author, but I am now contributing because I liked (and needed) it.]

Pauvre will also report useful statistics:
fastq stats for fastq_runid_bb8b8ddedb22bdd6802b2bfa2b4e424c92c30d28_0.fastq
numReads: 2164829
numBasepairs: 4970615217
meanLen: 2296.077527139557
medianLen: 1495.0
minLen: 5
maxLen: 392031
N50: 3450
L50: 402786

                               Basepairs >= bin by mean PHRED and length
minLen          Q0          Q5         Q10         Q15       Q17.5         Q20      Q21.5  Q25  Q25.5  Q30
     0  4970615217  4970611559  4835461771  3889995868  2900103275  1087779109  165637656  429      0    0
 50000    11531044    11531044      270324      160128       50729       50729          0    0      0    0
100000     6260554     6260554           0           0           0           0          0    0      0    0
150000     3504240     3504240           0           0           0           0          0    0      0    0
200000     2501101     2501101           0           0           0           0          0    0      0    0
250000     1609592     1609592           0           0           0           0          0    0      0    0
300000     1033423     1033423           0           0           0           0          0    0      0    0
350000      392031      392031           0           0           0           0          0    0      0    0

                    Number of reads >= bin by mean Phred+Len
minLen       Q0       Q5      Q10      Q15    Q17.5     Q20  Q21.5  Q25  Q25.5  Q30
     0  2164829  2164605  2083436  1626706  1183812  435687  77341    1      0    0
 50000      109      109        5        3        1       1      0    0      0    0
100000       36       36        0        0        0       0      0    0      0    0
150000       15       15        0        0        0       0      0    0      0    0
200000        9        9        0        0        0       0      0    0      0    0
250000        5        5        0        0        0       0      0    0      0    0
300000        3        3        0        0        0       0      0    0      0    0
350000        1        1        0        0        0       0      0    0      0    0

These plots and stats would be equally useful with PacBio, but that's not super easy (though it is possible) with current raw output from the Sequel sequencer: Which quality score encoding does PacBio use?
Pauvre currently uses Biopython to parse the fastq and matplotlib for the actual plot, and will let you choose the output image format (e.g., .png, .pdf, etc.). You can also choose whether the background is transparent or white (for .png output). 
The parser is currently super slow because it's using SeqIO.parse, but we're changing parsers to speed that up. We're also adding some extra features (e.g., choose whether to include y-axes in margin histograms, print some stats directly to the plot for documentation, etc.)
Purple is currently the only color choice (which I personally love), but adding options to change that will be super easy.


---

