Fix some tests.
[lightning.git] / cmd.go
diff --git a/cmd.go b/cmd.go
index 97505c3926502782b07dabfb3a84233a634b6906..97bc8d30af38a2f5b74d220cef59cd352ae45db4 100644 (file)
--- a/cmd.go
+++ b/cmd.go
@@ -1,4 +1,8 @@
-package main
+// Copyright (C) The Lightning Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+package lightning
 
 import (
        "fmt"
@@ -6,6 +10,8 @@ import (
        "io/ioutil"
        "os"
        "os/exec"
+       "runtime/debug"
+       "strings"
 
        "git.arvados.org/arvados.git/lib/cmd"
        "github.com/mattn/go-isatty"
@@ -24,23 +30,40 @@ var (
                "annotate":           &annotatecmd{},
                "export":             &exporter{},
                "export-numpy":       &exportNumpy{},
+               "flake":              &flakecmd{},
+               "slice":              &slicecmd{},
+               "slice-numpy":        &sliceNumpy{},
+               "tiling-stats":       &tilingStats{},
+               "anno2vcf":           &anno2vcf{},
                "numpy-comvar":       &numpyComVar{},
                "filter":             &filtercmd{},
                "build-docker-image": &buildDockerImage{},
-               "pca-go":             &goPCA{},
-               "pca-py":             &pythonPCA{},
                "plot":               &pythonPlot{},
+               "pca-plot":           &pythonPlot{},
+               "manhattan-plot":     &manhattanPlot{},
                "diff-fasta":         &diffFasta{},
                "stats":              &statscmd{},
                "merge":              &merger{},
+               "dump":               &dump{},
                "dumpgob":            &dumpGob{},
+               "choose-samples":     &chooseSamples{},
        })
 )
 
-func main() {
+func init() {
+       if os.Getenv("GOGC") == "" {
+               debug.SetGCPercent(30)
+       }
+}
+
+func Main() {
        if !isatty.IsTerminal(os.Stderr.Fd()) {
                logrus.StandardLogger().Formatter = &logrus.TextFormatter{DisableTimestamp: true}
        }
+       if len(os.Args) >= 2 && !strings.HasSuffix(os.Args[1], "version") {
+               // print version (then run subcommand)
+               cmd.Version.RunCommand("lightning", nil, nil, os.Stderr, os.Stderr)
+       }
        os.Exit(handler.RunCommand(os.Args[0], os.Args[1:], os.Stdin, os.Stdout, os.Stderr))
 }
 
@@ -53,12 +76,13 @@ func (cmd *buildDockerImage) RunCommand(prog string, args []string, stdin io.Rea
                return 1
        }
        defer os.RemoveAll(tmpdir)
-       err = ioutil.WriteFile(tmpdir+"/Dockerfile", []byte(`FROM debian:10
+       err = ioutil.WriteFile(tmpdir+"/Dockerfile", []byte(`FROM debian:bullseye
 RUN DEBIAN_FRONTEND=noninteractive \
   apt-get update && \
   apt-get dist-upgrade -y && \
-  apt-get install -y --no-install-recommends bcftools bedtools samtools python2 python3-sklearn python3-matplotlib ca-certificates && \
-  apt-get clean
+  apt-get install -y --no-install-recommends bcftools bedtools samtools python2 python3-sklearn python3-matplotlib python3-pip ca-certificates && \
+  apt-get clean && \
+  pip3 install qmplot
 `), 0644)
        if err != nil {
                fmt.Fprint(stderr, err)