ruanjue / wtdbg2

Redbean: A fuzzy Bruijn graph approach to long noisy reads assembly
GNU General Public License v3.0
513 stars 94 forks source link

Bug or intended? #91

Closed FluorineDog closed 5 years ago

FluorineDog commented 5 years ago

i am working on optimization of map_kbm, the largest hotspot in wtdbg2. but when analyzing the code, I found a strange break:

https://github.com/ruanjue/wtdbg2/blob/8908a3162362df842e540658a45222f764e629a7/kbm.h#L2156-L2165 is this break a bug, or just intended?

ruanjue commented 5 years ago

To speed up the sorting of seeds, aux->heaps is used to split them into many small intervals. Seeds are fetched and added into aux->heaps for further use in push_kmer_match_kbm. So, here the break is correct.

FluorineDog commented 5 years ago

As a matter of fact, the above code is equivalent to:

 for(i=0;i<aux->refs->size;i++){ 
    ref = ref_kbmrefv(aux->refs, i); 
    if(ref->boff < ref->bend){ 
        hidx = ref->bidx / aux->bmcnt; 
        if(hidx - aux->bmoff < aux->nheap){ 
            push_u4v(aux->heaps[hidx - aux->bmoff], i); 
        } 
    } 
 } 

Is this transformation still correct?

ruanjue commented 5 years ago

Yes, the same.

FluorineDog commented 5 years ago

Thank you for your kind clarification. Issus closed.