<div dir="ltr"><div><div><div><div><div><div><div>The fastq file I was using is part of the 1000genomes phase 3 dataset (very large gzipped files) with about 25 million records each.  The reads are short so it is probably old.<br></div><br></div>Here&#39;s the file I used<br><br><a href="ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/phase3/data/HG00096/sequence_read/SRR062634_1.filt.fastq.gz">ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/phase3/data/HG00096/sequence_read/SRR062634_1.filt.fastq.gz</a><br><br></div>I made a histogram of the encoded quality values as ascii:<br><br>  33 :          166838<br>  34 :               0<br>  35 :       100598505<br>  36 :           26817<br>  37 :          156873<br>  38 :          268700<br>  39 :          419677<br>  40 :          807326<br>  41 :          997720<br>  42 :          889665<br>  43 :          946268<br>  44 :         2372479<br>  45 :         4147316<br>  46 :          760108<br>  47 :          850433<br>  48 :         1433894<br>  49 :         1165379<br>  50 :         1769347<br>  51 :         2493316<br>  52 :         2966864<br>  53 :        12457233<br>  54 :         3172484<br>  55 :         3741809<br>  56 :         3722004<br>  57 :         4320581<br>  58 :        23804570<br>  59 :         6554713<br>  60 :         7207725<br>  61 :        33021639<br>  62 :        13106991<br>  63 :        60909837<br>  64 :        36753951<br>  65 :        70258165<br>  66 :        91889938<br>  67 :       102533947<br>  68 :       129093976<br>  69 :       368143099<br>  70 :       231023980<br>  71 :      1089945133<br><br><br></div>You can see the lowest value is 33 which means SANGER encoding.<br><br></div>I think the problem is the FastqWriter code only allows Fastq objects to be written that have the same FastqVariant object. I also didn&#39;t see any unit tests in biojava that tested converting the formats.  In fact there are several tests that make sure the Fastq being written has the same FastqVariant as the type of the writer.  <br><br></div>For example <a href="https://github.com/biojava/biojava/blob/master/biojava-sequencing/src/test/java/org/biojava/nbio/sequencing/io/fastq/IlluminaFastqWriterTest.java">https://github.com/biojava/biojava/blob/master/biojava-sequencing/src/test/java/org/biojava/nbio/sequencing/io/fastq/IlluminaFastqWriterTest.java</a><br><br></div>has a test to make sure an IlluminaFastqWriter  only writes Fastq objects that are FastqVariant.FASTQ_ILLUMINA<br><br> public void testValidateNotIlluminaVariant()<br>{<br>    IlluminaFastqWriter writer = new IlluminaFastqWriter();<br>    Appendable appendable = new StringBuilder();<br>    Fastq invalid = new FastqBuilder()<br>         .withDescription(&quot;description&quot;)<br>         .withSequence(&quot;sequence&quot;)<br>         .withQuality(&quot;quality_&quot;)<br>         .withVariant(FastqVariant.FASTQ_SANGER)<br>         .build();<br>try<br>{<br>        writer.append(appendable, invalid);<br>        fail(&quot;validate not fastq-illumina variant expected IOException&quot;);<br>}<br>catch (IOException e)<br>{<br>// expected<br>}<br>}<br><div><div><div><div><div><br></div></div></div></div></div></div>