~vejnar/bktrim

Read trimming using bit-masked k-difference matching in Go
Initial commit

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~vejnar/bktrim
read/write
git@git.sr.ht:~vejnar/bktrim

You can also use your local clone with git send-email.

#bktrim

Fast and accurate adapter trimming for processing next-generation sequencing (NGS) paired-end sequences.

Go implementation of the bit-masked k-difference matching algorithm translated from skewer (see publication in BMC Bioinformatics).

#Installation

$ go get git.sr.ht/~vejnar/bktrim

#Example

package main

import (
	"fmt"
	"strings"

	"git.sr.ht/~vejnar/bktrim"
)

func main() {

	seq1 := []byte("GGGCCTCGAGAGCCACCATTCTGTAAAATTGAAGCACATTTTTCATTGTGTTTGGATCCGTCAGATCGGAAGAGCA")
	seq2 := []byte("GACGGATCCAAACACAATGAAAAATGTGCTTCAATTTTACAGAATGGTGGCTCTCGAGGCCCAGATCGGAAGAGCA")
	quality1 := []byte("IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII")
	quality2 := []byte("IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII")

	// Alignment parameters
	epsilon := 0.1
	delta := 0.15
	minOverlap := 3
	baseQual := 33

	m := bktrim.NewMatrix(epsilon, delta, minOverlap, baseQual)

	// Upstream adapter
	adapter1 := []byte("AGATCGGAAGAGCACACGTCTGAACTCCAGTCAC")
	m.AddAdapter(adapter1, bktrim.TRIM_TAIL, 0)
	// Downstream adapter
	adapter2 := []byte("AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGTA")
	m.AddAdapter(adapter2, bktrim.TRIM_TAIL, 1)

	// Align
	determined, solution1, solution2 := m.FindAdapterWithPE(seq1, quality1, seq2, quality2)

	if determined {
		if m.CombinePairSeqs(seq1, quality1, seq2, quality2, solution1.Pos, solution2.Pos) {
			fmt.Println(strings.Repeat("-", solution1.Pos) + string(adapter1))
			fmt.Println(string(seq1))
			fmt.Println(strings.Repeat("-", solution2.Pos) + string(adapter2))
			fmt.Println(string(seq2))
		}
	}
}

#License

bktrim is distributed under the Mozilla Public License Version 2.0 (see /LICENSE).

Copyright (C) 2020-2022 Charles E. Vejnar