From ba5304767f5af207873afc9c9694886364d3743c Mon Sep 17 00:00:00 2001 From: Haibao Tang Date: Thu, 5 Sep 2024 18:45:37 -0700 Subject: [PATCH] Be smarter about chrZ (#703, thanks @manighanipoor) --- jcvi/graphics/karyotype.py | 1 + tests/graphics/test_karyotype.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/jcvi/graphics/karyotype.py b/jcvi/graphics/karyotype.py index 42bcb634..723628b7 100644 --- a/jcvi/graphics/karyotype.py +++ b/jcvi/graphics/karyotype.py @@ -121,6 +121,7 @@ def make_circle_name(sid, rev): in_reverse = sid in rev sid = sid.rsplit("_", 1)[-1] + sid = sid.replace("chr", "").replace("Chr", "") si = re.findall(r"\d+", sid) if si: si = str(int(si[0])) diff --git a/tests/graphics/test_karyotype.py b/tests/graphics/test_karyotype.py index 15b13e41..ecc91fd9 100644 --- a/tests/graphics/test_karyotype.py +++ b/tests/graphics/test_karyotype.py @@ -19,6 +19,8 @@ ("chr01", {}, "1"), ("Ttru_Chr1", {}, "1"), ("pseudochromosome_1", {}, "1"), + ("chrZ", {}, "Z"), + ("ChrX", {"ChrX"}, "X-"), ], ) def test_make_circle_name(sid, rev, expected):