00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef CGA_TOOLS_COMMAND_MKVCF_HPP_
00016 #define CGA_TOOLS_COMMAND_MKVCF_HPP_ 1
00017
00019
00020 #include "cgatools/core.hpp"
00021 #include "cgatools/command/Command.hpp"
00022 #include "cgatools/reference/CrrFile.hpp"
00023 #include "cgatools/conv/VcfRecordSource.hpp"
00024 #include "cgatools/cgdata/GenomeMetadata.hpp"
00025
00026 #include <queue>
00027
00028 namespace cgatools { namespace command {
00029
00030 class MkVcf : public Command
00031 {
00032 public:
00033 MkVcf(const std::string& name);
00034
00035 protected:
00036 int run(po::variables_map& vm);
00037
00038 private:
00039 void initSources();
00040 void validateSources();
00041 void writeHeaders(std::ostream& out);
00042 std::string getAssemblyId(size_t idxGenome) const;
00043 void transferSource(
00044 std::ostream& out) const;
00045 void transferMetadataHeaders(
00046 std::ostream& out) const;
00047 std::set<std::string> getValues(
00048 const std::vector< std::vector< std::vector<cgatools::conv::VcfKvHeaderRecord> > >& recs,
00049 const std::string& key,
00050 bool mustExist,
00051 bool mustBeUnique) const;
00052 void transferInfoFilterHeaders(
00053 std::ostream& out) const;
00054 void transferInfoFilterHeadersForKey(
00055 std::ostream& out,
00056 const std::vector< std::vector<cgatools::conv::VcfSubFieldHeaderRecord> >& recs,
00057 cgatools::conv::VcfSubFieldHeaderRecord::Key key) const;
00058 std::string getPrintKey(cgatools::conv::VcfSubFieldHeaderRecord::Key key) const;
00059 void checkConsistency(
00060 const std::vector< std::vector<cgatools::conv::VcfSubFieldHeaderRecord> >& recs,
00061 size_t ii0,
00062 size_t jj0) const;
00063
00064 std::string referenceFileName_;
00065 std::string outputFileName_;
00066 std::vector<std::string> genomeRoots_;
00067 std::vector<std::string> varNames_;
00068 std::string fieldNames_;
00069 std::string sourceNames_;
00070 bool includeNoCalls_;
00071 std::string calibPrefix_;
00072 size_t genomeCount_;
00073
00074 std::vector<std::string> junctionFileNames_;
00075 size_t junctionScoreThreshold_;
00076 size_t junctionSideLengthThreshold_;
00077 size_t junctionDistanceTolerance_;
00078 size_t junctionLengthThreshold_;
00079 bool junctionNormalPriority_;
00080 bool junctionTumorHC_;
00081
00082 cgatools::reference::CrrFile crr_;
00083
00084 typedef boost::shared_ptr<cgatools::conv::VcfRecordSource> PQItem;
00085 typedef std::vector<PQItem> PQContainer;
00086 class PQItemComparator
00087 {
00088 public:
00089 bool operator()(const PQItem&, const PQItem&) const;
00090 };
00091 std::priority_queue< PQItem, PQContainer, PQItemComparator > sources_;
00092 std::vector<PQItem> vSources_;
00093 std::vector<std::string> vSourceNames_;
00094 };
00095
00096 } }
00097
00098 #endif // CGA_TOOLS_COMMAND_MKVCF_HPP_