mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
66 lines
1.1 KiB
Go
66 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
"runtime/trace"
|
|
|
|
"git.metabarcoding.org/lecasofts/go/oa2/pkg/obitools/obiconvert"
|
|
"git.metabarcoding.org/lecasofts/go/oa2/pkg/obitools/obicount"
|
|
|
|
"git.metabarcoding.org/lecasofts/go/oa2/pkg/obioptions"
|
|
)
|
|
|
|
func main() {
|
|
|
|
// f, err := os.Create("cpu.pprof")
|
|
// if err != nil {
|
|
// log.Fatal(err)
|
|
// }
|
|
// pprof.StartCPUProfile(f)
|
|
// defer pprof.StopCPUProfile()
|
|
|
|
ftrace, err := os.Create("cpu.trace")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
trace.Start(ftrace)
|
|
defer trace.Stop()
|
|
|
|
option_parser := obioptions.GenerateOptionParser(
|
|
obiconvert.InputOptionSet,
|
|
obicount.OptionSet,
|
|
)
|
|
|
|
_, args, _ := option_parser(os.Args)
|
|
|
|
fs, _ := obiconvert.ReadBioSequences(args...)
|
|
nread := 0
|
|
nvariant := 0
|
|
nsymbol := 0
|
|
for fs.Next() {
|
|
s := fs.Get()
|
|
if s.IsNil() {
|
|
log.Panicln("Read sequence is nil")
|
|
}
|
|
nread += s.Count()
|
|
nvariant++
|
|
nsymbol += s.Length()
|
|
}
|
|
|
|
if obicount.IsPrintingVariantCount() {
|
|
fmt.Printf(" %d", nvariant)
|
|
}
|
|
|
|
if obicount.IsPrintingReadCount() {
|
|
fmt.Printf(" %d", nread)
|
|
}
|
|
|
|
if obicount.IsPrintingSymbolCount() {
|
|
fmt.Printf(" %d", nsymbol)
|
|
}
|
|
|
|
fmt.Printf("\n")
|
|
}
|