From eca90b6e199f7026e394c6e2044513128542938a Mon Sep 17 00:00:00 2001 From: Haibao Tang Date: Tue, 29 Aug 2023 08:18:19 -0700 Subject: [PATCH] Use natsorted --- jcvi/graphics/chromosome.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jcvi/graphics/chromosome.py b/jcvi/graphics/chromosome.py index 5c96738b..765915ca 100644 --- a/jcvi/graphics/chromosome.py +++ b/jcvi/graphics/chromosome.py @@ -9,6 +9,7 @@ import sys from itertools import groupby from math import ceil +from natsort import natsorted from typing import Tuple import numpy as np @@ -586,7 +587,7 @@ def draw_chromosomes( ratio = r / max_chr_len # canvas / base # first the chromosomes - for a, (chr, clen) in enumerate(sorted(chr_lens.items())): + for a, (chr, clen) in enumerate(natsorted(chr_lens.items())): xx = xstart + a * xinterval + 0.5 * xwidth root.text(xx, ystart + 0.01, str(get_number(chr)), ha="center") if centromeres: