| 1 | # kmers |
| 2 | |
| 3 | [](https://pkg.go.dev/github.com/shenwei356/kmers) |
| 4 | |
| 5 | |
| 6 | This package provides manipulations for bit-packed k-mers (k<=32, encoded in `uint64`). |
| 7 | |
| 8 | Related projects: |
| 9 | |
| 10 | - [unik](https://github.com/shenwei356/unik) provides k-mer serialization methods for this package. |
| 11 | - [unikmer](https://github.com/shenwei356/unikmer), a toolkit for nucleic acid k-mer analysis, |
| 12 | including set operations on k-mers optional with TaxIDs. |
| 13 | - [sketches](https://pkg.go.dev/github.com/shenwei356/bio/sketches) provides generators/iterators for k-mer sketches |
| 14 | ([Minimizer](https://academic.oup.com/bioinformatics/article/20/18/3363/202143), |
| 15 | [Scaled MinHash](https://f1000research.com/articles/8-1006), |
| 16 | [Closed Syncmers](https://peerj.com/articles/10805/)). |
| 17 | |
| 18 | ## Benchmark |
| 19 | |
| 20 | CPU: AMD Ryzen 7 2700X Eight-Core Processor, 3.7 GHz |
| 21 | |
| 22 | $ go test . -bench=Bench* -benchmem \ |
| 23 | | grep Bench \ |
| 24 | | perl -pe 's/\s\s+/\t/g' \ |
| 25 | | csvtk cut -Ht -f 1,3-5 \ |
| 26 | | csvtk add-header -t -n test,time,memory,allocs \ |
| 27 | | csvtk pretty -t -r |
| 28 | |
| 29 | test time memory allocs |
| 30 | ------------------------------------------ ------------ -------- ----------- |
| 31 | BenchmarkEncodeK32-16 19.67 ns/op 0 B/op 0 allocs/op |
| 32 | BenchmarkEncodeFromFormerKmerK32-16 7.692 ns/op 0 B/op 0 allocs/op |
| 33 | BenchmarkMustEncodeFromFormerKmerK32-16 2.008 ns/op 0 B/op 0 allocs/op |
| 34 | BenchmarkDecodeK32-16 80.73 ns/op 32 B/op 1 allocs/op |
| 35 | BenchmarkMustDecodeK32-16 76.93 ns/op 32 B/op 1 allocs/op |
| 36 | |
| 37 | BenchmarkRevK32-16 3.617 ns/op 0 B/op 0 allocs/op |
| 38 | BenchmarkCompK32-16 0.7999 ns/op 0 B/op 0 allocs/op |
| 39 | BenchmarkRevCompK32-16 3.814 ns/op 0 B/op 0 allocs/op |
| 40 | BenchmarkCannonalK32-16 4.147 ns/op 0 B/op 0 allocs/op |
| 41 | |
| 42 | ## History |
| 43 | |
| 44 | This package was originally maintained in [unikmer](https://github.com/shenwei356/unikmer). |