Matrix Science header

ms_mascotresunigene.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_mascotrespeptide.hpp                                              #
00004 # 'msparser' toolkit                                                         #
00005 # Encapsulates a Unigene file (from NCBI)                                    #
00006 #                                                                            #
00007 ##############################################################################
00008 # COPYRIGHT NOTICE                                                           #
00009 # Copyright 1998-2003 Matrix Science Limited  All Rights Reserved.           #
00010 #                                                                            #
00011 ##############################################################################
00012 #    $Archive:: /Mowse/ms_mascotresfile/include/ms_mascotresunigene.hpp    $ #
00013 #     $Author: davidc $ #
00014 #       $Date: 2010/07/22 14:22:18 $ #
00015 #   $Revision: 1.11 $ #
00016 # $NoKeywords::                                                            $ #
00017 ##############################################################################
00018 */
00019 
00020 #ifndef MS_MASCOTRESUNIGENE_HPP
00021 #define MS_MASCOTRESUNIGENE_HPP
00022 
00023 #ifdef _WIN32
00024 #pragma warning(disable:4251)   // Don't want all classes to be exported
00025 #pragma warning(disable:4786)   // Debug symbols too long
00026 #   ifndef _MATRIX_USE_STATIC_LIB
00027 #       ifdef MS_MASCOTRESFILE_EXPORTS
00028 #           define MS_MASCOTRESFILE_API __declspec(dllexport)
00029 #       else
00030 #           define MS_MASCOTRESFILE_API __declspec(dllimport)
00031 #       endif
00032 #   else
00033 #       define MS_MASCOTRESFILE_API
00034 #   endif
00035 #else
00036 #   define MS_MASCOTRESFILE_API
00037 #endif
00038 
00039 // for the sake of #include <string>
00040 #ifdef __ALPHA_UNIX__
00041 #include <ctype.h>
00042 #endif
00043 
00044 // Includes from the standard template library
00045 #include <stdio.h>
00046 #include <string>
00047 #include <vector>
00048 
00049 
00050 
00051 namespace matrix_science {
00052     class ms_tinycdb;
00053 
00059 
00060 
00065     class MS_MASCOTRESFILE_API ms_unigene_entry
00066     {
00067         public:
00068 #ifdef __MINGW__
00069 
00070             inline ms_unigene_entry(FILE * f, ms_unigene & unigene);
00071 #else
00072 
00073             ms_unigene_entry(FILE * f, ms_unigene & unigene);
00074 #endif
00075 
00076             ms_unigene_entry(const std::string & id,
00077                              const std::string & title,
00078                              const std::string & gene,
00079                              const std::string & cytoBand,
00080                              const std::string & locusLink,
00081                              const std::string & express,
00082                              const long          chromosome,
00083                              const int           numAccessions,
00084                              const OFFSET64_T    fileOffset);
00085 
00087             ~ms_unigene_entry();
00088 
00090 
00095             int getNumAccessions() const     { return numAccessions_; }
00096 
00098 
00101             std::string getID() const        { return id_;                }
00102 
00104 
00107             std::string getTitle() const     { return title_;             }
00108 
00110 
00113             std::string getGene() const      { return gene_;              }
00114 
00116 
00119             std::string getCytoBand() const  { return cytoBand_;          }
00120 
00122 
00126             std::string getLocusLink() const { return locuslink_;         }
00127 
00129 
00135             std::string getExpress() const   { return express_;           }
00136 
00138 
00141             long getChromosome() const       { return chromosome_;        }
00142 
00144 
00148             OFFSET64_T getFileOffset() const { return fileOffset_;        }
00149 
00150         protected:
00151             // Not safe to copy or assign this object.
00152 #ifndef SWIG
00153             ms_unigene_entry(const ms_unigene_entry & rhs);
00154             ms_unigene_entry & operator=(const ms_unigene_entry & rhs);
00155 #endif
00156         private:
00158             bool getString(const char * buf, const char * id,
00159                            const int idLen,  std::string &res);
00160 
00162             bool getLong(const char * buf, const char * id, 
00163                          const int idLen,  long &res);
00164 
00166             bool getAccessions(const char * buf, const char * id, const int idLen,  
00167                                std::string & giNumber, std::string & accession);
00168             std::string id_;
00169             std::string title_;
00170             std::string gene_;
00171             std::string cytoBand_;
00172             std::string locuslink_;
00173             std::string express_;
00174             long        chromosome_;
00175             int         numAccessions_;
00176             OFFSET64_T  fileOffset_;
00177     };
00178 
00180 
00185     class MS_MASCOTRESFILE_API ms_unigene
00186     {
00187         friend class ms_unigene_entry;
00188 
00189         public:
00191             ms_unigene(ms_mascotresfile  &resfile, const char * filename);
00192 
00194             ~ms_unigene();
00195 
00197             const ms_unigene_entry * findEntry(const char * id);
00198 
00200             std::string getUnigeneForAccession(const std::string accession, 
00201                                                const int index);
00202 
00203         protected:
00204             // Not safe to copy or assign this object.
00205 #ifndef SWIG
00206             ms_unigene(const ms_unigene & rhs);
00207             ms_unigene & operator=(const ms_unigene & rhs);
00208 #endif
00209     private:
00210             ms_mascotresfile  &resfile_;
00211             std::vector<ms_unigene_entry *> entries_;
00212             std::string filename_;
00213             int numAccessions_;
00214             ms_tinycdb * pcdb_;
00215             typedef std::multimap<std::string, const ms_unigene_entry *> unigenesForAcc;
00216             unigenesForAcc accessionToUnigene_;
00217 
00219             void addAccessionUnigenePair(const ms_unigene_entry * unigene, 
00220                                          const std::string & accession);
00221     }; // end of resfile_group
00223 }   // matrix_science namespace
00224 
00225 #endif // MS_MASCOTRESUNIGENE_HPP
00226 
00227 /*------------------------------- End of File -------------------------------*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:51