diff --git a/readpaf.py b/readpaf.py index f500cdc..b0c6819 100644 --- a/readpaf.py +++ b/readpaf.py @@ -4,7 +4,7 @@ __all__ = ["parse_paf"] -__version__ = "0.0.8" +__version__ = "0.0.9" try: import pandas as pd @@ -95,7 +95,7 @@ def _parse_tags(tags): """ return { tag: SAM_TAG(tag, type_, SAM_TYPES.get(type_, lambda x: x)(val)) - for tag, type_, val in (x.split(":") for x in tags) + for tag, type_, val in (x.split(":", 2) for x in tags) } diff --git a/tests/test_readpaf.py b/tests/test_readpaf.py index 1948dc5..d53a6b0 100644 --- a/tests/test_readpaf.py +++ b/tests/test_readpaf.py @@ -83,6 +83,13 @@ def test_tag_suffix_dataframe(): assert set(df.columns) == set(cols + ["tp_tag"]), "Tag field not set correctly" +def test_cs_tag_parsing(): + _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" + PAF_IO = StringIO(_rec) + for rec in parse_paf(PAF_IO): + assert rec.tags["cs"].value == ":6-ata:10+gtc:4*at:3", "cs tag didn't match" + + def test_read_uncompressed(): c = 0 with open(PAF_FILE, "r") as fh: