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 FPMM_H 00023 #define FPMM_H 00024 00025 #include "dblock.h" 00026 #include "vector.h" 00027 00028 /*! 00029 \class Fpmm 00030 \brief Calculate transmission matrix for FPMM model 00031 00032 We do this "recursively". 00033 We first compute the joint probabliities for the polygenic numbers 00034 for mother, father, and offspring for just one locus. Then we assuming the 00035 second locus is independent, we can compute the polygenic numbers for mother, father, 00036 and offspring for two loci. 00037 */ 00038 00039 namespace matvec { 00040 class Fpmm { 00041 protected: 00042 Dblock trm; // transmission matrix 00043 int ndim; // 2 times nloci + 1 (number of polygenic classes) 00044 // goes from 0,1,...,2xnloci 00045 Vector<double> genval; 00046 Vector<double> genfreq; 00047 double freq; 00048 00049 00050 public: 00051 00052 Fpmm(void) {ndim=0;freq=0.5;var=1.0;} 00053 Fpmm(Fpmm& F); 00054 Fpmm(int nl, double frq, double vr) { 00055 setup_trm(nl, frq); 00056 setup_genval(vr); 00057 } 00058 double var; 00059 void initial(int nl, double frq, double vr) { 00060 // cout << "inside Fpmm.initial" << endl; 00061 setup_trm(nl, frq); 00062 setup_genval(vr); 00063 // cout << "exiting Fpmm.initial" << endl; 00064 } 00065 void setup_trm(int nl, double frq); 00066 void setup_genval(double vr); 00067 double getpr(int fpgn, int mpgn, int opgn){return trm[fpgn][mpgn][opgn];}; 00068 Vector<double> getgv(void){return genval;} 00069 Vector<double> getgenfreq(void){return genfreq;} 00070 void print_trm(void){std::cout << trm;} 00071 void print_genval(void){std::cout << genval;} 00072 void print_genfreq(void){std::cout << genfreq;} 00073 int get_dim(void) {return ndim;} 00074 int display(void); 00075 }; 00076 } 00077 00078 //BRS 00079 #endif 00080 00081
1.2.16