Sleipnir
src/coalesce.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 COALESCE_H
00023 #define COALESCE_H
00024 
00025 #include "coalescei.h"
00026 #include "coalescecluster.h"
00027 #include "coalescemotifs.h"
00028 
00029 namespace Sleipnir {
00030 
00061 class CCoalesce : CCoalesceImpl {
00062 public:
00063     bool Cluster( const CPCL& PCL, const CFASTA& FASTA, std::vector<CCoalesceCluster>& vecClusters );
00064 
00065     void SetSeed( const CPCL& PCL );
00066 
00077     void SetPValueCorrelation( float dPValue ) {
00078 
00079         m_dPValueCorrelation = dPValue; }
00080 
00091     float GetPValueCorrelation( ) const {
00092 
00093         return m_dPValueCorrelation; }
00094 
00105     void SetBins( size_t iBins ) {
00106 
00107         m_iBins = iBins; }
00108 
00119     size_t GetBins( ) const {
00120 
00121         return m_iBins; }
00122 
00133     float GetZScoreCondition( ) const {
00134 
00135         return m_dZScoreCondition; }
00136 
00147     void SetZScoreCondition( float dZScore ) {
00148 
00149         m_dZScoreCondition = dZScore; }
00150 
00161     float GetPValueCondition( ) const {
00162 
00163         return m_dPValueCondition; }
00164 
00175     void SetPValueCondition( float dPValue ) {
00176 
00177         m_dPValueCondition = dPValue; }
00178 
00189     float GetZScoreMotif( ) const {
00190 
00191         return m_dZScoreMotif; }
00192 
00203     void SetZScoreMotif( float dZScore ) {
00204 
00205         m_dZScoreMotif = dZScore; }
00206 
00217     float GetPValueMotif( ) const {
00218 
00219         return m_dPValueMotif; }
00220 
00231     void SetPValueMotif( float dPValue ) {
00232 
00233         m_dPValueMotif = dPValue; }
00234 
00245     float GetProbabilityGene( ) const {
00246 
00247         return m_dProbabilityGene; }
00248 
00259     void SetProbabilityGene( float dProbability ) {
00260 
00261         m_dProbabilityGene = dProbability; }
00262 
00273     bool IsDirectoryIntermediate( ) const {
00274 
00275         return !GetDirectoryIntermediate( ).empty( ); }
00276 
00287     const std::string& GetDirectoryIntermediate( ) const {
00288 
00289         return m_strDirectoryIntermediate; }
00290 
00301     void SetDirectoryIntermediate( const std::string& strDirectoryIntermediate ) {
00302 
00303         m_strDirectoryIntermediate = strDirectoryIntermediate; }
00304 
00315     void SetMotifs( CCoalesceMotifLibrary& Motifs ) {
00316 
00317         if( m_fMotifs && m_pMotifs && ( m_pMotifs != &Motifs ) )
00318             delete m_pMotifs;
00319         m_pMotifs = &Motifs; }
00320 
00331     const CCoalesceMotifLibrary* GetMotifs( ) const {
00332 
00333         return m_pMotifs; }
00334 
00345     size_t GetK( ) const {
00346 
00347         return m_iK; }
00348 
00359     void SetK( size_t iK ) {
00360 
00361         m_iK = iK; }
00362 
00373     size_t GetBasesPerMatch( ) const {
00374 
00375         return m_iBasesPerMatch; }
00376 
00390     void SetBasesPerMatch( size_t iBasesPerMatch ) {
00391 
00392         m_iBasesPerMatch = iBasesPerMatch; }
00393 
00404     float GetPValueMerge( ) const {
00405 
00406         return m_dPValueMerge; }
00407 
00418     void SetPValueMerge( float dPValue ) {
00419 
00420         m_dPValueMerge = dPValue; }
00421 
00432     float GetCutoffMerge( ) const {
00433 
00434         return m_dCutoffMerge; }
00435 
00446     void SetCutoffMerge( float dCutoff ) {
00447 
00448         m_dCutoffMerge = dCutoff; }
00449 
00460     size_t GetSizeMinimum( ) const {
00461 
00462         return m_iSizeMinimum; }
00463 
00474     void SetSizeMinimum( size_t iSizeGenes ) {
00475 
00476         m_iSizeMinimum = iSizeGenes; }
00477 
00488     size_t GetSizeMaximum( ) const {
00489 
00490         return m_iSizeMaximum; }
00491 
00505     void SetSizeMaximum( size_t iSizeMotifs ) {
00506 
00507         m_iSizeMaximum = iSizeMotifs; }
00508 
00519     size_t GetSizeMerge( ) const {
00520 
00521         return m_iSizeMerge; }
00522 
00536     void SetSizeMerge( size_t iSizeMerge ) {
00537 
00538         m_iSizeMerge = iSizeMerge; }
00539 
00547     void ClearDatasets( ) {
00548 
00549         m_vecsDatasets.clear( ); }
00550 
00573     bool AddDataset( const std::set<size_t>& setiDataset ) {
00574         size_t                              i;
00575         std::set<size_t>::const_iterator    iterExperiment;
00576 
00577         if( setiDataset.empty( ) )
00578             return true;
00579         for( iterExperiment = setiDataset.begin( ); iterExperiment != setiDataset.end( ); ++iterExperiment )
00580             for( i = 0; i < m_vecsDatasets.size( ); ++i )
00581                 if( m_vecsDatasets[ i ].IsCondition( *iterExperiment ) )
00582                     return false;
00583 
00584         m_vecsDatasets.push_back( SCoalesceDataset( setiDataset ) );
00585         return true; }
00586 
00597     void SetNumberCorrelation( size_t iPairs ) {
00598 
00599         m_iNumberCorrelation = iPairs; }
00600 
00611     size_t GetNumberCorrelation( ) const {
00612 
00613         return m_iNumberCorrelation; }
00614 
00625     void SetThreads( size_t iThreads ) {
00626 
00627         m_iThreads = iThreads; }
00628 
00639     size_t GetThreads( ) const {
00640 
00641         return m_iThreads; }
00642 
00666     void AddWiggle( const CFASTA& FASTA ) {
00667 
00668         m_vecpWiggles.push_back( &FASTA ); }
00669 
00677     void ClearWiggles( ) {
00678 
00679         m_vecpWiggles.clear( ); }
00680 
00695     void AddOutputIntermediate( std::ostream& ostm ) {
00696 
00697         m_vecpostm.push_back( &ostm ); }
00698 
00712     void RemoveOutputIntermediate( std::ostream& ostm ) {
00713         std::vector<std::ostream*>::iterator    iter;
00714 
00715         if( ( iter = std::find( m_vecpostm.begin( ), m_vecpostm.end( ), &ostm ) ) != m_vecpostm.end( ) )
00716             m_vecpostm.erase( iter ); }
00717 
00725     void ClearOutputIntermediate( ) {
00726 
00727         m_vecpostm.clear( ); }
00728 
00743     void SetNormalize( bool fNormalize ) {
00744 
00745         m_fNormalize = fNormalize; }
00746 
00757     bool GetNormalize( ) const {
00758 
00759         return m_fNormalize; }
00760 
00768     void ClearSeed( ) {
00769 
00770         m_vecdSeed.clear( ); }
00771 };
00772 
00773 }
00774 
00775 #endif // COALESCE_H