util

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteLengthUint32 added in v0.3.0

func ByteLengthUint32(n uint32) uint8

ByteLengthUint32 returns the minimum number of bytes to store a integer.

func ByteLengthUint64 added in v0.3.0

func ByteLengthUint64(n uint64) uint8

ByteLengthUint64 returns the minimum number of bytes to store a integer.

func CtrlByte2ByteLengthsUint32 added in v0.3.0

func CtrlByte2ByteLengthsUint32(ctrl byte) int

CtrlByte2ByteLengthsUint32 returns the byte length for a given control byte.

func CtrlByte2ByteLengthsUint64 added in v0.3.0

func CtrlByte2ByteLengthsUint64(ctrl byte) int

CtrlByte2ByteLengthsUint64 returns the byte length for a given control byte.

func IsLowComplexity added in v0.5.0

func IsLowComplexity(code uint64, k uint8) bool

IsLowComplexity checks k-mer complexity according to the frequencies of 2-mer and 3-mer.

func IsLowComplexityDust added in v0.5.0

func IsLowComplexityDust(code uint64, k uint8) bool

IsLowComplexity checks k-mer complexity with DUST algorithm

func KmerBaseAt

func KmerBaseAt(code uint64, k uint8, i uint8) uint8

KmerBaseAt returns the base in pos i (0-based).

func KmerHasPrefix

func KmerHasPrefix(code uint64, prefix uint64, k1, k2 uint8) bool

KmerHasPrefix checks if a k-mer has a prefix.

func KmerHasSuffix added in v0.3.0

func KmerHasSuffix(code uint64, suffix uint64, k1, k2 uint8) bool

KmerHasSuffix checks if a k-mer has a suffix.

func KmerLongestPrefix

func KmerLongestPrefix(code1, code2 uint64, k1, k2 uint8) uint8

KmerLongestPrefix returns the length of the longest prefix.

func KmerPrefix

func KmerPrefix(code uint64, k uint8, n uint8) uint64

KmerPrefix returns the first n bases. n needs to be > 0. The length of the prefix is n.

func KmerSuffix

func KmerSuffix(code uint64, k uint8, i uint8) uint64

KmerSuffix returns the suffix starting from position i (0-based). The length of the suffix is k - commonPrefix.

func MustKmerHasPrefix

func MustKmerHasPrefix(code uint64, prefix uint64, k1, k2 uint8) bool

MustKmerHasPrefix checks if a k-mer has a prefix, by assuming k1>=k2.

func MustKmerHasSuffix added in v0.3.0

func MustKmerHasSuffix(code uint64, suffix uint64, k1, k2 uint8) bool

MustKmerHasSuffix checks if a k-mer has a suffix, by assuming k1>=k2.

func MustKmerLongestPrefix

func MustKmerLongestPrefix(code1, code2 uint64, k1, k2 uint8) uint8

MustKmerLongestPrefix returns the length of the longest prefix. We assume k1 >= k2.

func MustSharingPrefixKmersMismatch

func MustSharingPrefixKmersMismatch(code1, code2 uint64, k, p uint8) (n uint8)

MustSharingPrefixKmersMismatch counts the number of mismatch between two k-mers sharing with a p-bp prefix. This function assumes p<k.

func MustSharingPrefixKmersSuffixMatches added in v0.4.0

func MustSharingPrefixKmersSuffixMatches(code1, code2 uint64, k, p uint8) (n uint8)

MustSharingPrefixKmersSuffixMatches counts the number of matches in the suffix region of two k-mers sharing with a p-bp prefix.

func Ns added in v0.5.0

func Ns(b uint64, k uint8) (code uint64)

func PutUint32s added in v0.3.0

func PutUint32s(buf []byte, v1, v2, v3, v4 uint32) (ctrl byte, n int)

PutUint32s encodes four uint32s into 4-16 bytes, and returns control byte and encoded byte length.

func PutUint64s

func PutUint64s(buf []byte, v1, v2 uint64) (ctrl byte, n int)

PutUint64s encodes two uint64s into 2-16 bytes, and returns control byte and encoded byte length.

func ReverseInts

func ReverseInts(s []int)

ReverseInts reverses a list of ints

func SharingPrefixKmersMismatch

func SharingPrefixKmersMismatch(code1, code2 uint64, k, p uint8) (n uint8)

SharingPrefixKmersMismatch counts the number of mismatch between two k-mers sharing with a p-bp prefix.

func SharingPrefixKmersSuffixMatches added in v0.4.0

func SharingPrefixKmersSuffixMatches(code1, code2 uint64, k, p uint8) (n uint8)

SharingPrefixKmersMatches counts the number of matches in the suffix region of two k-mers sharing with a p-bp prefix.

func Uint32s added in v0.3.0

func Uint32s(ctrl byte, buf []byte) (v1, v2, v3, v4 uint32, n int)

Uint32s decodes encoded bytes.

func Uint64s

func Uint64s(ctrl byte, buf []byte) (v1, v2 uint64, n int)

Uint64s decodes encoded bytes.

func UniqUint64s

func UniqUint64s(list *[]uint64)

UniqUint64s removes duplicates in a uint64 list

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL