From: Tom Clegg Date: Fri, 11 Feb 2022 20:01:57 +0000 (-0500) Subject: Include tiles in one-hot matrix even if there is no ref tile. X-Git-Url: https://git.arvados.org/lightning.git/commitdiff_plain/15eb20b72530b148de4e2a7725cda2922e27aa9d Include tiles in one-hot matrix even if there is no ref tile. refs #18581 Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- diff --git a/slicenumpy.go b/slicenumpy.go index 4a2f6654d2..c6859f3653 100644 --- a/slicenumpy.go +++ b/slicenumpy.go @@ -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++ { - 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] @@ -504,6 +500,12 @@ func (cmd *sliceNumpy) RunCommand(prog string, args []string, stdin io.Reader, s 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))