Edgewall Software

Opened 11 years ago

Closed 11 years ago

#11207 closed defect (invalid)

seqan::SequenceStream cannot open FASTQ files — at Version 1

Reported by: d.lyberg@… Owned by:
Priority: normal Milestone:
Component: general Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Jun Omae)

Using Seqan v. 1.4, I was trying to open a FASTQ file with SequenceStream using this pseudocode:

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

typedef sq::Iterator<sq::StringSet<sq::Dna5String>>::Type SeqIterator;
typedef sq::Iterator<sq::StringSet<sq::CharString>>::Type CharIterator;

SeqIterator it_seq;
CharIterator it_qual, it_id;
const int n_seqs = 10000;
int res;
std::string fastq_f_in = "reads.fastq";
seqan::StringSet<seqan::CharString> ids;
seqan::StringSet<seqan::Dna5String> seqs;
seqan::StringSet<seqan::CharString> quals;
seqan::SequenceStream fastq_ipt(fastq_f_in.c_str(),
    seqan::SequenceStream::READ,
    seqan::SequenceStream::FileFormat::FASTQ);

if (!seqan::isGood(fastq_ipt))
{
  cout << "error opening file " << fastq_f_in << endl;
  //return 1;
}

res = seqan::readBatch(ids, seqs, fastq_ipt, n_seqs);

if (!res)
{
  cout << "error reading file " << fastq_f_in << endl;
  //return 1;
}

for (it_id = sq::begin(ids), it_seq = sq::begin(seqs), it_qual = sq::begin(quals);
    it_id != sq::end(ids), it_seq != sq::end(seqs), it_qual != sq::end(quals);
    it_id++, it_seq++, it_qual++)
{
  cout << *it_id;
  cout << "\t" << *it_seq;
  cout << "\t" << *it_qual;
  cout << endl;
}

But I end up with this output message:

error reading file reads.fastq
ERROR: Could not read from FASTA file

The return statements are canceled to display all error messages. Obviously, there is something that makes SequenceStream believe that I want to open a FASTA file. But on the example page http://trac.seqan.de/wiki/Tutorial/BasicSequenceIO, there are files ending with .fq indicating that FASTQ files should work too.

Change History (1)

comment:1 by Jun Omae, 11 years ago

Description: modified (diff)
Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.