00001 // Copyright 2011 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_CNVDETAILSTORE_HPP_ 00016 #define CGATOOLS_CGDATA_CNVDETAILSTORE_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 CnvDetailData 00029 { 00030 double relativeCoverage_; 00031 std::string calledPloidy_; 00032 std::string calledLevel_; 00033 std::string bestLAF_; 00034 std::string lowLAF_; 00035 std::string highLAF_; 00036 }; 00037 00039 class CnvDetailStore : 00040 public reference::RangeAnnotationStore<CnvDetailStore, CnvDetailData> 00041 { 00042 public: 00044 CnvDetailStore(const reference::CrrFile& crr, const GenomeMetadata& exp, 00045 bool isDiploid, bool isSomatic) 00046 : Base(crr) 00047 { 00048 if (isDiploid){ 00049 if (isSomatic){ 00050 load( exp.getCnvDetailsSomaticDiploidFileName() ); 00051 } else { 00052 load( exp.getCnvDetailsDiploidFileName() ); 00053 } 00054 } else { 00055 if (isSomatic){ 00056 load( exp.getCnvDetailsSomaticNondiploidFileName() ); 00057 } else { 00058 load( exp.getCnvDetailsNondiploidFileName() ); 00059 } 00060 } 00061 } 00062 00064 bool hasCalledPloidy() const { return hasCalledPloidy_; } 00065 00067 bool hasCalledLevel() const { return hasCalledLevel_; } 00068 00070 bool hasLAF() const { return hasLAF_; } 00071 00075 const CnvDetailData* getBestOverlappingDetail(const reference::Range& r) const; 00076 00077 public: 00079 void bindColumns(util::DelimitedFile& df, reference::Range& range, CnvDetailData& data); 00080 00081 private: 00082 bool hasCalledPloidy_; 00083 bool hasCalledLevel_; 00084 bool hasLAF_; 00085 }; 00086 00087 }} 00088 00089 #endif