mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
First commit
This commit is contained in:
62
cmd/test/main.go
Normal file
62
cmd/test/main.go
Normal file
@ -0,0 +1,62 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"runtime/trace"
|
||||
|
||||
"git.metabarcoding.org/lecasofts/go/oa2/pkg/obialign"
|
||||
"git.metabarcoding.org/lecasofts/go/oa2/pkg/obiseq"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
ftrace, err := os.Create("cpu.trace")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
trace.Start(ftrace)
|
||||
defer trace.Stop()
|
||||
|
||||
// option_parser := obioptions.GenerateOptionParser(
|
||||
// obiconvert.InputOptionSet,
|
||||
// )
|
||||
|
||||
//_, args, _ := option_parser(os.Args)
|
||||
|
||||
// fs, _ := obiconvert.ReadBioSequences(args...)
|
||||
// buffer := make([]byte, 0)
|
||||
// fs.Next()
|
||||
// s := fs.Get()
|
||||
// index := obikmer.Index4mer(s, nil, nil)
|
||||
// for fs.Next() {
|
||||
// s := fs.Get()
|
||||
// if s.IsNil() {
|
||||
// log.Panicln("Read sequence is nil")
|
||||
// }
|
||||
// maxshift, maxcount := obikmer.FastShiftFourMer(index, s, buffer)
|
||||
|
||||
// fmt.Printf("Shift : %d Score : %d\n", maxshift, maxcount)
|
||||
// }
|
||||
|
||||
A := []byte("ccgcctccttagaacaggctcctctagaaaaccatagtgggatatctaaagaaggcggagatagaaagagcggttcagcaggaatgccgagatggacggcgtgtgacg")
|
||||
B := []byte("cgccaccaccgagatctacactctttccctacacgacgctcttccgatctccgcctccttagaacaggctcctctagaaaagcatagtggggtatctaaaggaggcgg")
|
||||
sA := obiseq.MakeBioSequence("A", A, "")
|
||||
sB := obiseq.MakeBioSequence("B", B, "")
|
||||
|
||||
fmt.Println(string(sA.Sequence()))
|
||||
fmt.Println(sA.Qualities())
|
||||
fmt.Println(string(sB.Sequence()))
|
||||
fmt.Println(sB.Qualities())
|
||||
|
||||
score, path := obialign.PELeftAlign(sA, sB, 2, obialign.NilPEAlignArena)
|
||||
fmt.Printf("Score : %d Path : %v\n", score, path)
|
||||
score, path = obialign.PERightAlign(sA, sB, 2, obialign.NilPEAlignArena)
|
||||
fmt.Printf("Score : %d Path : %v\n", score, path)
|
||||
|
||||
fmt.Println(string(sA.Sequence()))
|
||||
sA.ReverseComplement(true)
|
||||
fmt.Println(string(sA.Sequence()))
|
||||
fmt.Println(string(sA.Id()))
|
||||
}
|
58
cmd/test/test_test.go
Normal file
58
cmd/test/test_test.go
Normal file
@ -0,0 +1,58 @@
|
||||
package main_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"git.metabarcoding.org/lecasofts/go/oa2/pkg/obiannot"
|
||||
"git.metabarcoding.org/lecasofts/go/oa2/pkg/obiformats"
|
||||
"git.metabarcoding.org/lecasofts/go/oa2/pkg/obiseq"
|
||||
)
|
||||
|
||||
func TestParseOBIFasta(t *testing.T) {
|
||||
f := "/Users/coissac/travail/Adeline/Soumission_data/Zonation/euka03/euka03.ecotag.fasta.gz"
|
||||
|
||||
var nseq, nread int
|
||||
nseq = 0
|
||||
nread = 0
|
||||
|
||||
fs := obiformats.ReaderFromIlluminaFile(f)
|
||||
|
||||
fmt.Println(f)
|
||||
|
||||
for i := range obiannot.ExtractHeaderChannel(fs, fastseq.ParseOBIHeader) {
|
||||
for _, s := range i {
|
||||
nseq++
|
||||
nread += s.Count()
|
||||
}
|
||||
}
|
||||
fmt.Println(nseq, nread)
|
||||
|
||||
}
|
||||
|
||||
func ExtractHeaderChannel(fs fastseq.IFastSeq, sequence func(sequence obiseq.Sequence)) {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// Performance test of an ADEXP message parsing
|
||||
func BenchmarkParseOBIFasta(t *testing.B) {
|
||||
|
||||
f := "/Users/coissac/travail/Adeline/Soumission_data/Zonation/euka03/euka03.ecotag.fasta.gz"
|
||||
|
||||
var nseq, nread int
|
||||
nseq = 0
|
||||
nread = 0
|
||||
|
||||
fs := fastseq.ReaderFromIlluminaFile(f)
|
||||
|
||||
fmt.Println(f)
|
||||
|
||||
for i := range obiannot.ExtractHeaderChannel(fs, fastseq.ParseOBIHeader) {
|
||||
for _, s := range i {
|
||||
nseq++
|
||||
nread += s.Count()
|
||||
}
|
||||
}
|
||||
fmt.Println(nseq, nread)
|
||||
|
||||
}
|
Reference in New Issue
Block a user