<p>The classification is indeed based purely on comparing a mean to a threshold... but it's <em>not</em> the mean of the <a href="https://en.wikipedia.org/wiki/Phred_quality_score" rel="noreferrer">Phred scores</a> that represent base quality on a logarithmic scale, but rather the mean of the underlying quality values prior to being transformed into Phreds.</p>

<p>If I compute the "mean" quality for a read in this way - by converting each Phred in the read back to a probability, taking the mean of those probabilities, and then converting that mean probability to a Phred - I find that whether a read is a pass or fail is determined by comparing that score to a threshold of 7:</p>

<p><a href="https://i.sstatic.net/9YuQj.png" rel="noreferrer"><img src="https://i.sstatic.net/9YuQj.png" alt="Historgram illustrating the claim above"></a></p>

<p>A mean quality score computed in this way is also included in the <code>mean_qscore_template</code> column of the sequencing summary file. If you open that file in a spreadsheet program (it's just a TSV) and sort by <code>mean_qscore_template</code>, you will find that the <code>passes_filter</code> column is always <code>FALSE</code> for <code>mean_qscore_template</code> values below 7 and always <code>TRUE</code> for values above 7.</p>

<p>(Hat tip to <a href="https://bioinformatics.stackexchange.com/users/681/wouter-de-coster">Wouter De Coster</a> for successfully guessing that this was the answer in the comments and pointing me on the right path.)</p>

CC BY-SA 4.0
2019-06-03T11:21:10.927Z
2019-06-03T11:21:10.927Z
Mark Amery
<p>I have found a couple of sources<sup><a href="http://www.bioconductor.org/packages//release/data/experiment/vignettes/minionSummaryData/inst/doc/creating-Styphi-Dataset.html" rel="nofollow noreferrer">1</a>,<a href="https://porecamp.github.io/2016/tutorials/PoreCamp2016-02-MinIONData.pdf" rel="nofollow noreferrer">2</a></sup> that indicate that a read in a 1D² run is classified by MinKNOW as "pass" and put into the <code>fastq_pass</code> folder if both of the following conditions are met:</p>

<ol>
<li>Both strands were read</li>
<li>The average Phred score of all bases in the read was >9</li>
</ol>

<p>(Thus a read in a 1D² run goes into the <code>fastq_fail</code> folder if either its Phred is too low <em>or</em> if the second strand didn't follow the first through the pore.)</p>

<p>However, I have been unable to track down any source indicating how the pass/fail classification works for 1D runs (where only one strand is supposed to be read per read). One might reasonably guess that it's based solely upon whether the mean Phred score is above 9, but inspection of the data from a 1D run reveals that this is not the case. While all "pass" reads seem to have a mean Phred score of at least 9 (the lowest I see is 9.45), some fail reads have scores above 9 too (with the highest one being 12.9):</p>

<p><a href="https://i.sstatic.net/CRgzT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/CRgzT.png" alt="Histogram illustrating the distribution described above"></a></p>

<p>Thus it looks to me like this is not the condition used to classify 1D reads. But then what is?</p>

CC BY-SA 4.0
2019-06-03T05:54:04.967Z
How did you calculate the average quality score here per read? Note that you cannot just take the average of all phred scores, as you are dealing with log-transformed probabilities. Or did you use the quality score from the sequencing_summary for this plot?
Wouter De Coster
CC BY-SA 4.0
2019-06-03T11:09:47.173Z
@WouterDeCoster *Excellent* call - you guessed precisely the mistake I'd made. I'll write up an answer now with some new graphs.
Mark Amery
<nanopore><minion><minknow><base-calling>
How does MinKNOW classify 1D reads as "pass" or "fail"?
# How does MinKNOW classify 1D reads as "pass" or "fail"?

(Asked by: username_0 on 2019-05-31)

I have found a couple of sources[1](http://www.bioconductor.org/packages//release/data/experiment/vignettes/minionSummaryData/inst/doc/creating-Styphi-Dataset.html),[2](https://porecamp.github.io/2016/tutorials/PoreCamp2016-02-MinIONData.pdf) that indicate that a read in a 1D² run is classified by MinKNOW as "pass" and put into the `fastq_pass` folder if both of the following conditions are met:

1. Both strands were read
2. The average Phred score of all bases in the read was >9

(Thus a read in a 1D² run goes into the `fastq_fail` folder if either its Phred is too low *or* if the second strand didn't follow the first through the pore.)

However, I have been unable to track down any source indicating how the pass/fail classification works for 1D runs (where only one strand is supposed to be read per read). One might reasonably guess that it's based solely upon whether the mean Phred score is above 9, but inspection of the data from a 1D run reveals that this is not the case. While all "pass" reads seem to have a mean Phred score of at least 9 (the lowest I see is 9.45), some fail reads have scores above 9 too (with the highest one being 12.9):

[![Histogram illustrating the distribution described above](https://i.sstatic.net/CRgzT.png)](https://i.sstatic.net/CRgzT.png)

Thus it looks to me like this is not the condition used to classify 1D reads. But then what is?

**Tags:** nanopore, minion, minknow, base-calling
> **Comments:**
> **username_1**: How did you calculate the average quality score here per read? Note that you cannot just take the average of all phred scores, as you are dealing with log-transformed probabilities. Or did you use the quality score from the sequencing_summary for this plot?  
> **username_0**: @WouterDeCoster *Excellent* call - you guessed precisely the mistake I'd made. I'll write up an answer now with some new graphs.  

---

## 1 answers

### Answer by username_0 on 2019-06-03. Score: 6 | Accepted answer

The classification is indeed based purely on comparing a mean to a threshold... but it's *not* the mean of the [Phred scores](https://en.wikipedia.org/wiki/Phred_quality_score) that represent base quality on a logarithmic scale, but rather the mean of the underlying quality values prior to being transformed into Phreds.

If I compute the "mean" quality for a read in this way - by converting each Phred in the read back to a probability, taking the mean of those probabilities, and then converting that mean probability to a Phred - I find that whether a read is a pass or fail is determined by comparing that score to a threshold of 7:

[![Historgram illustrating the claim above](https://i.sstatic.net/9YuQj.png)](https://i.sstatic.net/9YuQj.png)

A mean quality score computed in this way is also included in the `mean_qscore_template` column of the sequencing summary file. If you open that file in a spreadsheet program (it's just a TSV) and sort by `mean_qscore_template`, you will find that the `passes_filter` column is always `FALSE` for `mean_qscore_template` values below 7 and always `TRUE` for values above 7.

(Hat tip to [Wouter De Coster](https://bioinformatics.stackexchange.com/users/681/wouter-de-coster) for successfully guessing that this was the answer in the comments and pointing me on the right path.)


---

