Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@tomclegg.ca>
"log"
"net/http"
_ "net/http/pprof"
"log"
"net/http"
_ "net/http/pprof"
pprof := flags.String("pprof", "", "serve Go profile data at http://`[addr]:port`")
runlocal := flags.Bool("local", false, "run on local host (default: run in an arvados container)")
projectUUID := flags.String("project", "", "project `UUID` for output data")
pprof := flags.String("pprof", "", "serve Go profile data at http://`[addr]:port`")
runlocal := flags.Bool("local", false, "run on local host (default: run in an arvados container)")
projectUUID := flags.String("project", "", "project `UUID` for output data")
- inputFilename := flags.String("i", "", "input `file`")
- outputFilename := flags.String("o", "", "output `file`")
+ inputFilename := flags.String("i", "-", "input `file`")
+ outputFilename := flags.String("o", "-", "output `file`")
err = flags.Parse(args)
if err == flag.ErrHelp {
err = nil
err = flags.Parse(args)
if err == flag.ErrHelp {
err = nil
- if *outputFilename != "" {
+ if *outputFilename != "-" {
err = errors.New("cannot specify output file in container mode: not implemented")
return 1
}
err = errors.New("cannot specify output file in container mode: not implemented")
return 1
}
- cgs, err := ReadCompactGenomes(stdin)
+ var input io.ReadCloser
+ if *inputFilename == "-" {
+ input = ioutil.NopCloser(stdin)
+ } else {
+ input, err = os.Open(*inputFilename)
+ if err != nil {
+ return 1
+ }
+ defer input.Close()
+ }
+ cgs, err := ReadCompactGenomes(input)
+ if err != nil {
+ return 1
+ }
+ err = input.Close()
if err != nil {
return 1
}
if err != nil {
return 1
}
}
var output io.WriteCloser
}
var output io.WriteCloser
- if *outputFilename == "" {
+ if *outputFilename == "-" {
output = nopCloser{stdout}
} else {
output, err = os.OpenFile(*outputFilename, os.O_CREATE|os.O_WRONLY, 0777)
output = nopCloser{stdout}
} else {
output, err = os.OpenFile(*outputFilename, os.O_CREATE|os.O_WRONLY, 0777)
pprof := flags.String("pprof", "", "serve Go profile data at http://`[addr]:port`")
runlocal := flags.Bool("local", false, "run on local host (default: run in an arvados container)")
projectUUID := flags.String("project", "", "project `UUID` for output data")
pprof := flags.String("pprof", "", "serve Go profile data at http://`[addr]:port`")
runlocal := flags.Bool("local", false, "run on local host (default: run in an arvados container)")
projectUUID := flags.String("project", "", "project `UUID` for output data")
- inputFilename := flags.String("i", "", "input `file`")
- outputFilename := flags.String("o", "", "output `file`")
+ inputFilename := flags.String("i", "-", "input `file`")
+ outputFilename := flags.String("o", "-", "output `file`")
maxvariants := flags.Int("max-variants", -1, "drop tiles with more than `N` variants")
mincoverage := flags.Float64("min-coverage", 1, "drop tiles with coverage less than `P` across all haplotypes (0 < P ≤ 1)")
maxtag := flags.Int("max-tag", -1, "drop tiles with tag ID > `N`")
maxvariants := flags.Int("max-variants", -1, "drop tiles with more than `N` variants")
mincoverage := flags.Float64("min-coverage", 1, "drop tiles with coverage less than `P` across all haplotypes (0 < P ≤ 1)")
maxtag := flags.Int("max-tag", -1, "drop tiles with tag ID > `N`")
- if *outputFilename != "" {
+ if *outputFilename != "-" {
err = errors.New("cannot specify output file in container mode: not implemented")
return 1
}
err = errors.New("cannot specify output file in container mode: not implemented")
return 1
}
}
var infile io.ReadCloser
}
var infile io.ReadCloser
- if *inputFilename == "" {
+ if *inputFilename == "-" {
infile = ioutil.NopCloser(stdin)
} else {
infile, err = os.Open(*inputFilename)
infile = ioutil.NopCloser(stdin)
} else {
infile, err = os.Open(*inputFilename)
log.Print("filtering done")
var outfile io.WriteCloser
log.Print("filtering done")
var outfile io.WriteCloser
- if *outputFilename == "" {
+ if *outputFilename == "-" {
outfile = nopCloser{cmd.output}
} else {
outfile, err = os.OpenFile(*outputFilename, os.O_CREATE|os.O_WRONLY, 0777)
outfile = nopCloser{cmd.output}
} else {
outfile, err = os.OpenFile(*outputFilename, os.O_CREATE|os.O_WRONLY, 0777)
flags.SetOutput(stderr)
flags.StringVar(&cmd.tagLibraryFile, "tag-library", "", "tag library fasta `file`")
flags.StringVar(&cmd.refFile, "ref", "", "reference fasta `file`")
flags.SetOutput(stderr)
flags.StringVar(&cmd.tagLibraryFile, "tag-library", "", "tag library fasta `file`")
flags.StringVar(&cmd.refFile, "ref", "", "reference fasta `file`")
- flags.StringVar(&cmd.outputFile, "o", "", "output `file`")
+ flags.StringVar(&cmd.outputFile, "o", "-", "output `file`")
flags.StringVar(&cmd.projectUUID, "project", "", "project `UUID` for output data")
flags.BoolVar(&cmd.runLocal, "local", false, "run on local host (default: run in an arvados container)")
pprof := flags.String("pprof", "", "serve Go profile data at http://`[addr]:port`")
flags.StringVar(&cmd.projectUUID, "project", "", "project `UUID` for output data")
flags.BoolVar(&cmd.runLocal, "local", false, "run on local host (default: run in an arvados container)")
pprof := flags.String("pprof", "", "serve Go profile data at http://`[addr]:port`")
- if cmd.outputFile == "" {
+ if cmd.outputFile == "-" {
cmd.outputFile = "/mnt/output/library.gob"
} else {
// Not yet implemented, but this should write
cmd.outputFile = "/mnt/output/library.gob"
} else {
// Not yet implemented, but this should write
}()
var output io.WriteCloser
}()
var output io.WriteCloser
- if cmd.outputFile == "" {
+ if cmd.outputFile == "-" {
output = nopCloser{stdout}
} else {
output, err = os.OpenFile(cmd.outputFile, os.O_CREATE|os.O_WRONLY, 0777)
output = nopCloser{stdout}
} else {
output, err = os.OpenFile(cmd.outputFile, os.O_CREATE|os.O_WRONLY, 0777)
flags := flag.NewFlagSet("", flag.ContinueOnError)
flags.SetOutput(stderr)
projectUUID := flags.String("project", "", "project `UUID` for output data")
flags := flag.NewFlagSet("", flag.ContinueOnError)
flags.SetOutput(stderr)
projectUUID := flags.String("project", "", "project `UUID` for output data")
- inputFilename := flags.String("i", "", "input `file`")
+ inputFilename := flags.String("i", "-", "input `file`")
err = flags.Parse(args)
if err == flag.ErrHelp {
err = nil
err = flags.Parse(args)
if err == flag.ErrHelp {
err = nil