X-Git-Url: https://git.arvados.org/lightning.git/blobdiff_plain/53f36ff0323547f835b1b068324429f53ce7220c..66cf9d08ca8504cdb660ed44738622b90f7fd42f:/annotate.go diff --git a/annotate.go b/annotate.go index b792119b20..25651889aa 100644 --- a/annotate.go +++ b/annotate.go @@ -1,3 +1,7 @@ +// Copyright (C) The Lightning Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + package lightning import ( @@ -23,10 +27,11 @@ import ( ) type annotatecmd struct { - dropTiles []bool - variantHash bool - maxTileSize int - tag2tagid map[string]tagID + dropTiles []bool + variantHash bool + maxTileSize int + tag2tagid map[string]tagID + reportAnnotation func(tag tagID, outcol int, variant tileVariantID, refname string, seqname string, pdi hgvs.Variant) } func (cmd *annotatecmd) RunCommand(prog string, args []string, stdin io.Reader, stdout, stderr io.Writer) int { @@ -113,7 +118,7 @@ func (cmd *annotatecmd) RunCommand(prog string, args []string, stdin io.Reader, retainNoCalls: true, retainTileSequences: true, } - err = tilelib.LoadGob(context.Background(), input, strings.HasSuffix(*inputFilename, ".gz"), nil) + err = tilelib.LoadGob(context.Background(), input, strings.HasSuffix(*inputFilename, ".gz")) if err != nil { return 1 } @@ -242,13 +247,10 @@ func (cmd *annotatecmd) annotateSequence(throttle *throttle, outch chan<- string outcol := outcol refstart, ok := tilestart[tag] if !ok { - // Tag didn't place on this - // reference sequence. (It - // might place on the same - // chromosome in a genome - // anyway, but we don't output - // the annotations that would - // result.) + // Tag didn't place on this reference + // sequence. (It might place on the same + // chromosome in a genome anyway, but we don't + // output the annotations that would result.) // outch <- fmt.Sprintf("%d,%d,-1%s\n", tag, outcol, refnamefield) continue } @@ -299,6 +301,9 @@ func (cmd *annotatecmd) annotateSequence(throttle *throttle, outch chan<- string varid = fmt.Sprintf("%d", variant) } outch <- fmt.Sprintf("%d,%d,%s%s,%s:g.%s\n", tag, outcol, varid, refnamefield, seqname, diff.String()) + if cmd.reportAnnotation != nil { + cmd.reportAnnotation(tag, outcol, variant, refname, seqname, diff) + } } }() }