NCBI C++ ToolKit
msmerge.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /*
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * and reliability of the software and data, the NLM
15  * Although all reasonable efforts have been taken to ensure the accuracyand the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: Lewis Y. Geer
27  *
28  * File Description:
29  * Code for loading in spectrum datasets
30  *
31  */
32 
33 #ifndef MSMERGE_HPP
34 #define MSMERGE_HPP
35 
36 
37 
38 #include <iostream>
39 #include <deque>
40 #include <map>
41 
42 #include <corelib/ncbistr.hpp>
43 #include <corelib/ncbiexpt.hpp>
45 #include "msms.hpp"
46 
49 BEGIN_SCOPE(omssa)
50 
51 /** type that hold a list of oids */
52 typedef std::set <int> TOid;
53 
54 
56 
57  typedef CMSSearch Tparent;
58 
59 public:
60 
61  // constructor
62  COMSSASearch(void) {}
63  // destructor
64  ~COMSSASearch(void) {}
65 
66 
67  /**
68  * copy a search onto this search
69  *
70  * @param OldSearch the search to be copied
71  */
72  void CopyCMSSearch(CRef <COMSSASearch> OldSearch);
73 
74  /**
75  * copy a spectra from old search into this search
76  *
77  * @param OldSearch the search to be copied
78  */
79  void CopySpectra(CRef <COMSSASearch> OldSearch);
80 
81  /**
82  * copy Hitsets from old search into new this search
83  *
84  * @param OldSearch the search to be copied
85  */
86  void CopyHitsets(CRef <COMSSASearch> OldSearch);
87 
88  /**
89  * copy Settings from old search into new this search
90  *
91  * @param OldSearch the search to be copied
92  */
93  void CopySettings(CRef <COMSSASearch> OldSearch);
94 
95  /**
96  * return a file ending based on encoding type
97  *
98  * @param FileType encoding type
99  * @return file extension without separator
100  */
101  const string FileEnding(const ESerialDataFormat FileType) const;
102 
103  /**
104  * find the maximum and minimum search setting id in this search
105  *
106  * @param Min minimum
107  * @param Max maximum
108  */
109  void FindMinMaxSearchSettingId(int& Min, int& Max) const;
110 
111  /**
112  * find the maximum and minimum spectrum number in this search
113  *
114  * @param Min minimum
115  * @param Max maximum
116  */
117  void
118  FindMinMaxSpectrumNumber(
119  int& Min,
120  int& Max
121  ) const;
122 
123 
124  /**
125  * check for matching library name and size in all search settings
126  *
127  * @return true if all match
128  */
129  const bool CheckLibraryNameAndSize(const string Name, const int Size) const;
130 
131 
132  /**
133  * renumber search settings by adding a minimum value
134  *
135  * @param Min minimum value to add
136  *
137  */
138  void RenumberSearchSettingId(const int Min);
139 
140  /**
141  * renumber spectrum numbers by adding a minimum value
142  *
143  * @param Min minimum value to add
144  */
145  void RenumberSpectrumNumber(const int Min);
146 
147  /**
148  * get the oid list
149  */
150  const TOid& GetOids(void) const;
151 
152  /**
153  * set the oid list
154  */
155  TOid& SetOids(void);
156 
157  /**
158  * fill in the oid list from existing object
159  */
160  void PopulateOidList(void);
161 
162  /**
163  * add a bioseq to the bioseq list
164  */
165  void AppendBioseq(const int oid, CConstRef <CBioseq> Bioseq);
166 
167  /**
168  * add a search to this object
169  */
170  void AppendSearch(CRef <COMSSASearch> OldSearch);
171 
172 protected:
173 
174  /** helper function for FindMinMaxSearchSettingId */
175  void
176  FindMinMaxForOneSetting(
177  const CMSSearchSettings& SearchSettings,
178  int& Min,
179  int& Max
180  ) const;
181 
182  /**
183  * renumber one search setting
184  */
185  void
186  RenumberOneSearchSettingId(
187  CMSSearchSettings& SearchSettings,
188  const int Min);
189 
190 private:
191  // Prohibit copy constructor and assignment operator
194 
195  /** list of oids in used in search */
197 
198 };
199 
200 inline
201 const TOid&
203 {
204  return Oids;
205 }
206 
207 inline
208 TOid&
210 {
211  return Oids;
212 }
213 
214 /**
215  * sets up output file based on DataFormat
216  * in particular, initializes xml stream appropriately
217  *
218  * @param os output stream
219  * @param DataFormat format of file type
220  * @return output stream
221  */
223  CObjectOStream* os,
224  ESerialDataFormat DataFormat);
225 
226 END_SCOPE(omssa)
229 
230 #endif // MSMERGE_HPP
User-defined methods of the data storage class.
@MSSearchSettings.hpp User-defined methods of the data storage class.
COMSSASearch(const COMSSASearch &value)
~COMSSASearch(void)
Definition: msmerge.hpp:64
COMSSASearch & operator=(const COMSSASearch &value)
const TOid & GetOids(void) const
get the oid list
Definition: msmerge.hpp:202
CMSSearch Tparent
Definition: msmerge.hpp:57
TOid Oids
list of oids in used in search
Definition: msmerge.hpp:196
COMSSASearch(void)
Definition: msmerge.hpp:62
TOid & SetOids(void)
set the oid list
Definition: msmerge.hpp:209
CObjectOStream –.
Definition: objostr.hpp:83
CRef –.
Definition: ncbiobj.hpp:618
Definition: set.hpp:45
The NCBI C++ standard methods for dealing with std::string.
ESerialDataFormat
Data file format.
Definition: serialdef.hpp:71
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
#define NCBI_XOMSSA_EXPORT
Definition: ncbi_export.h:1355
CObjectOStream * SetUpOutputFile(CObjectOStream *os, ESerialDataFormat DataFormat)
sets up output file based on DataFormat in particular, initializes xml stream appropriately
Definition: msmerge.cpp:302
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Defines NCBI C++ exception handling.
Int4 TOid
Ordinal ID in BLAST databases.
Definition: seqdbcommon.hpp:58
Modified on Sun Apr 14 05:27:53 2024 by modify_doxy.py rev. 669887