Exemple #1
0
Set *load_false_positives() 
{
    int64_t NbInsertedKmers = 0;
    char * rseq;
    int readlen;
    kmer_type kmer, graine, graine_revcomp;

    Bank *FalsePositives = new Bank(return_file_name(false_positive_kmers_file));


    // alloc false positives with the just the right estimated size

    uint64_t nbFP = countFP(FalsePositives);

    FPSet *fp = new FPSet(nbFP);
    
    while (FalsePositives->get_next_seq(&rseq,&readlen))
    {
        kmer = extractKmerFromRead(rseq,0,&graine,&graine_revcomp);
                
        fp->insert(kmer);

        NbInsertedKmers++;

        if ((NbInsertedKmers%table_print_frequency)==0) fprintf (stderr,(char*)"%cInsert false positive Kmers in hash table %lld",13,NbInsertedKmers);
    }
    fp->finalize(); // always call this when finishing to create a FPSet

    fprintf (stderr,"\nInserted %lld false positive kmers in the hash structure.\n\n",NbInsertedKmers);

    print_size_summary(fp);

    return fp;
}
    inline bool existIn(const FileProperty& input, const FPSet& container, FileProperty& output)
    {
        auto iter = container.find(input);

        if(iter == container.end())
            return false;

        output = *iter;
        return true;
    }
    inline bool insertInto(const FileProperty& fp, FPSet& container)
    {
        if(container.find(fp) == container.end())
        {
            container.insert(fp);
            return true;
        }

        return false;
    }
 inline bool existIn(const FileProperty& input, const FPSet& container)
 {
     if(container.find(input) == container.end())
         return false;
     return true;
 }