Hi Manuel and other list members, thank you for your help. I attached the only source file, the results i get and the input file i use (it's gzipped only for the attachment). I think, its possible that i make something wrong, but why does it work for the first two records, and why not for the others? I tried formerly the basic IO features of the library (just read and dump), and everything went proper. And this is the v1.4.0. Thanks again, and sorry if my problem would be too banal. Daniel Live long and prosper Bartha Dániel MTA-VMRI, 2013 2013/7/15 Holtgrewe, Manuel <manuel.holtgrewe@fu-berlin.de>: > Hi Daniel, > > if possible then please use English. > > Can you send the FASTA file (or a part that gives you problems) to the list together with the .cpp program so we can have a look? > > Thanks, > Manuel > ________________________________________ > From: Bartha Dániel [daniel.bartha@gmail.com] > Sent: Monday, July 15, 2013 5:34 PM > To: seqan-dev@lists.fu-berlin.de > Subject: [Seqan-dev] readRecord error > > Greetings Everyone, > > i am quite new by sequan, and i have a problem. > > I want to use the the readRecord function. I the tutorials and the > documentation, and made a simple program: > > SequenceStream inStream(argv[1]); > if ( isGood(inStream) ) > { > while ( !atEnd(inStream) ) > { > String<char> id; > String<Dna5> seq; > if (readRecord(id, seq, inStream) != 0){std::cerr << "ERROR: > readRecord\n";return 1;} > > (...) > } > } > > I read from a fasta file, and make something with the sequences at > character level, it doesn't matter, what. The two first sequences > are readed, but then i get my error message, independent from the > content of the third record, for example even if i copy the first > record after the second, it is the same. > > is there a special behaviour of the fasta parsing i have to know, or > do i make something wrong? I use linux, i wrote a simple console > application, and the its input independent as far as i see. > > And an other question: is the german language allowed on this mailing list? > > Many-many thanks! > > Daniel > > Live long and prosper > Bartha Dániel > MTA-VMRI, 2013 > > _______________________________________________ > seqan-dev mailing list > seqan-dev@lists.fu-berlin.de > https://lists.fu-berlin.de/listinfo/seqan-dev > > _______________________________________________ > seqan-dev mailing list > seqan-dev@lists.fu-berlin.de > https://lists.fu-berlin.de/listinfo/seqan-dev
Attachment:
last_run.log
Description: Binary data
Attachment:
PA.fa.gz
Description: GNU Zip compressed data
#include <iostream> #include <vector> #include <seqan/sequence.h> #include <seqan/seq_io.h> #include <seqan/random.h> #include <seqan/stream.h> using namespace seqan; void clear(std::vector<int>& v) { for (unsigned i=0; i<v.size(); i++) { v[i]=0; } } void sum(std::vector<int>& v) { for (unsigned i=1; i<4; i++) { v[0]+=v[i]; } } int main(int argc, char const ** argv) { std::vector<int> A(4,0); std::vector<int> C(4,0); std::vector<int> G(4,0); std::vector<int> T(4,0); std::vector<int> I(4,0); SequenceStream inStream(argv[1]); if ( isGood(inStream) ) { while ( !atEnd(inStream) ) { String<char> id; String<Dna5> seq; if (readRecord(id, seq, inStream) != 0){std::cerr << "ERROR: readRecord\n";return 1;} clear(A);clear(C);clear(G);clear(T);clear(I); for (unsigned i=0; i<length(seq); i++) { for (unsigned k=1; k<4; k++) { if( seq[i]=='A' )A[k]++; if( seq[i]=='C' )C[k]++; if( seq[i]=='G' )G[k]++; if( seq[i]=='T' )T[k]++; if( seq[i]!='A' && seq[i]!='C' && seq[i]!='G' && seq[i]!='T' )I[k]++; } } sum(A);sum(C);sum(G);sum(T);sum(I); std::cout << id << '\t'<< A[0]+C[0]+G[0]+T[0] << '\t' << A[0] << '\t' << C[0] << '\t' << G[0] << '\t' << T[0] << '\n'; } } //SequenceStream outStream(argv[2], SequenceStream::WRITE); //if (writeRecord(outStream, id, seq)!=0)std::cerr << "ERROR: nem tudtam fajlba irni!\n"; return 0; }