Skip to content

[Bug] Setting check_description field of FastaWriter may result in breaking fasta format #17

@phlaster

Description

@phlaster

Example:

julia> using FastaIO

julia> long_header = join(fill("123456789_", 10))
"123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_"

writefasta works as expected:

julia> writefasta(stdout, [(long_header, "AGCT")])
┌ Warning: description line longer than 80 characters (entry 1 of FASTA input)
└ @ FastaIO ~/.julia/packages/FastaIO/nZe63/src/FastaIO.jl:577
>123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_
AGCT

julia> writefasta(stdout, [(long_header, "AGCT")]; check_description=false)
>123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_
AGCT

while mutating check_description field of an opened FastaWriter (as proposed in docstrings) resulting in multiline long headers:

julia> FastaWriter(stdout) do fw
          writeentry(fw, long_header, "AGCT")
       end
>123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789┌ Warning: description line longer than 80 characters (entry 1 of FASTA input)
└ @ FastaIO ~/.julia/packages/FastaIO/nZe63/src/FastaIO.jl:450
_123456789_123456789_
AGCT

julia> FastaWriter(stdout) do fw
           fw.check_description = false
           writeentry(fw, long_header, "AGCT")
       end
>123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
_123456789_123456789_
AGCT

which holds for writing in file as well. This breaks file format, as headers must occupy only single line.

Version: [a0c94c4b] FastaIO v1.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions