Sleipnir
tools/BNServer/dot.h
00001 /*****************************************************************************
00002 * This file is provided under the Creative Commons Attribution 3.0 license.
00003 *
00004 * You are free to share, copy, distribute, transmit, or adapt this work
00005 * PROVIDED THAT you attribute the work to the authors listed below.
00006 * For more information, please see the following web page:
00007 * http://creativecommons.org/licenses/by/3.0/
00008 *
00009 * This file is a component of the Sleipnir library for functional genomics,
00010 * authored by:
00011 * Curtis Huttenhower (chuttenh@princeton.edu)
00012 * Mark Schroeder
00013 * Maria D. Chikina
00014 * Olga G. Troyanskaya (ogt@princeton.edu, primary contact)
00015 *
00016 * If you use this library, the included executable tools, or any related
00017 * code in your work, please cite the following publication:
00018 * Curtis Huttenhower, Mark Schroeder, Maria D. Chikina, and
00019 * Olga G. Troyanskaya.
00020 * "The Sleipnir library for computational functional genomics"
00021 *****************************************************************************/
00022 #ifndef DOT_H
00023 #define DOT_H
00024 
00025 class CDot {
00026 public:
00027     CDot( const CDat& Dat ) : m_Dat(Dat) {
00028 
00029         m_pProperties = new boost::dynamic_properties( boost::ignore_other_properties ); }
00030 
00031     ~CDot( ) {
00032 
00033         delete m_pProperties; }
00034 
00035     bool Open( const char* );
00036     bool Save( ostream&, const std::vector<bool>&, size_t ) const;
00037 
00038 private:
00039     typedef boost::property<boost::vertex_name_t, string, boost::property<boost::vertex_index1_t, string,
00040         boost::property<boost::vertex_index2_t, string, boost::property<boost::vertex_attribute_t, string> > > >
00041                                                                                 TAttributesVertex;
00042     typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS,
00043         TAttributesVertex, boost::property<boost::edge_attribute_t, string> >
00044                                                                                 TGraph;
00045     typedef TGraph::edge_descriptor                                             TEdge;
00046     typedef TGraph::vertex_descriptor                                           TVertex;
00047 
00048     static const char   c_szCutoffBox[];
00049     static const char   c_szHeader00[];
00050     static const char   c_szHeader01[];
00051     static const char   c_szHeader02[];
00052     static const float  c_dEdgeOpacity;
00053     static const float  c_dScale;
00054 
00055     bool SaveEdge( ostream&, const TEdge& ) const;
00056     bool SaveVertex( ostream&, const TVertex&, const std::vector<bool>& ) const;
00057 
00058     const CDat&                 m_Dat;
00059     TGraph                      m_Graph;
00060     boost::dynamic_properties*  m_pProperties;
00061 };
00062 
00063 #endif // DOT_H