cello
cello copied to clipboard
IndexDefect when using searchIndex.search
Hi @andreaferretti! I'm trying to use this awesome library for some bioinformatics but am running into a strange error:
import cello
let x = "CGGGACTTACTTGTGGTTCCTGTGGTGCACTCCTGACCCTGCCGCTTTGAAAGAAAAAGAAATGAGGCGAAGAAGTCCTTCAGGGATCCCCGGGGAAACCTGGAGGAAGTCCGACGAGATCGCGGCTGGGGCTTAGGACCCCACTCCTGCGAGACAGGAGTAATCCTAAACAGGGTTTTCACCCTTCCTTTAGTTTCCTTCCTCTCCTGGAGAGGTCTTCTGCCCTAGCCCGGTCTTCGAAGCTTCCTTTGGCTACTACCCGGTGGAAACAACTGAAGCTTCAACGCCTTTTTTTCCAATCTTCTTTAGCACCGGGCTAGGGAGTAAGCCCGTGGAACCTTAGTTTTGTTCCCT"
# works
let index2 = searchIndex(x[0..x.high-1])
echo index2.search(x[0..1])
# breaks
let index1 = searchIndex(x)
echo index1.search(x[0..1])
This specific sequence is unable to be searched, although removing the last character does allow it to be search. Do you have any idea why that could be?
Ps here's the traceback:
BenjaminLee@mbp ~/r/playground [1]> nim r monomerize.nim (viroid-search)
Hint: used config file '/usr/local/Cellar/nim/1.6.0/nim/config/nim.cfg' [Conf]
Hint: used config file '/usr/local/Cellar/nim/1.6.0/nim/config/config.nims' [Conf]
....................................................................................................
CC: monomerize.nim
Hint: [Link]
Hint: gc: refc; opt: none (DEBUG BUILD, `-d:release` generates faster code)
58492 lines; 1.388s; 93.918MiB peakmem; proj: /Users/BenjaminLee/research/playground/monomerize.nim; out: /Users/BenjaminLee/.cache/nim/monomerize_d/monomerize_4651918B165140654B6F77303C1F7E8C0EB6DBDA [SuccessX]
Hint: /Users/BenjaminLee/.cache/nim/monomerize_d/monomerize_4651918B165140654B6F77303C1F7E8C0EB6DBDA [Exec]
@[67, 237, 111, 149, 114, 284, 120, 42, 122, 0, 312, 90, 230, 260, 330]
/Users/BenjaminLee/research/playground/monomerize.nim(12) monomerize
/Users/BenjaminLee/.nimble/pkgs/cello-0.3.0/cello.nim(802) search
/Users/BenjaminLee/.nimble/pkgs/cello-0.3.0/cello.nim(795) search
/Users/BenjaminLee/.nimble/pkgs/cello-0.3.0/cello.nim(435) rank
/Users/BenjaminLee/.nimble/pkgs/cello-0.3.0/cello.nim(434) rank
/Users/BenjaminLee/.nimble/pkgs/cello-0.3.0/cello.nim(320) rank
/usr/local/Cellar/nim/1.6.0/nim/lib/system/fatal.nim(53) sysFatal
Error: unhandled exception: index 4 not in 0 .. 3 [IndexDefect]
Error: execution of an external program failed: '/Users/BenjaminLee/.cache/nim/monomerize_d/monomerize_4651918B165140654B6F77303C1F7E8C0EB6DBDA '
Hi @Benjamin-Lee sorry it took a while to ackowledge your issue, I recently had a newborn :-)
I am going to see what's going on here, it's definitely strange!