fix issue in WFBacktrace and change format to proper CIGAR,

add test to ensure CIGAR correctness in the case of different traceback results,
add DecodeCIGAR function to exports
This commit is contained in:
2024-11-07 19:01:01 +00:00
parent 3da3ddf10c
commit cde429cb80
6 changed files with 248 additions and 64 deletions

19
main.go
View File

@@ -9,6 +9,7 @@ import (
func main() {
c := make(chan bool)
js.Global().Set("wfAlign", js.FuncOf(wfAlign))
js.Global().Set("DecodeCIGAR", js.FuncOf(DecodeCIGAR))
<-c
}
@@ -70,3 +71,21 @@ func wfAlign(this js.Value, args []js.Value) interface{} {
return js.ValueOf(resultMap)
}
func DecodeCIGAR(this js.Value, args []js.Value) interface{} {
if len(args) != 1 {
fmt.Println("invalid number of args, requires 1: CIGAR")
return nil
}
if args[0].Type() != js.TypeString {
fmt.Println("s1 should be a string")
return nil
}
CIGAR := args[0].String()
decoded := wfa.RunLengthDecode(CIGAR)
return js.ValueOf(decoded)
}