Skip to content

Commit 0df96ba

Browse files
committed
fixing vcf tests
1 parent 5f69119 commit 0df96ba

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ julia = "1"
2727
[extras]
2828
FormatSpecimens = "3372ea36-2a1a-11e9-3eb7-996970b6ffbd"
2929
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
30-
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"
30+
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
3131

3232
[targets]
33-
test = ["Test", "FormatSpecimens", "YAML"]
33+
test = ["Test", "FormatSpecimens", "TOML"]

src/vcf/record.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ function Base.copy(rec::Record)
333333
)
334334
end
335335

336-
function Base.write(io::IO, rec::Record)
336+
function Base.write(io::IO, record::Record)
337337
return unsafe_write(io, pointer(record.data, first(record.filled)), length(record.filled))
338338
end
339339
function Base.print(io::IO, record::Record)

src/vcf/writer.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
1313
A VCF writer that sends data to a wrapped IO stream.
1414
"""
15-
mutable struct Writer{T<:IO} <: BioGenerics.IO.AbstractWriter
16-
stream::T
15+
mutable struct Writer <: BioGenerics.IO.AbstractWriter
16+
stream::IO
1717
end
1818

1919
# Convenience constructor: if given a plain IO, wrap it in a NoopStream.
@@ -35,7 +35,7 @@ function Writer(output::IO, header::Header)
3535
end
3636

3737
# Expose the underlying stream.
38-
function stream(writer::Writer)
38+
function BioGenerics.IO.stream(writer::Writer)
3939
return writer.stream
4040
end
4141

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using Test
55
using BioSequences, GeneticVariation
66
using TranscodingStreams
77
import IntervalTrees: IntervalValue
8-
import YAML
8+
import TOML
99
using FormatSpecimens
1010

1111
import GeneticVariation.VCF: isfilled, metainfotag, metainfoval, VCF, VCF.Reader, VCF.Writer, VCF.Record

test/vcf.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
@test metainfoval(header.metainfo[1]) == "VCFv4.3"
130130
@test isempty(header.sampleID)
131131
end
132+
132133

133134
# realistic header
134135
data = Vector{UInt8}("""
@@ -222,8 +223,7 @@
222223
@test VCF.genotype(record, 2, "GT") == "0/1"
223224
@test VCF.genotype(record, 1:2, "GT") == ["0|0", "0/1"]
224225
@test VCF.genotype(record, :, "GT") == VCF.genotype(record, 1:2, "GT")
225-
@test occursin(r"^GeneticVariation.VCF.Record:\n.*", repr(record))
226-
226+
@test occursin(r"^VCF Record\n.*", repr(record))
227227
@test read!(reader, record) === record
228228
@test VCF.chrom(record) == "chr2"
229229
@test VCF.pos(record) == 4
@@ -252,7 +252,11 @@
252252

253253
# round-trip test
254254
vcfdir = path_of_format("VCF")
255-
for specimen in YAML.load_file(joinpath(vcfdir, "index.yml"))
255+
# Parse the TOML file; the file should define an array of tables under the key "specimen"
256+
# Parse the TOML file. The file now consists of an array of tables under the key "valid".
257+
data = TOML.parsefile(joinpath(vcfdir, "index.toml"))
258+
259+
for specimen in data["valid"]
256260
filepath = joinpath(vcfdir, specimen["filename"])
257261
records = VCF.Record[]
258262
reader = open(VCF.Reader, filepath)
@@ -269,6 +273,7 @@
269273
for record in VCF.Reader(IOBuffer(take!(output)))
270274
push!(records2, record)
271275
end
276+
272277
@test records == records2
273278
end
274279
end

0 commit comments

Comments
 (0)