Closed dan-sprague closed 2 years ago
This is not a bug, actually. What is happening is that you are not closing the writer, but is closing the underlying IO stream. The writer has its own buffer, so when you close the underlying IO without closing the writer, the buffer does not get flushed.
So, to do it correctly, close the reader/writer in uToT
, and do not close inp
or out
.
I think the issue is that it is not clearly enough documented that the readers/writers take ownership of the underlying IO.
Here is a small example to demonstrate:
julia> using FASTX
julia> function test(path, correct::Bool)
io = open(path, "w")
w = FASTA.Writer(io)
write(w, FASTA.Record("a", "a"))
correct ? close(w) : close(io)
end;
julia> test("bad.fna", false)
julia> test("good.fna", true)
shell> cat bad.fna # empty
shell> cat good.fna # has data
>a
a
Closed in #72
Hi,
I am trying to write out fastq files generated from a Nanopore MINION machine. There seems to be issues with sequences not being written correctly, sometimes. There definitely appears to be an issue encoding/decoding the quality from these files. Nanopore claims they use the Sanger standard PHRED encoding, which seems to be supported by the FASTX package.
Actually upon checking, there appears to be issues with the FASTA writer as well. The demo below fails to write the FASTA file. However the converted sequences println fine??
CODE:
Short demo file. When you run the code on this, nothing will save.