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 std::string calledLevel_; 00033 }; 00034 00036 class CnvSegmentStore : 00037 public reference::RangeAnnotationStore<CnvSegmentStore, CnvSegmentData> 00038 { 00039 public: 00041 CnvSegmentStore(const reference::CrrFile& crr, const GenomeMetadata& exp, 00042 bool isDiploid) 00043 : Base(crr) 00044 { 00045 if (isDiploid) 00046 load( exp.getCnvSegmentsDiploidFileName() ); 00047 else 00048 load( exp.getCnvSegmentsNondiploidFileName() ); 00049 } 00050 00052 bool hasCalledPloidy() const { return hasCalledPloidy_; } 00053 00055 bool hasCalledLevel() const { return hasCalledLevel_; } 00056 00060 const CnvSegmentData* getBestOverlappingSegment(const reference::Range& r) const; 00061 00062 public: 00064 void bindColumns(util::DelimitedFile& df, reference::Range& range, CnvSegmentData& data); 00065 00066 private: 00067 bool hasCalledPloidy_; 00068 bool hasCalledLevel_; 00069 }; 00070 00071 }} 00072 00073 #endif