19524: Fix colormap.
authorTom Clegg <tom@curii.com>
Wed, 12 Oct 2022 18:36:33 +0000 (14:36 -0400)
committerTom Clegg <tom@curii.com>
Wed, 12 Oct 2022 18:36:33 +0000 (14:36 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

plot.go

diff --git a/plot.go b/plot.go
index 1d80e8a21cea9e48174fe6777a2873dc7801ab3b..aa4335fec6889561b6a6adae7cb74caa7ded32bf 100644 (file)
--- a/plot.go
+++ b/plot.go
@@ -78,17 +78,19 @@ X = scipy.load(infile)
 
 colors = None
 if sys.argv[2]:
+    samples = []
     labels = {}
     with open(sys.argv[2], 'rt') as samplelist:
         for row in csv.reader(samplelist):
-            labels[row[1]] = '---'
+            id = row[1]
+            samples.append(id)
     with open(sys.argv[3], 'rt') as colormap:
         for row in csv.reader(colormap):
-            ident=row[0]
-            label=row[1]
-            for fnm in labels:
-                if row[0] in fnm:
-                    labels[fnm] = row[1]
+            tag = row[0]
+            label = row[1]
+            for id in samples:
+                if tag in id:
+                    labels[id] = label
     colors = []
     labelcolors = {
         'PUR': 'firebrick',
@@ -118,9 +120,9 @@ if sys.argv[2]:
         'GIH': 'blueviolet',
         'PJL': 'blueviolet',
     }
-    for fnm in sorted(labels.keys()):
-        if labels[fnm] in labelcolors:
-            colors.append(labelcolors[labels[fnm]])
+    for id in samples:
+        if (id in labels) and (labels[id] in labelcolors):
+            colors.append(labelcolors[labels[id]])
         else:
             colors.append('black')