Files
obitools4/cmd/test/main.go

79 lines
2.1 KiB
Go
Raw Normal View History

2022-01-13 23:27:39 +01:00
package main
import (
"fmt"
"log"
"os"
"runtime/trace"
2022-01-13 23:43:01 +01:00
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq"
2022-03-07 16:37:21 +01:00
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obialign"
2022-01-13 23:27:39 +01:00
)
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)
// }
2022-03-07 16:37:21 +01:00
A := []byte("ccgcctccttagaacaggctcctctagaaaaccatgtgggatatctaaagaaggcggagatagaaagagcggttcagcaggaatgccgagatggacggcgtgtgacg")
B := []byte("ccgcctccttagaacaggctcctctagaaaaaccatgtgggatatctaaagaaggcggagatagaaagagcggttcagcaggaatgccgagatggacggcgtgtgacg")
// B := []byte("cgccaccaccgagatctacactctttccctacacgacgctcttccgatctccgcctccttagaacaggctcctctagaaaagcatagtggggtatctaaaggaggcgg")
sA := obiseq.NewBioSequence("A", A, "")
2022-03-07 16:37:21 +01:00
sB := obiseq.MakeBioSequence("B", B, "")
2022-01-13 23:27:39 +01:00
2022-03-07 16:37:21 +01:00
s, l := obialign.LCSScore(sA, &sB, 2, nil)
2022-01-13 23:27:39 +01:00
2022-03-07 16:37:21 +01:00
fmt.Printf("score : %d length : %d error : %d\n", s, l, l-s)
2022-01-13 23:27:39 +01:00
2022-03-07 16:37:21 +01:00
s, l = obialign.LCSScore(&sB, &sB, 2, nil)
2022-02-01 17:31:28 +01:00
2022-03-07 16:37:21 +01:00
fmt.Printf("score : %d length : %d error : %d\n", s, l, l-s)
2022-03-07 16:37:21 +01:00
// pat, _ := obiapat.MakeApatPattern("TCCTTCCAACAGGCTCCTC", 3)
// as, _ := obiapat.MakeApatSequence(sA, false)
// fmt.Println(pat.FindAllIndex(as))
// file, _ := os.Open("sample/wolf_diet_ngsfilter.txt")
// xxx, _ := obiformats.ReadNGSFilter(file)
// xxx.Compile(2)
// fmt.Printf("%v\n==================\n", xxx)
// for pp, m := range xxx {
// fmt.Printf("%v %v\n", pp, *m)
// }
// seqfile, _ := obiformats.ReadFastSeqFromFile("xxxx.fastq")
// for seqfile.Next() {
// seq := seqfile.Get()
// barcode, _ := xxx.ExtractBarcode(seq, true)
// fmt.Println(obiformats.FormatFasta(barcode, obiformats.FormatFastSeqOBIHeader))
// }
2022-01-13 23:27:39 +01:00
}