FastQ.h

00001 /*
00002  *  Copyright (C) 2010  Regents of the University of Michigan
00003  *
00004  *   This program is free software: you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation, either version 3 of the License, or
00007  *   (at your option) any later version.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License
00015  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #ifndef _FASTQ_H
00019 #define _FASTQ_H
00020 #include <iostream>
00021 #include <string>
00022 #include <math.h>
00023 
00024 class FastQ
00025 {
00026 public:
00027     bool valid;
00028     FastQ()
00029     {
00030         clear();
00031     }
00032     void clear()
00033     {
00034         valid=false;
00035     }
00036     std::string  tag;
00037     std::string  data;
00038     std::string  tag2;
00039     std::string  quality;
00040     void read(std::istream &);
00041     void write(std::ostream &);
00042 };
00043 
00044 inline std::istream &operator >> (std::istream &stream, FastQ &f)
00045 {
00046     f.read(stream);
00047     return stream;
00048 }
00049 
00050 inline std::ostream &operator << (std::ostream &stream, FastQ &f)
00051 {
00052     f.write(stream);
00053     return stream;
00054 }
00055 
00056 inline double phred2double(const char& c)
00057 {
00058     double errorProb=pow(10,-double((c-'!'))/10);
00059     return errorProb;
00060 }
00061 
00062 #endif
Generated on Wed Nov 17 15:38:28 2010 for StatGen Software by  doxygen 1.6.3