Sleipnir
|
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 PARSERCONSOLE_H 00023 #define PARSERCONSOLE_H 00024 00025 #include "parser.h" 00026 00027 class CParserConsole : public CParser { 00028 public: 00029 CParserConsole( const Sleipnir::IOntology**, const Sleipnir::CGenome& ); 00030 00031 bool ProcessLine( const char* ); 00032 SLocation GetLocation( const string& = c_szDot, bool = true ) const; 00033 00034 protected: 00035 typedef bool (CParserConsole::*TPFnParser)( const vector<string>& ); 00036 00037 struct SArgs { 00038 static const char* c_aszFlags[]; 00039 00040 bool m_afFlags[ 7 ]; 00041 bool& m_fGenes; 00042 bool& m_fLong; 00043 bool& m_fSibs; 00044 bool& m_fZeroes; 00045 bool& m_fBonferroni; 00046 bool& m_fRecursive; 00047 bool& m_fBackground; 00048 00049 SArgs( ); 00050 00051 bool Parse( const string& ); 00052 }; 00053 00054 static const size_t c_iWidthGenes = 5; 00055 static const size_t c_iWidthID = 19; 00056 static const size_t c_iWidthGloss = 43; 00057 static const size_t c_iWidthOnto = 32; 00058 static const size_t c_iWidthP = 14; 00059 static const size_t c_iWidthScreen = 80; 00060 static const size_t c_iSizeCutoff = 40; 00061 static const char c_cSemicolon = ';'; 00062 static const char c_cShell = '!'; 00063 static const char c_szDotDotDot[]; 00064 static const char c_szBackground[]; 00065 static const char c_szBonferroni[]; 00066 static const char c_szGenes[]; 00067 static const char c_szLong[]; 00068 static const char c_szRecursive[]; 00069 static const char c_szSibs[]; 00070 static const char c_szStar[]; 00071 static const char c_szZeroes[]; 00072 static const char c_szHelpHelp[]; 00073 static const TPFnParser c_apfnParsers[]; 00074 static const char* c_aszHelps[]; 00075 00076 static void PrintLink( const Sleipnir::IOntology*, size_t, char, const SArgs& ); 00077 static void PrintNumber( size_t, size_t ); 00078 static void PrintSpaces( size_t ); 00079 static void PrintAnnotation( const Sleipnir::IOntology*, size_t, const SArgs&, 00080 const Sleipnir::STermFound* = NULL ); 00081 static void PrintGloss( string, size_t, bool ); 00082 static void PrintGene( const Sleipnir::CGene&, const SArgs& ); 00083 static void PrintGenes( const std::vector<const Sleipnir::CGene*>&, size_t = 0, 00084 const Sleipnir::CGenes* = NULL ); 00085 static size_t FormatGenes( const std::vector<const Sleipnir::CGene*>&, std::vector<string>&, 00086 const Sleipnir::CGenes* = NULL ); 00087 00088 bool ParseCat( const std::vector<string>& ); 00089 bool ParseCd( const std::vector<string>& ); 00090 bool ParseHelp( const std::vector<string>& ); 00091 bool ParseLs( const std::vector<string>& ); 00092 bool ParseFind( const std::vector<string>& ); 00093 bool ParseParentage( const std::vector<string>& ); 00094 bool ParseShell( const string& ) const; 00095 void PrintOntology( const Sleipnir::IOntology*, char ) const; 00096 void PrintLocations( const std::vector<SLocation>&, const SArgs& ) const; 00097 void PrintGenes( const std::vector<SLocation>&, const SArgs& ) const; 00098 00099 SLocation m_sLocation; 00100 }; 00101 00102 #endif // PARSERCONSOLE_H