Antonie
fastq.hh
Go to the documentation of this file.
00001 #pragma once
00002 #include <string>
00003 #include <stdio.h>
00004 #include <stdint.h>
00005 #include <stdexcept>
00006 
00008 struct FastQRead
00009 {
00010   FastQRead() : reversed(false), position(0) {}
00011   std::string d_nucleotides;
00012   std::string d_quality;
00013   std::string d_header;
00014   bool exceedsQuality(unsigned int);
00015   std::string getSangerQualityString() const;
00016   void reverse();
00017   bool reversed;
00018   uint64_t position; 
00019 };
00020 
00022 class FASTQReader
00023 {
00024 public:
00025   FASTQReader(const std::string& str, unsigned int qoffset, unsigned int snipLeft=0, unsigned int snipRight=0);
00026 
00027   void seek(uint64_t pos) 
00028   {
00029     fseek(d_fp, pos, SEEK_SET);
00030   }
00031 
00032   unsigned int getRead(FastQRead* fq); 
00033 private:
00034   FILE *d_fp;
00035   unsigned int d_qoffset;
00036   unsigned int d_snipLeft, d_snipRight;
00037 };
00038 
00040 class StereoFASTQReader
00041 {
00042 public:
00043   StereoFASTQReader(const std::string& name1, const std::string& name2, 
00044                     unsigned int qoffset, unsigned int snipLeft=0, unsigned int snipRight=0) : d_fq1(name1, qoffset, snipLeft, snipRight), d_fq2(name2, qoffset, snipLeft, snipRight) 
00045   {}
00046 
00047   void seek(uint64_t pos);
00048 
00049   unsigned int getRead(uint64_t pos, FastQRead* fq2);
00050   unsigned int getReadPair(FastQRead* fq1, FastQRead* fq2);
00051 private:
00052   FASTQReader d_fq1, d_fq2;
00053   constexpr static uint64_t s_mask = ~(1ULL<<63);
00054 };
 All Classes Files Functions Variables Typedefs Friends Defines