Skip to content

Commit

Permalink
Merge pull request #45 from jakobnissen/fixheader
Browse files Browse the repository at this point in the history
Fix header code
  • Loading branch information
jakobnissen committed Apr 14, 2021
2 parents be40822 + 7d98cbc commit e9202ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/fasta/record.jl
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@ end
Returns the stripped header line of `record`, or `nothing` if it was empty.
"""
function header(record::Record)
hasidentifier(record) || return nothing
id, desc = record.identifier, record.description
range = first(id) : max(last(id), last(desc))
function header(record::Record)::Union{String, Nothing}
id, de = record.identifier, record.description
isempty(id) && isempty(de) && return nothing
range = isempty(de) ? id : (isempty(id) ? de : first(id):last(de))
return String(record.data[range])
end

Expand Down
8 changes: 4 additions & 4 deletions src/fastq/record.jl
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,10 @@ end
Returns the stripped header line of `record`, or `nothing` if it was empty.
"""
function header(record::Record)
hasidentifier(record) || return nothing
id, desc = record.identifier, record.description
range = first(id) : max(last(id), last(desc))
function header(record::Record)::Union{String, Nothing}
id, de = record.identifier, record.description
isempty(id) && isempty(de) && return nothing
range = isempty(de) ? id : (isempty(id) ? de : first(id):last(de))
return String(record.data[range])
end

Expand Down

0 comments on commit e9202ba

Please sign in to comment.