bpp-seq  2.2.0
bpp::PhredPhd Class Reference

The phd sequence file format from phred software. More...

#include <Bpp/Seq/Io/PhredPhd.h>

+ Inheritance diagram for bpp::PhredPhd:
+ Collaboration diagram for bpp::PhredPhd:

Public Member Functions

 PhredPhd ()
 Build a new PhredPhd object. More...
 
virtual ~PhredPhd ()
 
bool nextSequence (std::istream &input, Sequence &seq, std::vector< int > &pos) const throw (Exception)
 Read a SequenceWithQuality from stream and store chromatographic positions. More...
 
The ISequenceStream interface.
bool nextSequence (std::istream &input, Sequence &seq) const throw (Exception)
 Read sequence from stream. More...
 
The IOFormat interface.
const std::string getDataType () const
 
const std::string getFormatName () const
 
const std::string getFormatDescription () const
 

Private Member Functions

bool parseFile_ (std::istream &input, std::string &name, std::string &sequence, std::vector< int > &qual, std::vector< int > &pos) const
 Global file parser. More...
 
bool parseDNA_ (std::istream &input, std::string &sequence, std::vector< int > &qual, std::vector< int > &pos) const
 Parse the DNA part of the file. More...
 

Detailed Description

The phd sequence file format from phred software.

This class read DNA SequenceWithQuality from phd files produced by the phred program from the University of Washington.

Usage
// Creating a SequenceWithQuality object
DNA alpha;
SequenceWithQuality seq(&alpha);
std::vector<int> pos;
// Create a PhredPhd parser
// Opening the file
std::ifstream in("my_sequence.phd");
// Read the sequence
pp.nextSequence(in, seq, pos);
// Close the file
in.close();
Author
Sylvain Gaillard

Definition at line 78 of file PhredPhd.h.

Constructor & Destructor Documentation

◆ PhredPhd()

bpp::PhredPhd::PhredPhd ( )
inline

Build a new PhredPhd object.

Definition at line 84 of file PhredPhd.h.

◆ ~PhredPhd()

virtual bpp::PhredPhd::~PhredPhd ( )
inlinevirtual

Definition at line 86 of file PhredPhd.h.

Member Function Documentation

◆ getDataType()

const std::string bpp::PhredPhd::getDataType ( ) const
inline

Definition at line 123 of file PhredPhd.h.

◆ getFormatDescription()

const std::string bpp::PhredPhd::getFormatDescription ( ) const
inline

Definition at line 125 of file PhredPhd.h.

◆ getFormatName()

const std::string bpp::PhredPhd::getFormatName ( ) const
inline

Definition at line 124 of file PhredPhd.h.

◆ nextSequence() [1/2]

bool PhredPhd::nextSequence ( std::istream &  input,
Sequence seq 
) const
throw (Exception
)
virtual

Read sequence from stream.

Read one sequence from a stream.

Parameters
inputThe stream to read.
seqThe sequence to fill.
Returns
true if a sequence was read or false if not.
Exceptions
ExceptionIOExecption and Sequence related Exceptions.

Implements bpp::ISequenceStream.

Definition at line 52 of file PhredPhd.cpp.

◆ nextSequence() [2/2]

bool PhredPhd::nextSequence ( std::istream &  input,
Sequence seq,
std::vector< int > &  pos 
) const
throw (Exception
)

Read a SequenceWithQuality from stream and store chromatographic positions.

A more complete parser that read a SequenceWithQuality and store the position of each base call on the chromatogram in a vector of int.

Parameters
inputThe stram to read.
seqThe sequence to fill.
posThe vector of positions to fill.
Exceptions
ExceptionIOException and Sequence related exceptions.

Definition at line 59 of file PhredPhd.cpp.

References bpp::SequenceWithQuality::setQualities().

◆ parseDNA_()

bool PhredPhd::parseDNA_ ( std::istream &  input,
std::string &  sequence,
std::vector< int > &  qual,
std::vector< int > &  pos 
) const
private

Parse the DNA part of the file.

Read the DNA part until ‘END_DNA’ or EOF.

Parameters
inputThe stream to read
sequenceThe string to store the sequence
qualThe vector to store qualities
posThe vector to store positions

Definition at line 115 of file PhredPhd.cpp.

Referenced by parseFile_().

◆ parseFile_()

bool PhredPhd::parseFile_ ( std::istream &  input,
std::string &  name,
std::string &  sequence,
std::vector< int > &  qual,
std::vector< int > &  pos 
) const
private

Global file parser.

Parameters
inputThe stream to read
nameThe string to store the sequence name
sequenceThe string to store the sequence
qualThe vector to store qualities
posThe vector to store positions

Definition at line 84 of file PhredPhd.cpp.

References parseDNA_().


The documentation for this class was generated from the following files: