mirror of
https://github.com/MillironX/XAM.jl.git
synced 2024-11-23 10:19:56 +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
|
||||
# copy
|
||||
reader = open(SAM.Reader, filepath)
|
||||
writer = SAM.Writer(io, header(reader))
|
||||
|
||||
header_original = header(reader)
|
||||
|
||||
writer = SAM.Writer(io, header_original)
|
||||
|
||||
records = SAM.Record[]
|
||||
for record in reader
|
||||
push!(records, record)
|
||||
write(writer, record)
|
||||
end
|
||||
|
||||
close(reader)
|
||||
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
|
||||
|
@ -378,8 +390,11 @@ end
|
|||
else
|
||||
reader = open(BAM.Reader, filepath)
|
||||
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[]
|
||||
for record in reader
|
||||
push!(records, record)
|
||||
|
@ -387,7 +402,14 @@ end
|
|||
end
|
||||
close(reader)
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue