Skip to content

Commit 0436917

Browse files
authored
Merge pull request #6 from schorlton/main
Parse CS tag correctly
2 parents 47f363f + 33c902a commit 0436917

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

readpaf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
__all__ = ["parse_paf"]
66

7-
__version__ = "0.0.8"
7+
__version__ = "0.0.9"
88

99
try:
1010
import pandas as pd
@@ -95,7 +95,7 @@ def _parse_tags(tags):
9595
"""
9696
return {
9797
tag: SAM_TAG(tag, type_, SAM_TYPES.get(type_, lambda x: x)(val))
98-
for tag, type_, val in (x.split(":") for x in tags)
98+
for tag, type_, val in (x.split(":", 2) for x in tags)
9999
}
100100

101101

tests/test_readpaf.py

+7
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ def test_tag_suffix_dataframe():
8383
assert set(df.columns) == set(cols + ["tp_tag"]), "Tag field not set correctly"
8484

8585

86+
def test_cs_tag_parsing():
87+
_rec = "a7208cb4-133c-4ab9-96fe-db8630f4d9bb\t373\t15\t368\t+\tEf_genome\t2845392\t586028\t586405\t103\t377\t60\ttp:A:P\tcs:Z::6-ata:10+gtc:4*at:3\n"
88+
PAF_IO = StringIO(_rec)
89+
for rec in parse_paf(PAF_IO):
90+
assert rec.tags["cs"].value == ":6-ata:10+gtc:4*at:3", "cs tag didn't match"
91+
92+
8693
def test_read_uncompressed():
8794
c = 0
8895
with open(PAF_FILE, "r") as fh:

0 commit comments

Comments
 (0)