Mercurial > repos > greg > draw_features
changeset 8:67520145696f draft default tip
Uploaded
author | greg |
---|---|
date | Thu, 23 Mar 2023 19:57:44 +0000 |
parents | c5555f1c8f49 |
children | |
files | draw_features.py |
diffstat | 1 files changed, 3 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/draw_features.py Thu Mar 23 17:20:23 2023 +0000 +++ b/draw_features.py Thu Mar 23 19:57:44 2023 +0000 @@ -17,9 +17,8 @@ def get_random_color(): - number_of_colors = 16 - colors = ['#%s' % ' '.join([random.choice('0123456789ABCDEF') for j in range(6)]) for i in range(number_of_colors)] - return random.choice(colors) + r = lambda: random.randint(0,255) + return '#%02X%02X%02X' % (r(),r(),r()) def draw_features(feature_hits_files, contigs, output_dir): @@ -58,7 +57,7 @@ features_to_plot = [] for i in range(contig_features.shape[0]): i = contig_features.iloc[i, :] - if feature_number <= len(FEATURE_COLORS): + if feature_number < len(FEATURE_COLORS): color = FEATURE_COLORS[feature_number] else: color = get_random_color()