Fix crash when ref tile is dropped due to duplicate tag.
authorTom Clegg <tom@curii.com>
Wed, 20 Jul 2022 16:21:32 +0000 (12:21 -0400)
committerTom Clegg <tom@curii.com>
Wed, 20 Jul 2022 16:21:32 +0000 (12:21 -0400)
refs #19236

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

slicenumpy.go
tilelib.go

index 1322b91544140df640bc1c53dcad133155df358f..d4e48b3a2597a0376e81cd6b4cd5bd4c33bac1c2 100644 (file)
@@ -622,6 +622,9 @@ func (cmd *sliceNumpy) RunCommand(prog string, args []string, stdin io.Reader, s
                                        endtagstr := strings.ToUpper(string(tv.Sequence[len(tv.Sequence)-taglen:]))
                                        for i, rt := 0, rt; i < annotationMaxTileSpan && !strings.HasSuffix(reftilestr, endtagstr) && rt.nexttag >= 0; i++ {
                                                rt = reftile[rt.nexttag]
+                                               if rt == nil {
+                                                       break
+                                               }
                                                reftilestr += strings.ToUpper(string(rt.tiledata[taglen:]))
                                        }
                                        if mask != nil && !mask.Check(strings.TrimPrefix(rt.seqname, "chr"), rt.pos, rt.pos+len(reftilestr)) {
index df6cb73b3be2b9e16418f6d5eb7c5135b7686efe..b6dc3671207c619d6ffe578e5a292f69eab334af 100644 (file)
@@ -572,6 +572,8 @@ func (tilelib *tileLibrary) TileFasta(filelabel string, rdr io.Reader, matchChro
                                todo <- jobT{seqlabel, append([]byte(nil), fasta...)}
                                seqlabel, fasta = strings.SplitN(string(buf[1:]), " ", 2)[0], fasta[:0]
                                log.Debugf("%s %s reading fasta", filelabel, seqlabel)
+                       } else if len(buf) > 0 && buf[0] == '#' {
+                               // ignore testdata comment
                        } else {
                                fasta = append(fasta, bytes.ToLower(buf)...)
                        }