Class
RecordReader
Buffer management for streams.
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 RecordReaderRecord reader specialization for double-pass reading.
Single-Pass RecordReaderRecord reader specialization for single-pass reading.
Member Functions
RecordReaderConstructor
Functions
atEndReturns true if there is no more data to be read.
countLinecount characters in a line not including \r and \n
goNextAdvance record reader to next position.
guessStreamFormatcheck whether the data provided by reader is (one of) the specified format(s).
nextIsQuery whether the next record is of a given type.
positionReturns the current position of the reader.
read2reads an entire document from a StreamConcept, by the means of RecordReader
readAlphaNumsRead characters from stream as long as characters are letters
readDigitsRead characters from stream as long as characters are digits
readDna5IgnoringWhitespacesRead characters from stream, as long as they are DNA5 characters. Skip over whitespaces.
readFloatRead characters from stream as long as the number is a valid floating point numbers.
readGraphsRead characters from stream as long as characters are graph characters.
readIdentifierRead characters from stream as long as characters are identifiers (alphanumeric, '-', and '_').
readLettersRead characters from stream as long as characters are letters
readLineRead a line from stream and save it to buffer
readLineStripTrailingBlanksRead a line from stream and save it to buffer, remove trailing blanks
readNCharsRead exactly n characters from stream into buffer
readNCharsIgnoringWhitespaceRead n characters from stream into buffer, but skip certain Chars
readRecordreads one record (e.g. a single DNA-sequence and its meta data) from a StreamConcept, by the means of RecordReader
readUntilBlankRead characters from stream into buffer until Blank is encountered
readUntilCharRead characters from stream into buffer until Char is encountered
readUntilOneOfRead characters from stream into buffer until one of the given characters is encountered
readUntilTabOrLineBreakRead characters from stream until a tab or line-break occurs.
readUntilWhitespaceRead characters from stream into buffer until Whitespace is encountered
resultCodeReturns int current status code for reader (0 on success).
setPositionReturns the current position of the reader.
skipBlanksSkip (i.e. read without saving) characters from stream until non-Blank is encountered
skipCharSkip one character that must be equal to a given one for this function to succeed.
skipLineSkip a line in stream and go to beginning of next
skipNCharsSkip exactly n characters from stream
skipNCharsIgnoringWhitespaceSkip n characters from stream, not counting whitespaces
skipUntilBlankSkip (i.e. read without saving) characters from stream until Blank is encountered
skipUntilCharSkip (i.e. read without saving) characters from stream until Char is encountered
skipUntilGraphSkip (i.e. read without saving) characters from stream until printable, non-' ' character is encountered
skipUntilLineBeginsWithCharSkip input until the first graphical(see isgraph) character of a line is equal to c
skipUntilLineBeginsWithOneCharOfStrSkip input until a line begins with a one of the characters in str
skipUntilLineBeginsWithStrSkip input until a line begins with str.
skipUntilStringSkip (i.e. read without saving) characters from stream until String is encountered
skipUntilWhitespaceSkip (i.e. read without saving) characters from stream until Whitespace is encountered
skipWhitespacesSkip (i.e. read without saving) characters from stream until non-Whitespace is encountered
valueReturns the current value of the reader.
Examples
1#include <fstream>
2#include <iostream>
3
4#include <seqan/seq_io.h>
5#include <seqan/sequence.h>
6
7int main(int argc, char const ** argv)
8{
9    if (argc != 2)
10        return 1;  // Invalid number of arguments.
11
12    // Open file and create RecordReader.
13    std::fstream in(argv[1], 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}
SeqAn - Sequence Analysis Library - www.seqan.de
 

Page built @2013/07/11 09:12:35