3
// Created by: Sylvain Gaillard
4
// Created on: Wed Nov 5 2008
8
Copyright or © or Copr. CNRS, (November 5, 2008)
10
This software is a computer program whose purpose is to provide classes
11
for sequences analysis.
13
This software is governed by the CeCILL license under French law and
14
abiding by the rules of distribution of free software. You can use,
15
modify and/ or redistribute the software under the terms of the CeCILL
16
license as circulated by CEA, CNRS and INRIA at the following URL
17
"http://www.cecill.info".
19
As a counterpart to the access to the source code and rights to copy,
20
modify and redistribute granted by the license, users are provided only
21
with a limited warranty and the software's author, the holder of the
22
economic rights, and the successive licensors have only limited
25
In this respect, the user's attention is drawn to the risks associated
26
with loading, using, modifying and/or developing or reproducing the
27
software by the user in light of its specific status of free software,
28
that may mean that it is complicated to manipulate, and that also
29
therefore means that it is reserved for developers and experienced
30
professionals having in-depth computer knowledge. Users are therefore
31
encouraged to load and test the software's suitability as regards their
32
requirements in conditions enabling the security of their systems and/or
33
data to be ensured and, more generally, to use and operate it in the
34
same conditions as regards security.
36
The fact that you are presently reading this means that you have had
37
knowledge of the CeCILL license and that you accept its terms.
43
#include "ISequenceStream.h"
44
#include "../Sequence.h"
45
#include "../SequenceWithQuality.h"
50
* @brief The phd sequence file format from phred software.
52
* This class read DNA SequenceWithQuality from phd files produced by the
53
* phred program from the University of Washington.
58
* // Creating a SequenceWithQuality object
60
* SequenceWithQuality seq(&alpha);
61
* std::vector<int> pos;
63
* // Create a PhredPhd parser
67
* std::ifstream in("my_sequence.phd");
69
* // Read the sequence
70
* pp.nextSequence(in, seq, pos);
76
* @author Sylvain Gaillard
78
class PhredPhd: public ISequenceStream {
82
* @brief Build a new PhredPhd object.
86
virtual ~PhredPhd() {}
90
* @name The ISequenceStream interface.
97
) const throw (Exception);
101
* @brief Read a SequenceWithQuality from stream
106
SequenceWithQuality& seq
107
) const throw (Exception);
110
* @brief Read a SequenceWithQuality from stream and store chromatographic positions
112
* A more complete parser that read a SequenceWithQuality and store
113
* the position of each base call on the chromatogram in a vector of
116
* @param input The stram to read.
117
* @param seq The sequence to fill.
118
* @param pos The vector of positions to fill.
119
* @throw Exception IOException and Sequence related exceptions.
123
SequenceWithQuality& seq,
124
std::vector<int>& pos
125
) const throw (Exception);
128
* @name The IOFormat interface.
132
const std::string getDataType() const { return "SequenceWithQuality"; };
133
const std::string getFormatName() const { return "phd file"; };
134
const std::string getFormatDescription() const {
135
return "Sequences following the phd format as describe in the phred documentation.";
141
* @brief Global file parser
143
* @param input The stream to read
144
* @param name The string to store the sequence name
145
* @param sequence The string to store the sequence
146
* @param qual The vector to store qualities
147
* @param pos The vector to store positions
149
void parseFile_(std::istream& input, std::string& name, std::string& sequence, std::vector<int>& qual, std::vector<int>& pos) const;
152
* @brief Parse the DNA part of the file
154
* Read the DNA part until `END_DNA' or EOF.
156
* @param input The stream to read
157
* @param sequence The string to store the sequence
158
* @param qual The vector to store qualities
159
* @param pos The vector to store positions
161
void parseDNA_(std::istream& input, std::string& sequence, std::vector<int>& qual, std::vector<int>& pos) const;
163
} //end of namespace bpp
165
#endif // _PHREDPHD_H_