ProteoWizard
NeighborJoiner.hpp
Go to the documentation of this file.
1 //
2 // $Id: NeighborJoiner.hpp 1539 2009-11-19 20:12:28Z khoff $
3 //
4 //
5 // Original author: Kate Hoff <katherine.hoff@proteowizard.org>
6 //
7 // Copyright 2009 Center for Applied Molecular Medicine
8 // University of Southern California, Los Angeles, CA
9 //
10 // Licensed under the Apache License, Version 2.0 (the "License");
11 // you may not use this file except in compliance with the License.
12 // You may obtain a copy of the License at
13 //
14 // http://www.apache.org/licenses/LICENSE-2.0
15 //
16 // Unless required by applicable law or agreed to in writing, software
17 // distributed under the License is distributed on an "AS IS" BASIS,
18 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 // See the License for the specific language governing permissions and
20 // limitations under the License.
21 //
22 
23 ///
24 /// NeighborJoiner.hpp
25 ///
26 
27 #ifndef _NEIGHBORJOINER_HPP
28 #define _NEIGHBORJOINER_HPP
29 
30 #include "Matrix.hpp"
31 #include "AMTContainer.hpp"
32 #include "DistanceAttributes.hpp"
33 
34 namespace pwiz{
35 namespace eharmony{
36 
37 typedef AMTContainer Entry;
38 
39 struct NeighborJoiner : public Matrix
40 {
41  NeighborJoiner(const vector<boost::shared_ptr<Entry> >& entries, const WarpFunctionEnum& wfe = Default);
42 
43  void addDistanceAttribute(boost::shared_ptr<DistanceAttribute> attr) { _attributes.push_back(attr); }
45  void joinNearest();
46  void joinAll() { while (_rowEntries.size() > 1) joinNearest(); }
47 
48  vector<Entry > _rowEntries;
49  vector<Entry > _columnEntries;
50 
51  vector<boost::shared_ptr<DistanceAttribute> > _attributes;
52  vector<pair<int, int> > _tree; // stores the row/column indices of the merge at each step
53 
55 
56 };
57 
58 }
59 }
60 
61 
62 #endif // _NEIGHBORJOINER_HPP_