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: villek@matrixscience.com $ #
00014 #       $Date: 2018-09-21 11:02:51 +0100 $ #
00015 #   $Revision: 7de186ba48b69fe269342dd6d9425df8679c4d3a | MSPARSER_REL_2_8_1-0-gea32989045 $ #
00016 # $NoKeywords::                                                            $ #
00017 ##############################################################################
00018 */
00019 
00020 #ifndef MS_MASCOTRESUNIGENE_HPP
00021 #define MS_MASCOTRESUNIGENE_HPP
00022 
00023 
00024 // Includes from the standard template library
00025 #include <stdio.h>
00026 #include <string>
00027 #include <vector>
00028 
00029 
00030 
00031 namespace matrix_science {
00032     class ms_tinycdb;
00033 
00039 
00040 
00045     class MS_MASCOTRESFILE_API ms_unigene_entry
00046     {
00047         public:
00049             ms_unigene_entry(FILE * f, ms_unigene & unigene);
00050 
00052             ms_unigene_entry(const std::string & id,
00053                              const std::string & title,
00054                              const std::string & gene,
00055                              const std::string & cytoBand,
00056                              const std::string & locusLink,
00057                              const std::string & express,
00058                              const long          chromosome,
00059                              const int           numAccessions,
00060                              const OFFSET64_T    fileOffset);
00061 
00063             ~ms_unigene_entry();
00064 
00066 
00071             int getNumAccessions() const     { return numAccessions_; }
00072 
00074 
00077             std::string getID() const        { return id_;                }
00078 
00080 
00083             std::string getTitle() const     { return title_;             }
00084 
00086 
00089             std::string getGene() const      { return gene_;              }
00090 
00092 
00095             std::string getCytoBand() const  { return cytoBand_;          }
00096 
00098 
00102             std::string getLocusLink() const { return locuslink_;         }
00103 
00105 
00111             std::string getExpress() const   { return express_;           }
00112 
00114 
00117             long getChromosome() const       { return chromosome_;        }
00118 
00120 
00124             OFFSET64_T getFileOffset() const { return fileOffset_;        }
00125 
00126         protected:
00127             // Not safe to copy or assign this object.
00128 #ifndef SWIG
00129             ms_unigene_entry(const ms_unigene_entry & rhs);
00130             ms_unigene_entry & operator=(const ms_unigene_entry & rhs);
00131 #endif
00132         private:
00134             bool getString(const char * buf, const char * id,
00135                            const int idLen,  std::string &res);
00136 
00138             bool getLong(const char * buf, const char * id, 
00139                          const int idLen,  long &res);
00140 
00142             bool getAccessions(const char * buf, const char * id, const int idLen,  
00143                                std::string & giNumber, std::string & accession);
00144             std::string id_;
00145             std::string title_;
00146             std::string gene_;
00147             std::string cytoBand_;
00148             std::string locuslink_;
00149             std::string express_;
00150             long        chromosome_;
00151             int         numAccessions_;
00152             OFFSET64_T  fileOffset_;
00153     };
00154 
00156 
00161     class MS_MASCOTRESFILE_API ms_unigene
00162     {
00163         friend class ms_unigene_entry;
00164 
00165         public:
00167             ms_unigene(const ms_mascotresfile  &resfile, const char * filename);
00168 
00170             ~ms_unigene();
00171 
00173             const ms_unigene_entry * findEntry(const char * id);
00174 
00176             std::string getUnigeneForAccession(const std::string accession, 
00177                                                const int index);
00178 
00179         protected:
00180             // Not safe to copy or assign this object.
00181 #ifndef SWIG
00182             ms_unigene(const ms_unigene & rhs);
00183             ms_unigene & operator=(const ms_unigene & rhs);
00184 #endif
00185     private:
00186             const ms_mascotresfile  &resfile_;
00187             std::vector<ms_unigene_entry *> entries_;
00188             std::string filename_;
00189             int numAccessions_;
00190             ms_tinycdb * pcdb_;
00191             typedef std::multimap<std::string, const ms_unigene_entry *> unigenesForAcc;
00192             unigenesForAcc accessionToUnigene_;
00193 
00195             void addAccessionUnigenePair(const ms_unigene_entry * unigene, 
00196                                          const std::string & accession);
00197     }; // end of resfile_group
00199 }   // matrix_science namespace
00200 
00201 #endif // MS_MASCOTRESUNIGENE_HPP
00202 
00203 /*------------------------------- End of File -------------------------------*/

Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29