DavidsonGroup / flexiplex

The Flexible Demultiplexer
https://davidsongroup.github.io/flexiplex/
MIT License
23 stars 2 forks source link

std::out_of_range when mapping reads #29

Closed ghar1821 closed 10 months ago

ghar1821 commented 10 months ago

Using flexiplex v0.97 or v1.0:

# with 0.97
./flexiplex \
    -l CGATTGACTA \
    -r TGCTAATGCG \
    -b 60 \
    -u 0 \
    -f 6 \
    -e 3 \
    -n test \
    -k $basedir/data/test.ref.txt \
    -p 6 \
    test_37.fasta
# with 1.0
./flexiplex 
    -x CGATTGACTA \
    -b ???????????????????????????????????????????????????????????? \
    -u "" \
    -x TGCTAATGCG \
    -f 6 \
    -e 3 \
    -n test \
    -k test.ref.txt \
    -p 4 \
    test_37.fasta

I ran into an error:

v0.97:

terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr
run_flexiplex.sh: line 5:  6881 Aborted                 (core dumped)

v1.0:

terminate called after throwing an instance of 'std::out_of_range'
    what():  basic_string::substr
  .command.sh: line 3: 52008 Aborted                 (core dumped)

The content of test_37.fasta file is:

>Cell_fake
ACTAGAGCTTTAAAGGTAACGTTCGAGGGAGGTTTGGAAGTTGCGTTGCACGATACATGG
GTTCTGCTAATGCGTACTGACTAGGCTAGCAAAAGAAAAGGGGGGACTGGAAGGGCTAAT
TCACTCCCAACGAAGACAAGATCTGCTTTT

Not quite sure what the problem is. When grepping the left and right flank, it can find the right flank but not the left. Could this be the problem?

olliecheng commented 10 months ago

Hi, thanks for reporting this! It seems like there is a partial match at the start of the string, which then had an offset applied. This resulted in an attempt to find substrings from index -1, which is out of bounds. Should be fixed now in #30, can you try that now? Thanks!

ghar1821 commented 10 months ago

I think it's fixed now (tested it on a small data). I'll test it on the bigger one now. Should still be fine. Tyvm for the speedy fix!

olliecheng commented 10 months ago

Perfect, let me know when you've tried it on the bigger set to see if it works - if so, I'll merge 😁

ghar1821 commented 10 months ago

@olliecheng just tested on the bigger set. it's working :)