Include tiles in one-hot matrix even if there is no ref tile.
authorTom Clegg <tom@curii.com>
Fri, 11 Feb 2022 20:01:57 +0000 (15:01 -0500)
committerTom Clegg <tom@curii.com>
Fri, 11 Feb 2022 20:01:57 +0000 (15:01 -0500)
refs #18581

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

slicenumpy.go

index 4a2f6654d227f526ded40731f9611cda42a94909..c6859f3653f506b4b4b3d2d76b205b1bdccf0bf3 100644 (file)
@@ -480,16 +480,12 @@ func (cmd *sliceNumpy) RunCommand(prog string, args []string, stdin io.Reader, s
                        annow := bufio.NewWriterSize(annof, 1<<20)
                        outcol := 0
                        for tag := tagstart; tag < tagend; tag++ {
                        annow := bufio.NewWriterSize(annof, 1<<20)
                        outcol := 0
                        for tag := tagstart; tag < tagend; tag++ {
-                               rt, ok := reftile[tag]
-                               if !ok {
-                                       if mask == nil {
-                                               outcol++
-                                       }
-                                       // Excluded by specified
-                                       // regions, or reference does
-                                       // not use any variant of this
-                                       // tile. (TODO: log this?
-                                       // mention it in annotations?)
+                               rt := reftile[tag]
+                               if rt == nil && mask != nil {
+                                       // Excluded by specified regions
+                                       continue
+                               }
+                               if tag > tagID(cmd.filter.MaxTag) {
                                        continue
                                }
                                remap := variantRemap[tag-tagstart]
                                        continue
                                }
                                remap := variantRemap[tag-tagstart]
@@ -504,6 +500,12 @@ func (cmd *sliceNumpy) RunCommand(prog string, args []string, stdin io.Reader, s
                                        onehotChunk = append(onehotChunk, onehot...)
                                        onehotXref = append(onehotXref, xrefs...)
                                }
                                        onehotChunk = append(onehotChunk, onehot...)
                                        onehotXref = append(onehotXref, xrefs...)
                                }
+                               if rt == nil {
+                                       // Reference does not use any
+                                       // variant of this tile
+                                       outcol++
+                                       continue
+                               }
                                fmt.Fprintf(annow, "%d,%d,%d,=,%s,%d,,,\n", tag, outcol, rt.variant, rt.seqname, rt.pos)
                                variants := seq[tag]
                                reftilestr := strings.ToUpper(string(rt.tiledata))
                                fmt.Fprintf(annow, "%d,%d,%d,=,%s,%d,,,\n", tag, outcol, rt.variant, rt.seqname, rt.pos)
                                variants := seq[tag]
                                reftilestr := strings.ToUpper(string(rt.tiledata))