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_CGDATA_CNVSEGMENTSTORE_HPP_ 00016 #define CGATOOLS_CGDATA_CNVSEGMENTSTORE_HPP_ 1 00017 00019 00020 #include "cgatools/core.hpp" 00021 #include "cgatools/reference/RangeAnnotationStore.hpp" 00022 #include "cgatools/cgdata/GenomeMetadata.hpp" 00023 00024 namespace cgatools { namespace cgdata { 00025 00028 struct CnvSegmentData 00029 { 00030 double relativeCoverage_; 00031 std::string calledPloidy_; 00032 }; 00033 00035 class CnvSegmentStore : 00036 public reference::RangeAnnotationStore<CnvSegmentStore, CnvSegmentData> 00037 { 00038 public: 00040 CnvSegmentStore(const reference::CrrFile& crr, const GenomeMetadata& exp) 00041 : Base(crr) 00042 { 00043 load( exp.getCnvSegmentsFileName() ); 00044 } 00045 00047 bool hasCalledPloidy() const { return hasCalledPloidy_; } 00048 00052 const CnvSegmentData* getBestOverlappingSegment(const reference::Range& r) const; 00053 00054 public: 00056 void bindColumns(util::DelimitedFile& df, reference::Range& range, CnvSegmentData& data); 00057 00058 private: 00059 bool hasCalledPloidy_; 00060 }; 00061 00062 }} 00063 00064 #endif