00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 #ifndef CGA_TOOLS_DNB_HPP_
00016 #define CGA_TOOLS_DNB_HPP_ 1
00017 
00019 
00020 #include "cgatools/core.hpp"
00021 #include "cgatools/util/Exception.hpp"
00022 
00023 #include <vector>
00024 #include <boost/array.hpp>
00025 
00026 namespace cgatools { namespace util {
00027     class DelimitedFile;
00028 }};
00029 
00030 namespace cgatools { namespace cgdata {
00031 
00032     class LibRecord {
00033         friend std::ostream& operator<< (std::ostream& out, const LibRecord& r);
00034     public:
00035         LibRecord():id_(0),arm_(0),indInArm_(0),objInArm_(0),minSize_(0),maxSize_(0) {}
00036 
00037         void initParser(util::DelimitedFile &delimitedFile);
00038 
00039         size_t          id_;
00040         std::string     type_;
00041         size_t          arm_;
00042         size_t          indInArm_;
00043         size_t          objInArm_;
00044         int             minSize_;
00045         int             maxSize_;
00046     };
00047 
00048     class HalfDnbStructure {
00049     public:
00050         class Gap {
00051         public:
00052             Gap():minSize_(0),maxSize_(0) {}
00053             int minSize_;
00054             int maxSize_;
00055         };
00056         typedef std::vector<Gap>    Gaps;
00057         typedef std::vector<size_t> Reads;
00058 
00059         HalfDnbStructure():totReadLength_(0) {}
00060 
00061         Reads getReadsForStrand(bool negativeStrand) const {
00062             if (negativeStrand) {
00063                 Reads result(reads_);
00064                 std::reverse(result.begin(),result.end());
00065                 return result;
00066             } else 
00067                 return reads_;
00068         }
00069 
00070         Gaps    gaps_;
00071         Reads   reads_;
00072         size_t  totReadLength_;
00073     };
00074 
00075     class DnbStructure {
00076     public:
00077         typedef std::vector<HalfDnbStructure>   HalfDnbs;
00078 
00079         void init(const std::string &libFile);
00080         void init(util::DelimitedFile &libFile);
00081 
00082         HalfDnbs                halfDnbs_;
00083     };
00084 
00085 } } 
00086 
00087 #endif // CGA_TOOLS_DNB_HPP_