From ce7cc440993b56c3f87b040b33d002074f304feb Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Thu, 4 Nov 2021 14:10:14 -0400 Subject: [PATCH] Fix variant numbering. Renumbering code was incorrectly reserving ranking spots for no-calls. refs #17763 Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- slice_test.go | 2 +- slicenumpy.go | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/slice_test.go b/slice_test.go index 42bceee9b8..d84d95f30f 100644 --- a/slice_test.go +++ b/slice_test.go @@ -99,7 +99,7 @@ func (s *sliceSuite) TestImportAndSlice(c *check.C) { c.Assert(err, check.IsNil) c.Check(npy.Shape, check.DeepEquals, []int{4, 4}) variants, err := npy.GetInt16() - c.Check(variants, check.DeepEquals, []int16{3, 2, 1, 2, -1, -1, 1, 1, 3, 2, 1, 2, -1, -1, 1, 1}) + c.Check(variants, check.DeepEquals, []int16{2, 1, 1, 2, -1, -1, 1, 1, 2, 1, 1, 2, -1, -1, 1, 1}) annotations, err := ioutil.ReadFile(npydir + "/matrix.0000.annotations.csv") c.Assert(err, check.IsNil) diff --git a/slicenumpy.go b/slicenumpy.go index 5c55b35af0..4d3bd2745d 100644 --- a/slicenumpy.go +++ b/slicenumpy.go @@ -280,10 +280,14 @@ func (cmd *sliceNumpy) RunCommand(prog string, args []string, stdin io.Reader, s defer throttleCPU.Release() count := make(map[[blake2b.Size256]byte]int, len(variants)) for _, cg := range cgs { - idx := (tag - tagstart) * 2 - if int(idx) < len(cg.Variants) { - count[variants[cg.Variants[idx]].Blake2b]++ - count[variants[cg.Variants[idx+1]].Blake2b]++ + idx := int(tag-tagstart) * 2 + if idx < len(cg.Variants) { + for allele := 0; allele < 2; allele++ { + v := cg.Variants[idx+allele] + if v > 0 && len(variants[v].Sequence) > 0 { + count[variants[v].Blake2b]++ + } + } } } // hash[i] will be the hash of -- 2.30.2