139 |
|
bool next_fastx_read(FLineReader& fr, Read& read, ReadFormat reads_format=FASTQ, |
140 |
|
FLineReader* frq=NULL); |
141 |
|
|
142 |
+ |
#define READSTREAM_BUF_SIZE 500000 |
143 |
|
class ReadStream { |
144 |
|
FLineReader* flquals; |
145 |
|
FLineReader* flseqs; |
165 |
|
bool next_read(Read& read, ReadFormat read_format=FASTQ); //get top read from the queue |
166 |
|
|
167 |
|
public: |
168 |
< |
ReadStream(int bufsize=500000):flquals(NULL), flseqs(NULL), stream_copy(false), b(NULL), |
168 |
> |
ReadStream(int bufsize=READSTREAM_BUF_SIZE):flquals(NULL), flseqs(NULL), stream_copy(false), b(NULL), |
169 |
|
bam_alt_name(false), fstream(), fquals(NULL),ReadBufSize(bufsize), read_pq(), |
170 |
|
last_id(0), r_eof(false) { } |
171 |
|
|
172 |
< |
ReadStream(const string& fname, FZPipe* pquals=NULL, int bufsize=500000):flquals(NULL), |
172 |
> |
ReadStream(const string& fname, FZPipe* pquals=NULL, bool guess_packer=false):flquals(NULL), |
173 |
|
flseqs(NULL), stream_copy(false), b(NULL), bam_alt_name(false), fstream(), |
174 |
< |
fquals(pquals), ReadBufSize(bufsize), read_pq(), last_id(0), r_eof(false) { |
175 |
< |
init(fname, pquals); |
174 |
> |
fquals(pquals), ReadBufSize(READSTREAM_BUF_SIZE), read_pq(), last_id(0), r_eof(false) { |
175 |
> |
init(fname, pquals, guess_packer); |
176 |
|
} |
177 |
|
ReadStream(FZPipe& f_stream, FZPipe* pquals=NULL):flquals(NULL), |
178 |
|
flseqs(NULL), stream_copy(true), b(NULL), bam_alt_name(false), fstream(f_stream), |
179 |
< |
fquals(pquals), ReadBufSize(500000), read_pq(), last_id(0), r_eof(false) { |
179 |
> |
fquals(pquals), ReadBufSize(READSTREAM_BUF_SIZE), read_pq(), last_id(0), r_eof(false) { |
180 |
|
//init(f_stream, pquals); |
181 |
|
if (fstream.is_bam) { |
182 |
|
b = bam_init1(); |
194 |
|
void use_alt_name(bool v=true) { |
195 |
|
bam_alt_name=v; |
196 |
|
} |
197 |
< |
void init(const string& fname, FZPipe* pquals=NULL) { |
198 |
< |
if (fstream.openRead(fname)==NULL) { |
197 |
> |
void init(const string& fname, FZPipe* pquals=NULL, bool guess_packer=false) { |
198 |
> |
if (fstream.openRead(fname, guess_packer)==NULL) { |
199 |
|
fprintf(stderr, "Warning: couldn't open file %s\n",fname.c_str()); |
200 |
|
return; |
201 |
|
} |