Re: [Seqan-dev] Help me


Hi Julio,

Can yo specify more closely your problem?

When I compile your program and start it it outputs the correct matches.
What do you mean by "no count occurrences".
If you need to count the number of occurrences, you just have to increment a counter in the while loop.


 darwin10.0 : ./find_exact 
CAGCCGGATCGGGATCTATC


GATC
6,12,

Knut

Von: Julio Cesar Carbajal <carbaj1@hotmail.com>
Antworten an: SeqAn Development <seqan-dev@lists.fu-berlin.de>
Datum: Thu, 10 Feb 2011 17:45:22 +0100
An: "Tobias R." <seqan-dev@lists.fu-berlin.de>
Betreff: [Seqan-dev] Help me

Hello


Please, help me.

I have problem using a external file such as lagan1.fasta (Escherichia coli) with demo program: find_exact.cpp.
During the running of the program, the program no count occurrences of needle in the haystack.


Could you say me how to solve this problem.


Thanks.

Julio


/// THE CODE OF MY PROBLEM

#include <iostream>
#include <seqan/find.h>

#include <fstream>
#include <cstdio>

#include <seqan/sequence.h>
#include <seqan/file.h>


using namespace seqan;

int main()
{

// Open a file using a file reader string.
    String<char> my_haystack = String<char, FileReader<Fasta> > ("lagan1.fasta");

    String<char> my_needle = "GATC";

    Finder<String<char> > finder(my_haystack);
    Pattern<String<char>, Horspool> pattern(my_needle);
   
// proof printing: correct printing
    ::std::cout << my_haystack << "\n\n\n"; 
    ::std::cout << my_needle << "\n";   

// the problem: no count the find position of my_needle within the my_haystack.
// How to solve this problem?

    while (find(finder, pattern))
    {
        ::std::cout << position(finder) << ","; 
    }                         

    ::std::cout << ::std::endl;


    // fstrm.close();
    return (0);
}


Attachment: smime.p7s
Description: S/MIME cryptographic signature