# HG changeset patch # User greg # Date 1679601464 0 # Node ID 67520145696f3977df2dfb3911f3bc92ffc6e3a0 # Parent c5555f1c8f49e54443c2e68b12b3d24a832deffe Uploaded diff -r c5555f1c8f49 -r 67520145696f draw_features.py --- 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()