Work on iterators and recycling of biosequences

This commit is contained in:
2022-01-14 23:11:36 +01:00
parent ef66ca4972
commit e8fff6477b
22 changed files with 350 additions and 111 deletions

View File

@ -13,6 +13,6 @@ func main() {
_, args, _ := optionParser(os.Args)
fs, _ := obiconvert.ReadBioSequences(args...)
obiconvert.WriteBioSequences(fs)
fs, _ := obiconvert.ReadBioSequencesBatch(args...)
obiconvert.WriteBioSequencesBatch(fs,true)
}

View File

@ -4,7 +4,6 @@ import (
"fmt"
"log"
"os"
"runtime/trace"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obitools/obiconvert"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obitools/obicount"
@ -21,12 +20,12 @@ func main() {
// pprof.StartCPUProfile(f)
// defer pprof.StopCPUProfile()
ftrace, err := os.Create("cpu.trace")
if err != nil {
log.Fatal(err)
}
trace.Start(ftrace)
defer trace.Stop()
// ftrace, err := os.Create("cpu.trace")
// if err != nil {
// log.Fatal(err)
// }
// trace.Start(ftrace)
// defer trace.Stop()
optionParser := obioptions.GenerateOptionParser(
obiconvert.InputOptionSet,
@ -47,6 +46,7 @@ func main() {
nread += s.Count()
nvariant++
nsymbol += s.Length()
(&s).Recycle()
}
if obicount.IsPrintingVariantCount() {

View File

@ -1,24 +1,22 @@
package main
import (
"log"
"os"
"runtime/pprof"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiformats"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obioptions"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obitools/obiconvert"
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obitools/obipairing"
)
func main() {
// go tool pprof -http=":8000" ./obipairing ./cpu.pprof
f, err := os.Create("cpu.pprof")
if err != nil {
log.Fatal(err)
}
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
// f, err := os.Create("cpu.pprof")
// if err != nil {
// log.Fatal(err)
// }
// pprof.StartCPUProfile(f)
// defer pprof.StopCPUProfile()
// go tool trace cpu.trace
// ftrace, err := os.Create("cpu.trace")
@ -33,6 +31,5 @@ func main() {
optionParser(os.Args)
pairs, _ := obipairing.IBatchPairedSequence()
paired := obipairing.IAssemblePESequencesBatch(pairs, 2, 50, 20, true)
written, _ := obiformats.WriteFastqBatchToStdout(paired)
written.Destroy()
obiconvert.WriteBioSequencesBatch(paired, true)
}

View File

@ -30,5 +30,5 @@ func main() {
sequences, _ := obiconvert.ReadBioSequencesBatch(args...)
amplicons, _ := obipcr.PCR(sequences)
obiconvert.WriteBioSequences(amplicons)
obiconvert.WriteBioSequencesBatch(amplicons,true)
}

View File

@ -59,4 +59,9 @@ func main() {
sA.ReverseComplement(true)
fmt.Println(string(sA.Sequence()))
fmt.Println(string(sA.Id()))
sA.Reset()
fmt.Println(sA.Length())
fmt.Println(sA.String())
}