Fix some tests.
[lightning.git] / ref2genome.go
index 31a4ee157da3a3b37d271c95044a00db7aaff56d..d6ba39611fe8e048e08da241bae87092be31ef18 100644 (file)
@@ -1,4 +1,8 @@
-package main
+// Copyright (C) The Lightning Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+package lightning
 
 import (
        "bufio"
@@ -48,6 +52,9 @@ func (cmd *ref2genome) RunCommand(prog string, args []string, stdin io.Reader, s
        } else if cmd.refFile == "" {
                err = errors.New("reference data (-ref) not specified")
                return 2
+       } else if flags.NArg() > 0 {
+               err = fmt.Errorf("errant command line arguments after parsed flags: %v", flags.Args())
+               return 2
        }
 
        if *pprof != "" {
@@ -79,7 +86,7 @@ func (cmd *ref2genome) RunCommand(prog string, args []string, stdin io.Reader, s
                if err != nil {
                        return 1
                }
-               fmt.Fprintln(stdout, output)
+               fmt.Fprintln(stdout, output+"/ref.genome")
                return 0
        }
 
@@ -115,6 +122,7 @@ func (cmd *ref2genome) RunCommand(prog string, args []string, stdin io.Reader, s
                                fmt.Fprintf(out, "%s\t%d\n", label, seqlen)
                        }
                        label = strings.TrimSpace(string(buf[1:]))
+                       label = strings.SplitN(label, " ", 2)[0]
                        seqlen = 0
                } else {
                        seqlen += len(bytes.TrimSpace(buf))