Sleipnir
src/pclset.h
00001 /*****************************************************************************
00002 * This file is provided under the Creative Commons Attribution 3.0 license.
00003 *
00004 * You are free to share, copy, distribute, transmit, or adapt this work
00005 * PROVIDED THAT you attribute the work to the authors listed below.
00006 * For more information, please see the following web page:
00007 * http://creativecommons.org/licenses/by/3.0/
00008 *
00009 * This file is a component of the Sleipnir library for functional genomics,
00010 * authored by:
00011 * Curtis Huttenhower (chuttenh@princeton.edu)
00012 * Mark Schroeder
00013 * Maria D. Chikina
00014 * Olga G. Troyanskaya (ogt@princeton.edu, primary contact)
00015 *
00016 * If you use this library, the included executable tools, or any related
00017 * code in your work, please cite the following publication:
00018 * Curtis Huttenhower, Mark Schroeder, Maria D. Chikina, and
00019 * Olga G. Troyanskaya.
00020 * "The Sleipnir library for computational functional genomics"
00021 *****************************************************************************/
00022 #ifndef PCLSET_H
00023 #define PCLSET_H
00024 
00025 #include "pclseti.h"
00026 #include "meta.h"
00027 #include "pcl.h"
00028 
00029 namespace Sleipnir {
00030 
00042 class CPCLSet : CPCLSetImpl {
00043 public:
00044     bool Open( const std::vector<std::string>& vecstrFiles, size_t iSkip = 2,
00045         CPCL::ENormalize eNormalize = CPCL::ENormalizeNone );
00046 
00057     size_t GetGenes( ) const {
00058 
00059         return m_vecstrGenes.size( ); }
00060 
00068     size_t GetPCLs( ) const {
00069 
00070         return m_iPCLs; }
00071 
00093     float Get( size_t iPCL, size_t iGene, size_t iExperiment ) const {
00094         size_t  iMap;
00095 
00096         if( ( iMap = m_Genes.Get( iPCL, iGene ) ) == -1 )
00097             return CMeta::GetNaN( );
00098 
00099         return m_aPCLs[ iPCL ].Get( iMap, iExperiment ); }
00100 
00118     const float* Get( size_t iPCL, size_t iGene ) const {
00119         size_t  iMap;
00120 
00121         if( ( iMap = m_Genes.Get( iPCL, iGene ) ) == -1 )
00122             return NULL;
00123 
00124         return m_aPCLs[ iPCL ].Get( iMap ); }
00125 
00139     size_t GetGene( const std::string& strGene ) const {
00140         TMapStrI::const_iterator    iterGene;
00141 
00142         return ( ( ( iterGene = m_mapGenes.find( strGene ) ) == m_mapGenes.end( ) ) ? -1 :
00143             iterGene->second ); }
00144 
00158     const std::string& GetGene( size_t iGene ) const {
00159 
00160         return m_vecstrGenes[ iGene ]; }
00161 
00172     const std::vector<std::string>& GetGeneNames( ) const {
00173 
00174         return m_vecstrGenes; }
00175 
00190     const CPCL& Get( size_t iPCL ) const {
00191 
00192         return m_aPCLs[ iPCL ]; }
00193 };
00194 
00195 }
00196 
00197 #endif // PCLSET_H