Skip to content

Commit da0c188

Browse files
committed
Workaround for #23
1 parent a51e911 commit da0c188

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

src/sam/readrecord.jl

+10-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,16 @@ const sam_machine_metainfo, sam_machine_record, sam_machine_header, sam_machine_
2828
key.actions[:enter] = [:pos2]
2929
key.actions[:exit] = [:metainfo_dict_key]
3030
val = re"[ -~]+"
31-
val.actions[:enter] = [:pos2]
32-
val.actions[:exit] = [:metainfo_dict_val]
33-
keyval = cat(key, ':', val)
31+
32+
# val.actions[:enter] = [:pos2]
33+
# val.actions[:exit] = [:metainfo_dict_val]
34+
# keyval = cat(key, ':', val)
35+
36+
separator = re":"
37+
separator.actions[:exit] = [:pos2]
38+
39+
keyval = cat(key, separator, opt(val))
40+
keyval.actions[:exit] = [:metainfo_dict_val]
3441

3542
cat(keyval, rep(cat('\t', keyval)))
3643
end

test/test_sam.jl

+13
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@
3030
@test metainfo["VN"] == "1.0"
3131
@test metainfo["SO"] == "coordinate"
3232
@test_throws KeyError metainfo["GO"]
33+
34+
35+
metainfo = SAM.MetaInfo("@PG ID:hisat2 PN:hisat2 VN: CL:\"/script.sh\"")
36+
@test haskey(metainfo, "ID")
37+
@test haskey(metainfo, "PN")
38+
# @test haskey(metainfo, "VN")
39+
@test haskey(metainfo, "CL")
40+
41+
@test metainfo["ID"] == "hisat2"
42+
@test metainfo["PN"] == "hisat2"
43+
# @test metainfo["VN"] == ""
44+
@test metainfo["CL"] == "\"/script.sh\""
45+
3346
end
3447

3548
@testset "Header" begin

0 commit comments

Comments
 (0)