X-Git-Url: https://git.arvados.org/lightning.git/blobdiff_plain/5e4171fb1592e22628929c965e90943dbf50f49b..69b71af4136fdaeeb5c2afbc559208dc5f428c48:/annotate.go diff --git a/annotate.go b/annotate.go index 449e64bb34..ff4ab88717 100644 --- a/annotate.go +++ b/annotate.go @@ -109,10 +109,10 @@ func (cmd *annotatecmd) RunCommand(prog string, args []string, stdin io.Reader, bufw := bufio.NewWriter(output) tilelib := &tileLibrary{ - includeNoCalls: true, + retainNoCalls: true, retainTileSequences: true, } - err = tilelib.LoadGob(context.Background(), input, nil) + err = tilelib.LoadGob(context.Background(), input, strings.HasSuffix(*inputFilename, ".gz"), nil) if err != nil { return 1 } @@ -152,7 +152,7 @@ func (cmd *annotatecmd) exportTileDiffs(outw io.Writer, tilelib *tileLibrary) er sort.Strings(refs) log.Infof("len(refs) %d", len(refs)) - outch := make(chan string, 1) + outch := make(chan string, runtime.NumCPU()*2) var outwg sync.WaitGroup defer outwg.Wait() outwg.Add(1) @@ -169,7 +169,7 @@ func (cmd *annotatecmd) exportTileDiffs(outw io.Writer, tilelib *tileLibrary) er nseqs += len(refcs) } - throttle := &throttle{Max: runtime.NumCPU() + nseqs + 1} + throttle := &throttle{Max: runtime.NumCPU()*2 + nseqs*2 + 1} defer throttle.Wait() for _, refname := range refs { @@ -185,7 +185,7 @@ func (cmd *annotatecmd) exportTileDiffs(outw io.Writer, tilelib *tileLibrary) er throttle.Acquire() go func() { defer throttle.Release() - throttle.Report(cmd.annotateSequence(throttle, outch, tilelib, taglen, refname, seqname, refcs[seqname])) + throttle.Report(cmd.annotateSequence(throttle, outch, tilelib, taglen, refname, seqname, refcs[seqname], len(refs) > 1)) }() } } @@ -193,7 +193,7 @@ func (cmd *annotatecmd) exportTileDiffs(outw io.Writer, tilelib *tileLibrary) er return throttle.Err() } -func (cmd *annotatecmd) annotateSequence(throttle *throttle, outch chan<- string, tilelib *tileLibrary, taglen int, refname, seqname string, reftiles []tileLibRef) error { +func (cmd *annotatecmd) annotateSequence(throttle *throttle, outch chan<- string, tilelib *tileLibrary, taglen int, refname, seqname string, reftiles []tileLibRef, refnamecol bool) error { var refseq []byte // tilestart[123] is the index into refseq // where the tile for tag 123 was placed. @@ -232,7 +232,9 @@ func (cmd *annotatecmd) annotateSequence(throttle *throttle, outch chan<- string for variant := 1; variant <= len(tvs); variant++ { variant, hash := tileVariantID(variant), tvs[variant-1] tileseq := tilelib.TileVariantSequence(tileLibRef{Tag: tag, Variant: variant}) - if len(tileseq) < taglen { + if len(tileseq) == 0 { + continue + } else if len(tileseq) < taglen { return fmt.Errorf("tilevar %d,%d has sequence len %d < taglen %d", tag, variant, len(tileseq), taglen) } var refpart []byte @@ -273,7 +275,11 @@ func (cmd *annotatecmd) annotateSequence(throttle *throttle, outch chan<- string } else { varid = fmt.Sprintf("%d", variant) } - outch <- fmt.Sprintf("%d\t%s\t%s\t%s:g.%s\n", tag, varid, refname, seqname, diff.String()) + refnamefield := "" + if refnamecol { + refnamefield = "\t" + refname + } + outch <- fmt.Sprintf("%d\t%s%s\t%s:g.%s\n", tag, varid, refnamefield, seqname, diff.String()) } }() }