Sleipnir
src/seekplatform.cpp
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 #include "seekplatform.h"
00023 #include "seekreader.h"
00024 
00025 namespace Sleipnir {
00026 
00027 CSeekPlatform::CSeekPlatform(){
00028     m_iNumGenes = 0;
00029     m_vecfPlatformAvg.clear();
00030     m_vecfPlatformStdev.clear();
00031     m_strPlatformName = "";
00032 }
00033 
00034 CSeekPlatform::~CSeekPlatform(){
00035     m_vecfPlatformAvg.clear();
00036     m_vecfPlatformStdev.clear();
00037 }
00038 
00039 void CSeekPlatform::Copy(const CSeekPlatform &pl){
00040     m_iNumGenes = pl.m_iNumGenes;
00041     m_strPlatformName = pl.m_strPlatformName;
00042     m_vecfPlatformAvg.resize(pl.m_vecfPlatformAvg.size());
00043     m_vecfPlatformStdev.resize(pl.m_vecfPlatformStdev.size());
00044     copy(pl.m_vecfPlatformAvg.begin(), pl.m_vecfPlatformAvg.end(),
00045         m_vecfPlatformAvg.begin());
00046     copy(pl.m_vecfPlatformStdev.begin(), pl.m_vecfPlatformStdev.end(),
00047         m_vecfPlatformStdev.begin());
00048 }
00049 
00050 void CSeekPlatform::InitializePlatform(const utype &numGenes,
00051         const string &strPlatformName){
00052     m_iNumGenes = numGenes;
00053     CSeekTools::InitVector(m_vecfPlatformAvg, numGenes, (float) 0);
00054     CSeekTools::InitVector(m_vecfPlatformStdev, numGenes, (float) 0);
00055     m_strPlatformName = strPlatformName;
00056 }
00057 
00058 void CSeekPlatform::SetPlatformAvg(const utype &i, const float &val){
00059     m_vecfPlatformAvg[i] = val;
00060 }
00061     
00062 void CSeekPlatform::SetPlatformStdev(const utype &i, const float &val){
00063     m_vecfPlatformStdev[i] = val;
00064 }
00065     
00066 float CSeekPlatform::GetPlatformAvg(const utype &i) const{
00067     return m_vecfPlatformAvg[i];
00068 }
00069 
00070 float CSeekPlatform::GetPlatformStdev(const utype &i) const{
00071     return m_vecfPlatformStdev[i];
00072 }
00073 
00074 void CSeekPlatform::ResetPlatform(){
00075     m_iNumGenes = 0;
00076     m_vecfPlatformAvg.clear();
00077     m_vecfPlatformStdev.clear();
00078     m_strPlatformName = "";
00079 }
00080 
00081 }