Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

gnodederived.h

Go to the documentation of this file.
00001 //****************************************************
00002 //  April, 1993, University of Illinois
00003 // Copyright (C) 1993, 1994 Tianlin Wang
00004 /* Copyright (C) 1994-2003 Matvec Development Team. 
00005 
00006   This program is free software; you can redistribute it and/or
00007   modify it under the terms of the GNU Library General Public
00008   License as published by the Free Software Foundation; either
00009   version 2 of the License, or (at your option) any later version.
00010   
00011   This program is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014   Library General Public License for more details.
00015     
00016   You should have received a copy of the GNU Library General Public
00017   License along with this library; if not, write to the Free
00018   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00019   MA 02111-1307, USA 
00020 */
00021 
00022 #ifndef gnodederived_h
00023 #define gnodederived_h
00024 #include <iostream>
00025 #include <ext/hash_map>
00026 #include <map>
00027 #include <set>
00028 #include "exception.h"
00029 #include "gnodestuff.h"
00030 #include "safe_vectors.h"
00031 
00032 namespace matvec {
00033   class AlleleStateNode:public GNode{
00034   public:
00035           unsigned alleleState,acceptedAlleleState,candidateAlleleState;
00036           AlleleStateNode(void){
00037                   alleleStateVector.name = "allelStateVector";
00038                   acceptedAlleleStateVector.name = "acceptedAlleleStateVector";
00039           }
00040           
00041           SafeSTLVector<unsigned> alleleStateVector;
00042           SafeSTLVector<unsigned> acceptedAlleleStateVector;  
00043           inline unsigned getState(void) {
00044                   return alleleState;
00045           };
00046           inline unsigned getOldState(void) {
00047                   return acceptedAlleleState;
00048           };
00049           inline unsigned getAcceptedAlleleState(void){
00050                   return alleleStateVector[acceptedAlleleState]-1;
00051           };
00052           inline unsigned getMyAlleleState(void){
00053                   return alleleStateVector[alleleState]-1;
00054           };
00055           inline unsigned getWeight(void) {
00056                   return alleleStateVector.size();
00057           };
00058           void reset(int i){
00059                   alleleState = i;
00060           };
00061           void resetAndSwitch(int i){
00062                   acceptedAlleleState = alleleState; 
00063                   alleleState = i;
00064           };
00065           bool incr();
00066           ~AlleleStateNode(void) {;}
00067   };
00068         /*! \class AlleleStateNode gnodederived.h inc/gnodederived.h
00069    * \brief This is the allele state node class.
00070    * 
00071    * AlleleStateNode class has methods relevant to an allele state node
00072    */ 
00073   class AlleleOriginNode:public GNode{
00074   public:
00075     unsigned alleleOrigin,oldAlleleOrigin;
00076     SafeSTLVector<unsigned> alleleOriginVector;
00077     inline unsigned getState(void) {
00078       return alleleOrigin;
00079     };
00080     inline unsigned getOldState(void) {
00081       return oldAlleleOrigin;
00082     };
00083     inline unsigned getMyAlleleOrigin(void){
00084       return alleleOriginVector[alleleOrigin];
00085     };
00086     inline unsigned getWeight(void) {
00087       return alleleOriginVector.size();
00088     };
00089     void reset(int i){
00090       alleleOrigin = i;
00091     };
00092     void resetAndSwitch(int i){
00093       oldAlleleOrigin = alleleOrigin; 
00094       alleleOrigin = i;
00095     };
00096     bool incr();
00097     ~AlleleOriginNode(void) {;}
00098   };
00099   /*! \class AlleleOriginNode gnodederived.h inc/gnodederived.h
00100    * \brief This is the allele origin node class.
00101    * 
00102    * AlleleOriginNode class has methods relevant to an allele origin node
00103    */ 
00104   class MaternalPaternalAlleles {
00105   public:
00106     unsigned maternal;
00107     unsigned paternal;
00108         bool operator< (const MaternalPaternalAlleles y) const;
00109   };
00110   /*! \class MaternalPaternalAlleles gnodederived.h inc/gnodederived.h
00111    * \brief This is the building block class for the GenotypeNode class.
00112    *
00113    * MaternalPaternalAlleles class defines the maternal and paternal 
00114    * alleles of a genotype.
00115    */ 
00116   class GenotypeNode:public GNode{
00117 public:
00118           unsigned genotypeState,candidateGenotypeState,acceptedGenotypeState;
00119           GenotypeNode(void){
00120                   genotypeVector.name = "genotypeVector";
00121                   acceptedGenotypeVector.name = "acceptedGenotypeVector";
00122           }
00123           SafeSTLVector<MaternalPaternalAlleles> genotypeVector;
00124           SafeSTLVector<unsigned> genotypeCount;
00125           SafeSTLVector<MaternalPaternalAlleles> acceptedGenotypeVector;
00126           
00127           inline unsigned getState(void) {
00128                   return genotypeState;
00129           };
00130           inline unsigned getOldState(void) {
00131                   return acceptedGenotypeState;
00132           };
00133           inline unsigned getAcceptedMatState(void){
00134                   return acceptedGenotypeVector[acceptedGenotypeState].maternal;
00135           };
00136           inline unsigned getAcceptedPatState(void){
00137                   return acceptedGenotypeVector[acceptedGenotypeState].paternal;
00138           };
00139           inline unsigned getmState(void){
00140                   return genotypeVector[genotypeState].maternal;
00141           };
00142           inline unsigned getpState(void){
00143                   return genotypeVector[genotypeState].paternal;
00144           };
00145           inline unsigned getWeight(void) {
00146                   return genotypeVector.size();
00147           };
00148           void reset(int i){
00149                   genotypeState = i;
00150           };
00151           void resetAndSwitch(int i){
00152                   acceptedGenotypeState = genotypeState; 
00153                   acceptedGenotypeVector = genotypeVector;
00154                   genotypeState = i;
00155           };
00156           bool incr();
00157           ~GenotypeNode(void) {;}
00158   };
00159   /*! \class GenotypeNode gnodederived.h inc/gnodederived.h
00160    * \brief This is the genotype node class.
00161    *
00162    * GenotypeNode class has methods relevant to a genotype node
00163    */ 
00164 }////// end of namespace matvec 
00165 #endif

Generated on Thu Jun 16 17:13:43 2005 for Matvec by doxygen1.2.16