Fix -max-tag filter.
authorTom Clegg <tom@curii.com>
Thu, 17 Feb 2022 14:22:47 +0000 (09:22 -0500)
committerTom Clegg <tom@curii.com>
Thu, 17 Feb 2022 14:22:47 +0000 (09:22 -0500)
refs #18581

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

slicenumpy.go

index 974f2006397bbcaf1a2586780d1f5246ee91ab63..8a1dff0f0c2190c1b7b7bd319f249e25e089527e 100644 (file)
@@ -249,7 +249,7 @@ func (cmd *sliceNumpy) RunCommand(prog string, args []string, stdin io.Reader, s
        for seqname, cseq := range refseq {
                pos := 0
                for _, libref := range cseq {
-                       if libref.Tag > tagID(cmd.filter.MaxTag) {
+                       if cmd.filter.MaxTag >= 0 && libref.Tag > tagID(cmd.filter.MaxTag) {
                                continue
                        }
                        tiledata := reftiledata[libref]
@@ -487,7 +487,7 @@ func (cmd *sliceNumpy) RunCommand(prog string, args []string, stdin io.Reader, s
                                        // Excluded by specified regions
                                        continue
                                }
-                               if tag > tagID(cmd.filter.MaxTag) {
+                               if cmd.filter.MaxTag >= 0 && tag > tagID(cmd.filter.MaxTag) {
                                        continue
                                }
                                remap := variantRemap[tag-tagstart]
@@ -641,7 +641,7 @@ func (cmd *sliceNumpy) RunCommand(prog string, args []string, stdin io.Reader, s
                                        outcol := 0
                                        for col, v := range cgs[name].Variants {
                                                tag := tagstart + tagID(col/2)
-                                               if mask != nil && reftile[tag] == nil {
+                                               if mask != nil && reftile[tag] == nil || tag > tagID(cmd.filter.MaxTag) {
                                                        continue
                                                }
                                                if variants, ok := seq[tag]; ok && len(variants) > int(v) && len(variants[v].Sequence) > 0 {