Skip to content

Commit b224ffd

Browse files
committed
Bump to BioGenerics 0.2 and use new BioGenerics macros
The new BioGenerics `@rdr_str` and `@wtr_str` macros, as well as the `defer` keyword has been a longstanding FASTX todo. This change adds this new functionality.
1 parent f9cb4b2 commit b224ffd

3 files changed

Lines changed: 22 additions & 8 deletions

File tree

Project.toml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ uuid = "c2308a5c-f048-11e8-3e8a-31650f418d12"
33
authors = ["Sabrina J. Ward <sabrinajward@protonmail.com>", "Jakob N. Nissen <jakobnybonissen@gmail.com>"]
44
version = "2.1.3"
55

6-
[weakdeps]
7-
BioSequences = "7e6ae17a-c86d-528c-b3b9-7f778a29fe59"
8-
96
[deps]
107
Automa = "67c07d97-cdcb-5c2c-af73-a7f9c32a568b"
118
BioGenerics = "47718e42-2ac5-11e9-14af-e5595289c2ea"
@@ -14,22 +11,26 @@ PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
1411
StringViews = "354b36f9-a18e-4713-926e-db85100087ba"
1512
TranscodingStreams = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
1613

14+
[weakdeps]
15+
BioSequences = "7e6ae17a-c86d-528c-b3b9-7f778a29fe59"
16+
1717
[extensions]
1818
BioSequencesExt = "BioSequences"
1919

2020
[compat]
2121
Automa = "1"
22-
BioGenerics = "0.1.2"
22+
BioGenerics = "0.1.3"
2323
BioSequences = "3"
2424
PrecompileTools = "1"
2525
StringViews = "1"
2626
TranscodingStreams = "0.9.5"
2727
julia = "1.6"
2828

2929
[extras]
30+
BioSequences = "7e6ae17a-c86d-528c-b3b9-7f778a29fe59"
3031
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
3132
ReTest = "e0db7c4e-2690-44b9-bad6-7687da720f89"
32-
BioSequences = "7e6ae17a-c86d-528c-b3b9-7f778a29fe59"
33+
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"
3334

3435
[targets]
35-
test = ["BioSequences", "Random", "ReTest"]
36+
test = ["BioSequences", "Random", "ReTest", "CodecZlib"]

src/FASTX.jl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module FASTX
22

33
using StringViews: StringView
44
using Automa: Automa
5+
using BioGenerics: BioGenerics, defer, @rdr_str, @wtr_str
56

67
"""
78
identifier(record::Record)::AbstractString
@@ -220,6 +221,11 @@ const FASTQReader = FASTQ.Reader
220221
const FASTAWriter = FASTA.Writer
221222
const FASTQWriter = FASTQ.Writer
222223

224+
const FASTA_EXTENSIONS = Union{Val{:fa}, Val{:fasta}, Val{:faa}, Val{:fna}}
225+
226+
BioGenerics.readertype(::FASTA_EXTENSIONS, arg) = FASTAReader
227+
BioGenerics.writertype(::FASTA_EXTENSIONS, arg) = FASTAWriter
228+
223229
if !isdefined(Base, :get_extension)
224230
include("../ext/BioSequencesExt.jl")
225231
end
@@ -249,6 +255,11 @@ export
249255
faidx,
250256
index!,
251257
extract,
252-
seekrecord
258+
seekrecord,
259+
260+
# Re-export from BioGenerics
261+
defer,
262+
@rdr_str,
263+
@wtr_str
253264

254265
end # module

test/maintests.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using CodecZlib
2+
13
# Common tests
24
@testset "FASTX" begin
35
@testset "Copying to LongSequence" begin
@@ -133,4 +135,4 @@
133135
@test sequence(fq) == "TAGJKKm"
134136
@test quality(fq) == "jjkkmmo"
135137
end
136-
end
138+
end

0 commit comments

Comments
 (0)