Skip to content

Commit

Permalink
Add seqview function
Browse files Browse the repository at this point in the history
This returns a view into the sequence part of a FASTA/FASTQ record.
  • Loading branch information
jakobnissen committed Jul 26, 2022
1 parent cfe3fa2 commit 816a366
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/fasta/record.jl
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ function description(record::Record)::StringView
return StringView(view(record.data, 1:Int(record.description_len)))
end

"""
seqview(record::Record)::AbstractVector{UInt8}
Get a view of the record as an `AbstractVector{UInt8}`.
If the record has an empty sequence, return an empty view.
"""
function seqview(record::Record)::AbstractVector{UInt8}
view(record.data, record.description_len+1:record.sequence_len)
end

"""
sequence_iter(T, record::Record, part)
Expand Down

0 comments on commit 816a366

Please sign in to comment.