00001 // Copyright 2010 Complete Genomics, Inc. 00002 // 00003 // Licensed under the Apache License, Version 2.0 (the "License"); you 00004 // may not use this file except in compliance with the License. You 00005 // may obtain a copy of the License at 00006 // 00007 // http://www.apache.org/licenses/LICENSE-2.0 00008 // 00009 // Unless required by applicable law or agreed to in writing, software 00010 // distributed under the License is distributed on an "AS IS" BASIS, 00011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 00012 // implied. See the License for the specific language governing 00013 // permissions and limitations under the License. 00014 00015 #ifndef CGATOOLS_CGIDATA_EVIDENCEREADER_HPP_ 00016 #define CGATOOLS_CGIDATA_EVIDENCEREADER_HPP_ 1 00017 00019 00020 #include "cgatools/core.hpp" 00021 #include "cgatools/util/DelimitedFile.hpp" 00022 #include "cgatools/reference/CrrFile.hpp" 00023 #include "cgatools/cgidata/CgiData.hpp" 00024 00025 #include <boost/noncopyable.hpp> 00026 #include <boost/scoped_ptr.hpp> 00027 #include <boost/shared_ptr.hpp> 00028 00029 namespace cgatools { namespace cgidata { 00030 00031 class EvidenceIntervalsReader : boost::noncopyable 00032 { 00033 public: 00034 EvidenceIntervalsReader(const reference::CrrFile& crr, 00035 const CgiExportPackage& exp); 00036 00037 void seek(const reference::Range& r); 00038 00041 uint32_t getScore() const 00042 { 00043 if (!inInterval_) 00044 return 0; 00045 else 00046 return file_->score_; 00047 } 00048 00049 private: 00050 struct File 00051 { 00052 std::string filename_; 00053 boost::shared_ptr<std::istream> f_; 00054 util::DelimitedFile parser_; 00055 uint32_t offset_; 00056 uint32_t length_; 00057 int32_t score_; 00058 00059 File(const std::string& fn); 00060 }; 00061 00062 const reference::CrrFile& crr_; 00063 const CgiExportPackage& exp_; 00064 00065 uint16_t chromosome_; 00066 boost::scoped_ptr<File> file_; 00067 00068 bool inInterval_; 00069 }; 00070 00071 } } // cgatools::cgidata 00072 00073 #endif // CGATOOLS_CGIDATA_EVIDENCEREADER_HPP_