| Class RecordReader Buffer management for streams.
RecordReader
Double-Pass RecordReader | Single-Pass RecordReader
Double-Pass String RecordReader
Single-Pass String RecordReader
RecordReader<TStream, TSpec> Include Headers seqan/stream.h Parameters
TStream | The StreamConcept type to work on.
TSpec | The record reader specialization to chose.
Specializations
Double-Pass RecordReader | Record reader specialization for double-pass reading.
Single-Pass RecordReader | Record reader specialization for single-pass reading.
Member Functions
RecordReader | Constructor
Functions
atEnd | Returns true if there is no more data to be read.
countLine | count characters in a line not including \r and \n
goNext | Advance record reader to next position.
guessStreamFormat | check whether the data provided by reader is (one of) the specified format(s).
nextIs | Query whether the next record is of a given type.
position | Returns the current position of the reader.
read2 | reads an entire document from a StreamConcept, by the means of RecordReader
readAlphaNums | Read characters from stream as long as characters are letters
readDigits | Read characters from stream as long as characters are digits
readDna5IgnoringWhitespaces | Read characters from stream, as long as they are DNA5 characters. Skip over whitespaces.
readFloat | Read characters from stream as long as the number is a valid floating point numbers.
readGraphs | Read characters from stream as long as characters are graph characters.
readIdentifier | Read characters from stream as long as characters are identifiers (alphanumeric, '-', and '_').
readLetters | Read characters from stream as long as characters are letters
readLine | Read a line from stream and save it to buffer
readLineStripTrailingBlanks | Read a line from stream and save it to buffer, remove trailing blanks
readNChars | Read exactly n characters from stream into buffer
readNCharsIgnoringWhitespace | Read n characters from stream into buffer, but skip certain Chars
readRecord | reads one record (e.g. a single DNA-sequence and its meta data) from a StreamConcept, by the means of RecordReader
readUntilBlank | Read characters from stream into buffer until Blank is encountered
readUntilChar | Read characters from stream into buffer until Char is encountered
readUntilOneOf | Read characters from stream into buffer until one of the given characters is encountered
readUntilTabOrLineBreak | Read characters from stream until a tab or line-break occurs.
readUntilWhitespace | Read characters from stream into buffer until Whitespace is encountered
resultCode | Returns int current status code for reader (0 on success).
setPosition | Returns the current position of the reader.
skipBlanks | Skip (i.e. read without saving) characters from stream until non-Blank is encountered
skipChar | Skip one character that must be equal to a given one for this function to succeed.
skipLine | Skip a line in stream and go to beginning of next
skipNChars | Skip exactly n characters from stream
skipNCharsIgnoringWhitespace | Skip n characters from stream, not counting whitespaces
skipUntilBlank | Skip (i.e. read without saving) characters from stream until Blank is encountered
skipUntilChar | Skip (i.e. read without saving) characters from stream until Char is encountered
skipUntilGraph | Skip (i.e. read without saving) characters from stream until printable, non-' ' character is encountered
skipUntilLineBeginsWithChar | Skip input until the first graphical(see isgraph) character of a line is equal to c
skipUntilLineBeginsWithOneCharOfStr | Skip input until a line begins with a one of the characters in str
skipUntilLineBeginsWithStr | Skip input until a line begins with str.
skipUntilString | Skip (i.e. read without saving) characters from stream until String is encountered
skipUntilWhitespace | Skip (i.e. read without saving) characters from stream until Whitespace is encountered
skipWhitespaces | Skip (i.e. read without saving) characters from stream until non-Whitespace is encountered
value | Returns the current value of the reader.
Examples File "record_reader.cpp"
1 | #include <fstream>
2 | #include <iostream>
3 |
4 | #include <seqan/seq_io.h>
5 | #include <seqan/sequence.h>
6 |
7 | int main()
8 | {
9 | seqan::CharString path = SEQAN_PATH_TO_ROOT();
10 | append(path, "/core/demos/input_output/example.fa");
11 |
12 | // Open file and create RecordReader.
13 | std::fstream in(toCString(path), std::ios::binary | std::ios::in);
14 | seqan::RecordReader<std::fstream, seqan::SinglePass<> > reader(in);
15 |
16 | // Read file record-wise.
17 | seqan::CharString id;
18 | seqan::Dna5String seq;
19 | while (!atEnd(reader))
20 | {
21 | if (readRecord(id, seq, reader, seqan::Fasta()) != 0)
22 | return 1; // Could not read record from file.
23 |
24 | std::cout << id << "\t" << seq << "\n";
25 | }
26 |
27 | return 0;
28 | }
See Also StreamConcept, read2, LimitRecordReaderInScope SeqAn - Sequence Analysis Library - www.seqan.de

Page built @2014/10/13 16:12:56