Re: [Seqan-dev] Problem Reading Records
Hi Dan,
this is a bug in the documentation (the behaviour used to be this way but was changed in favour of following the "do not fail silently" motto).
Instead, you should load your sequence into a CharString/String<char> and then assign this to your Dna5String.
We plan to make this behaviour configurable at runtime but have not made the change yet.
I'm sorry for any caused confusion.
Cheers,
Manuel
________________________________________
From: Daniel Mapleson [daniel.mapleson@tgac.ac.uk]
Sent: Tuesday, August 13, 2013 12:19 PM
To: seqan-dev@lists.fu-berlin.de
Subject: [Seqan-dev] Problem Reading Records
Hello,
I work at the genome analysis centre in Norwich, UK, and am using SeqAn
within a project primarily to load sequences from FastQ and FastA files.
I have encountered a problem reading records when the record contains a
sequence outside the DNA5 alphabet. It was my understanding from the
documentation that any invalid characters would be automatically
converted to an 'N'. Instead the file reading seems to fail with no way
of continuing where it left off. Is this a known problem or am I doing
something wrong here?
Relevant code is as follows:
// Open file, create RecordReader and check all is well
std::fstream in(args->fasta_arg, std::ios::in);
seqan::RecordReader<std::fstream, seqan::SinglePass<> > reader(in);
// Create the AutoSeqStreamFormat object and guess the file format.
seqan::AutoSeqStreamFormat formatTag;
if (!guessStreamFormat(reader, formatTag))
{
cerr << "ERROR: Could not detect file format for: " <<
args->fasta_arg << endl;
return;
}
......
for (unsigned i = 0; (res == 0) && (i < BATCH_SIZE) &&
!atEnd(reader); ++i)
{
CharString id;
Dna5String seq; // Supposed to auto convert chars not in
{A,T,G,C,N} to N
res = seqan::readRecord(id, seq, reader, formatTag);
if (res == 0)
{
seqan::appendValue(names, id);
seqan::appendValue(seqs, seq);
recordIndex++;
}
else
{
cerr << endl << "ERROR: cannot finish processing all
records in file. Encountered an error reading file at record: " <<
recordIndex
<< "; Error code: " << res << "; Last sequence ID:
" << id << "; Continuing to process currently loaded records." << endl;
}
}
Best regards,
Dan Mapleson
_______________________________________________
seqan-dev mailing list
seqan-dev@lists.fu-berlin.de
https://lists.fu-berlin.de/listinfo/seqan-dev