Fix -min-coverage calculation broken when -case-control-only=true.
authorTom Clegg <tom@curii.com>
Tue, 10 Jan 2023 15:00:16 +0000 (10:00 -0500)
committerTom Clegg <tom@curii.com>
Tue, 10 Jan 2023 15:00:16 +0000 (10:00 -0500)
refs #19868

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

slicenumpy.go

index 0e956a43d52fecc655ead56f7c8f92373f09631f..a22d662b7493608bca97eb3fdc89bb401eea7502 100644 (file)
@@ -316,6 +316,13 @@ func (cmd *sliceNumpy) run(prog string, args []string, stdin io.Reader, stdout,
                cmd.minCoverage = int(math.Ceil(cmd.filter.MinCoverage * float64(len(cmd.cgnames))))
        }
 
+       // cgnamemap[name]==true for samples that we are including in
+       // output
+       cgnamemap := map[string]bool{}
+       for _, name := range cmd.cgnames {
+               cgnamemap[name] = true
+       }
+
        {
                samplesOutFilename := *outputDir + "/samples.csv"
                log.Infof("writing sample metadata to %s", samplesOutFilename)
@@ -532,7 +539,7 @@ func (cmd *sliceNumpy) run(prog string, args []string, stdin io.Reader, stdout,
                                        if cmd.filter.MaxTag >= 0 && cg.StartTag > tagID(cmd.filter.MaxTag) {
                                                return errSkip
                                        }
-                                       if !matchGenome.MatchString(cg.Name) {
+                                       if !cgnamemap[cg.Name] {
                                                continue
                                        }
                                        // pad to full slice size