60 while (n_reads + read_mult <= max_reads &&
63 #if defined(NVBIO_WEAK_FASTQ_SUPPORT)
70 const int MAX_LINE = 32*1024;
71 char line_buffer[MAX_LINE];
74 if (
gets( line_buffer, MAX_LINE ) ==
false)
81 strcpy( (
char*)&
m_name[0], &line_buffer[1] );
86 log_error(stderr,
"FASTQ loader: incomplete read at line %u!\n",
m_line);
95 if (
gets( line_buffer, MAX_LINE ) ==
false)
97 log_error(stderr,
"FASTQ loader: incomplete read at line %u!\n",
m_line);
106 log_error(stderr,
"FASTQ loader: incomplete read at line %u!\n",
m_line);
120 while (marker >= 1 && marker <= 31);
139 for (
uint8 c =
get(); c !=
'\n' && c != 0; c =
get())
145 m_name.resize( len * 2u );
153 log_error(stderr,
"FASTQ loader: incomplete read at line %u!\n",
m_line);
163 for (
char c =
get(); c !=
'+' && c != 0; c =
get())
166 if (c >= 0x21 && c <= 0x7E)
179 const uint32 read_len = len;
184 log_error(stderr,
"FASTQ loader: incomplete read at line %u!\n",
m_line);
191 for (
char c =
get(); c !=
'\n' && c != 0; c =
get()) {}
196 log_error(stderr,
"FASTQ loader: incomplete read at line %u!\n",
m_line);
211 if (c >= 0x21 && c <= 0x7E)
241 log_error(stderr,
"FASTQ loader: incomplete read at line %u!\n",
m_line);
299 n_bps += read_mult * len;
300 n_reads += read_mult;
306 const char* read_file_name,
310 m_file =
gzopen(read_file_name,
"r");
347 log_error(stderr,
"error processing FASTQ file: zlib error %d (%s)\n", err, msg);
374 const char* file_name,
375 const char* compressor,
377 : m_file_name(file_name)
384 template <Alphabet ALPHABET>
394 sequence_data.
size() * 5 +
395 sequence_data.
bps() * 2 +
398 std::vector<char> buffer( buffer_len );
400 #pragma omp parallel for
403 const sequence_string
read = sequence_data.
get_read( i );
404 const qual_string qual = sequence_data.
get_quals( i );
405 const name_string name = sequence_data.
get_name( i );
409 buffer[ buffer_offset++ ] =
'@';
411 for (
uint32 j = 0; j < name.size(); ++j)
412 buffer[ buffer_offset++ ] = name[j];
415 buffer[ buffer_offset++ ] =
'\n';
417 to_string<ALPHABET>( read.begin(), read.size(), &buffer[0] + buffer_offset );
419 buffer_offset += read.size();
421 buffer[ buffer_offset++ ] =
'\n';
422 buffer[ buffer_offset++ ] =
'+';
423 buffer[ buffer_offset++ ] =
'\n';
426 for (
uint32 j = 0; j < read.size(); ++j)
427 buffer[ buffer_offset++ ] =
char( qual[j] );
429 buffer[ buffer_offset++ ] =
'\n';
432 if (output_file->
write( buffer_len, &buffer[0] ) == 0)