Skip to content
Snippets Groups Projects
Commit ae399836 authored by Veronique Legrand's avatar Veronique Legrand
Browse files

bugfix: pb sometimes occured while computing fastq record length.

parent 879579ac
No related branches found
No related tags found
No related merge requests found
......@@ -112,7 +112,8 @@ void FqBaseBackend::writeToOutput(const unsigned long& offset) {
int fq_rec_size=getRead(offset,pos_in_w_buf); // here aim is to avoid multiple strcpy into buffer: read directly at the right place in the buffer.
#ifdef DEBUG
cout<<*(pos_in_w_buf+fq_rec_size-1)<<endl;
cout<<"read "<<fq_rec_size<<" char from offset: "<<offset<<" and stored them in o_buf at position: "<<pos_in_w_buf<<endl;
cout<<"last char read: "<<*(pos_in_w_buf+fq_rec_size-1)<<endl;
assert(*(pos_in_w_buf+fq_rec_size-1)=='\n');
assert(*(pos_in_w_buf)=='@');
#endif
......@@ -147,12 +148,14 @@ int FqBaseBackend::getRead(const unsigned long& offset, char * fq_record) {
}
nread=read(i_f_desc,fq_record,MAX_FQ_RECORD_LENGTH);
#ifdef DEBUG
assert(nread<=MAX_FQ_RECORD_LENGTH);
assert(*(fq_record)=='@');
cout<<"read: "<<nread<<" char from input file"<<endl;
#endif
nb_lines=0;
i=1;
pchar=fq_record;
while(i<nread) {
while(i<=nread) {
if (*pchar=='\n') {
nb_lines++;
if (nb_lines==4) {
......@@ -163,5 +166,8 @@ int FqBaseBackend::getRead(const unsigned long& offset, char * fq_record) {
pchar++;
i++;
}
#ifdef DEBUG
cout<<"found that fq record size is : "<<fq_rec_size<<endl;
#endif
return fq_rec_size;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment