mirror of
https://github.com/MillironX/XAM.jl.git
synced 2024-11-14 22:33:14 +00:00
Check header in roundtrip
This commit is contained in:
parent
031751f6b3
commit
f6846edfb1
1 changed files with 27 additions and 5 deletions
|
@ -172,15 +172,27 @@ end
|
||||||
mktemp() do path, io
|
mktemp() do path, io
|
||||||
# copy
|
# copy
|
||||||
reader = open(SAM.Reader, filepath)
|
reader = open(SAM.Reader, filepath)
|
||||||
writer = SAM.Writer(io, header(reader))
|
|
||||||
|
header_original = header(reader)
|
||||||
|
|
||||||
|
writer = SAM.Writer(io, header_original)
|
||||||
|
|
||||||
records = SAM.Record[]
|
records = SAM.Record[]
|
||||||
for record in reader
|
for record in reader
|
||||||
push!(records, record)
|
push!(records, record)
|
||||||
write(writer, record)
|
write(writer, record)
|
||||||
end
|
end
|
||||||
|
|
||||||
close(reader)
|
close(reader)
|
||||||
close(writer)
|
close(writer)
|
||||||
@test compare_records(open(collect, SAM.Reader, path), records)
|
|
||||||
|
reader = open(SAM.Reader, path)
|
||||||
|
|
||||||
|
@test header(reader) == header_original
|
||||||
|
@test compare_records(collect(reader), records)
|
||||||
|
|
||||||
|
close(reader)
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -378,8 +390,11 @@ end
|
||||||
else
|
else
|
||||||
reader = open(BAM.Reader, filepath)
|
reader = open(BAM.Reader, filepath)
|
||||||
end
|
end
|
||||||
writer = BAM.Writer(
|
|
||||||
BGZFStream(path, "w"), BAM.header(reader, fillSQ=isempty(findall(header(reader), "SQ"))))
|
header_original = header(reader)
|
||||||
|
|
||||||
|
writer = BAM.Writer(BGZFStream(path, "w"), BAM.header(reader, fillSQ=isempty(findall(header(reader), "SQ"))))
|
||||||
|
|
||||||
records = BAM.Record[]
|
records = BAM.Record[]
|
||||||
for record in reader
|
for record in reader
|
||||||
push!(records, record)
|
push!(records, record)
|
||||||
|
@ -387,7 +402,14 @@ end
|
||||||
end
|
end
|
||||||
close(reader)
|
close(reader)
|
||||||
close(writer)
|
close(writer)
|
||||||
@test compare_records(open(collect, BAM.Reader, path), records)
|
|
||||||
|
reader = open(BAM.Reader, path)
|
||||||
|
|
||||||
|
@test header(reader) == header_original
|
||||||
|
@test compare_records(collect(reader), records)
|
||||||
|
|
||||||
|
close(reader)
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue