Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

BaseAlignment.h (Maintainer: Eva Lange)

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // --------------------------------------------------------------------------
00005 //                   OpenMS Mass Spectrometry Framework
00006 // --------------------------------------------------------------------------
00007 //  Copyright (C) 2003-2008 -- Oliver Kohlbacher, Knut Reinert
00008 //
00009 //  This library is free software; you can redistribute it and/or
00010 //  modify it under the terms of the GNU Lesser General Public
00011 //  License as published by the Free Software Foundation; either
00012 //  version 2.1 of the License, or (at your option) any later version.
00013 //
00014 //  This library is distributed in the hope that it will be useful,
00015 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 //  Lesser General Public License for more details.
00018 //
00019 //  You should have received a copy of the GNU Lesser General Public
00020 //  License along with this library; if not, write to the Free Software
00021 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //
00023 // --------------------------------------------------------------------------
00024 // $Maintainer: Eva Lange $
00025 // --------------------------------------------------------------------------
00026 
00027 
00028 #ifndef OPENMS_ANALYSIS_MAPMATCHING_BASEALIGNMENT_H
00029 #define OPENMS_ANALYSIS_MAPMATCHING_BASEALIGNMENT_H
00030 
00031 #include <OpenMS/KERNEL/FeatureMap.h>
00032 #include <OpenMS/KERNEL/ConsensusMap.h>
00033 #include <OpenMS/ANALYSIS/MAPMATCHING/BasePairwiseMapMatcher.h>
00034 #include <OpenMS/ANALYSIS/MAPMATCHING/PoseClusteringPairwiseMapMatcher.h>
00035 #include <OpenMS/ANALYSIS/MAPMATCHING/BasePairwiseMapMatcher_impl.h>
00036 #include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>
00037 #include <OpenMS/DATASTRUCTURES/StringList.h>
00038 
00039 #include <utility>
00040 #include <fstream>
00041 #include <vector>
00042 
00043 namespace OpenMS
00044 {
00053   template < typename ConsensusElementT >
00054   class BaseAlignment : public DefaultParamHandler
00055   {
00056   public:
00058     typedef ConsensusElementT ConsensusElementType;
00059 
00061     typedef typename ConsensusElementType::ElementType ElementType;
00063     typedef typename ConsensusElementType::ElementContainerType ElementContainerType;
00065     typedef std::vector< ConsensusElementType > ConsensusVectorType;
00066 
00068     BaseAlignment()
00069         : DefaultParamHandler("BaseAlignment")
00070     {
00071       defaults_.setValue("map_type","feature_map","The type of map the alignment works on.\n");
00072       defaults_.setValidStrings("map_type",StringList::create("feature_map,peak_map,consensus_map"));
00073       
00074       defaultsToParam_();
00075     }
00076 
00078     virtual ~BaseAlignment()
00079     {
00080     }
00081 
00083     void setElementMapVector(const std::vector< ElementContainerType* >& element_map_vector)
00084     {
00085       final_consensus_map_.setMapVector(element_map_vector);
00086     }
00088     std::vector< ElementContainerType* >& getElementMapVector()
00089     {
00090       return final_consensus_map_.getMapVector();
00091     }
00093     const std::vector< ElementContainerType* >& getElementMapVector() const
00094     {
00095       return final_consensus_map_.getMapVector();
00096     }
00097 
00099     void setTransformationVector(const std::vector< Grid >& transformations)
00100     {
00101       transformations_ = transformations;
00102     }
00104     const std::vector< Grid >& getTransformationVector() const
00105     {
00106       return transformations_;
00107     }
00108 
00110     void setFileNames(const std::vector< String >& file_names)
00111     {
00112       final_consensus_map_.setFilenames(file_names);
00113     }
00115     const std::vector< String >& getFileNames() const
00116     {
00117       return final_consensus_map_.getFilenames();
00118     }
00119 
00121     void setMapType(const String& map_type)
00122     {
00123       map_type_ = map_type;
00124       param_.setValue("map_type",map_type_);
00125     }
00127     const String& getMapType() const
00128     {
00129       return map_type_;
00130     }
00131 
00133     const ConsensusMap < ConsensusElementType >& getFinalConsensusMap() const
00134     {
00135       return final_consensus_map_;
00136     }
00137     
00139     void setFinalConsensusMap(const ConsensusMap < ConsensusElementType >& final_consensus_map)
00140     {
00141       final_consensus_map_ = final_consensus_map;
00142     }
00143 
00145     virtual void run() throw (Exception::InvalidValue) = 0;
00146 
00147 
00149     virtual String getAlignmentTree() const = 0;
00150 
00151   protected:
00153     ConsensusMap < ConsensusElementType > final_consensus_map_;
00154     
00156     std::vector< Grid > transformations_;
00157 
00159     String map_type_;
00160 
00162     void buildConsensusVectorTypeInsertInGroup_(UInt map_index, std::vector< ConsensusElementType >& cons_map)
00163     {
00164       const ElementContainerType& map = *(final_consensus_map_.getMapVector()[map_index]);
00165       UInt n = map.size();
00166       for (UInt i=0; i < n; ++i)
00167       {
00168         ConsensusElementType c(map_index,i,map[i]);
00169         cons_map.push_back(c);
00170       }
00171     }
00172 
00174     void buildConsensusVectorType_(UInt map_index, std::vector< ConsensusElementType >& cons_map)
00175     {
00176       const ElementContainerType& map = *(final_consensus_map_.getMapVector()[map_index]);
00177       UInt n = map.size();
00178       for (UInt i=0; i < n; ++i)
00179       {
00180         ConsensusElementType c(map[i].getPosition(),map[i].getIntensity());
00181         cons_map.push_back(c);
00182       }
00183     }
00184     
00185     void updateMembers_() 
00186      {
00187        map_type_ = param_.getValue("map_type"); 
00188      }
00189   }
00190   ; // BaseAlignment
00191 } // namespace OpenMS
00192 
00193 #endif  // OPENMS_ANALYSIS_MAPMATCHING_BASEALIGNMENT_H

Generated Tue Apr 1 15:36:32 2008 -- using doxygen 1.5.4 OpenMS / TOPP 1.1