Skip to content

Commit

Permalink
Workaround for #23
Browse files Browse the repository at this point in the history
  • Loading branch information
CiaranOMara committed Jul 20, 2020
1 parent a51e911 commit da0c188
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/sam/readrecord.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,16 @@ const sam_machine_metainfo, sam_machine_record, sam_machine_header, sam_machine_
key.actions[:enter] = [:pos2]
key.actions[:exit] = [:metainfo_dict_key]
val = re"[ -~]+"
val.actions[:enter] = [:pos2]
val.actions[:exit] = [:metainfo_dict_val]
keyval = cat(key, ':', val)

# val.actions[:enter] = [:pos2]
# val.actions[:exit] = [:metainfo_dict_val]
# keyval = cat(key, ':', val)

separator = re":"
separator.actions[:exit] = [:pos2]

keyval = cat(key, separator, opt(val))
keyval.actions[:exit] = [:metainfo_dict_val]

cat(keyval, rep(cat('\t', keyval)))
end
Expand Down
13 changes: 13 additions & 0 deletions test/test_sam.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@
@test metainfo["VN"] == "1.0"
@test metainfo["SO"] == "coordinate"
@test_throws KeyError metainfo["GO"]


metainfo = SAM.MetaInfo("@PG ID:hisat2 PN:hisat2 VN: CL:\"/script.sh\"")
@test haskey(metainfo, "ID")
@test haskey(metainfo, "PN")
# @test haskey(metainfo, "VN")
@test haskey(metainfo, "CL")

@test metainfo["ID"] == "hisat2"
@test metainfo["PN"] == "hisat2"
# @test metainfo["VN"] == ""
@test metainfo["CL"] == "\"/script.sh\""

end

@testset "Header" begin
Expand Down

0 comments on commit da0c188

Please sign in to comment.