dib-lab / kProcessor

kProcessor: kmers processing framework.
https://kprocessor.readthedocs.io
BSD 3-Clause "New" or "Revised" License
11 stars 1 forks source link

v2 `createMQF()` entered infinite loop #96

Open mr-eyes opened 2 years ago

mr-eyes commented 2 years ago

When I used this FASTA file with the following script, createMQF() and createBMQF() functions entered an infinite loop.

head100_tr.zip

#include <iostream>
#include "kDataFrame.hpp"
#include <string>
#include <vector>
#include "algorithms.hpp"
#include <math.h>
#include "kDataframes/kDataFrameMQF.hpp"
#include "kDataframes/kDataFrameSTL.hpp"

int main(int argc, char** argv) {
    string file_name = argv[1];
    int chunk_size = 10;
    int kSize = 25;

    readingModes RM = KMERS;
    hashingModes HM = integer_hasher;

    auto* KF = kDataFrameFactory::createPHMAP(kSize, HM);
    kmerDecoder* KD = kmerDecoder::getInstance(file_name, chunk_size, RM, HM, { {"kSize", kSize} });

    while (!KD->end()) {
        KD->next_chunk();
        for (const auto& seq : *KD->getKmers())
            for (const auto& kmer : seq.second)
                KF->insert(kmer.hash);
    }

    cout << "converting to MQF..." << endl;
    kDataFrame* kf_mqf = kDataFrameFactory::createMQF(KF);
    kf_mqf->save("test");

}