#include <fpmm.h>
Public Methods | |
| Fpmm (void) | |
| Fpmm (Fpmm &F) | |
| Fpmm (int nl, double frq, double vr) | |
| void | initial (int nl, double frq, double vr) |
| void | setup_trm (int nl, double frq) |
| void | setup_genval (double vr) |
| double | getpr (int fpgn, int mpgn, int opgn) |
| Vector< double > | getgv (void) |
| Vector< double > | getgenfreq (void) |
| void | print_trm (void) |
| void | print_genval (void) |
| void | print_genfreq (void) |
| int | get_dim (void) |
| int | display (void) |
Public Attributes | |
| double | var |
Protected Attributes | |
| Dblock | trm |
| int | ndim |
| Vector< double > | genval |
| Vector< double > | genfreq |
| double | freq |
|
|
Definition at line 52 of file fpmm.h. References freq, ndim, and var.
|
|
|
Definition at line 26 of file fpmm.cpp. References freq, genfreq, genval, ndim, and trm.
|
|
||||||||||||||||
|
Definition at line 54 of file fpmm.h. References setup_genval(), and setup_trm().
00054 {
00055 setup_trm(nl, frq);
00056 setup_genval(vr);
00057 }
|
|
|
Definition at line 157 of file fpmm.cpp. References genval.
00157 {
00158 std::cout << "Fpmm Object: Polygenic Values" << std::endl;
00159 std::cout << genval << std::endl;
00160 return 1;
00161 }
|
|
|
Definition at line 73 of file fpmm.h. References ndim. Referenced by matvec::Population::multipoint_init_parm().
00073 {return ndim;}
|
|
|
Definition at line 69 of file fpmm.h. Referenced by matvec::Population::multipoint_init_parm().
00069 {return genfreq;}
|
|
|
Definition at line 68 of file fpmm.h. Referenced by matvec::Population::multipoint_init_parm().
00068 {return genval;}
|
|
||||||||||||||||
|
Definition at line 67 of file fpmm.h. Referenced by matvec::NuFamily::multi_anterior(), and matvec::NuFamily::multi_fullsibs_prob().
00067 {return trm[fpgn][mpgn][opgn];};
|
|
||||||||||||||||
|
Definition at line 59 of file fpmm.h. References setup_genval(), and setup_trm().
00059 {
00060 // cout << "inside Fpmm.initial" << endl;
00061 setup_trm(nl, frq);
00062 setup_genval(vr);
00063 // cout << "exiting Fpmm.initial" << endl;
00064 }
|
|
|
Definition at line 72 of file fpmm.h.
00072 {std::cout << genfreq;}
|
|
|
Definition at line 71 of file fpmm.h.
00071 {std::cout << genval;}
|
|
|
Definition at line 70 of file fpmm.h.
00070 {std::cout << trm;}
|
|
|
Definition at line 133 of file fpmm.cpp. References genfreq, genval, ndim, matvec::Vector< double >::resize(), and var. Referenced by Fpmm(), and initial().
00133 {
00134 var = vr;
00135 int gen;
00136 double mean=0.0, vart=0.0,scale;
00137
00138 genval.resize(ndim);
00139 if (ndim == 1) {
00140 // no polygenic component
00141 genval[0]=0.0;
00142 }
00143 else {
00144 for (gen=0; gen<ndim; gen++){
00145 mean += gen*genfreq[gen];
00146 }
00147 for (gen=0; gen<ndim; gen++){
00148 vart += (gen - mean)*(gen - mean)*genfreq[gen];
00149 }
00150 scale = std::sqrt(var/vart);
00151 for (gen=0; gen<ndim; gen++){
00152 genval[gen] = (gen - mean)*scale;
00153 }
00154 }
00155 }
|
|
||||||||||||
|
Definition at line 34 of file fpmm.cpp. References freq, genfreq, ndim, matvec::Vector< double >::resize(), matvec::Dblock::resize(), and trm. Referenced by Fpmm(), and initial().
00034 {
00035
00036 int locus,m, f, o,m1, f1, o1;
00037 int ndimt;
00038 Vector<double> gf(3); // genotypic freqs for 1 locus
00039 double sum;
00040 Dblock trmt; // temporary transmission matrix; used to update trm
00041 Dblock trm1; // transmission matrix for one locus
00042
00043 freq = 1 - fq; // to be consistent with SALP freq is the frequency of the bad allele
00044 ndim=2*nl+1;
00045
00046 trm.resize(ndim,ndim,ndim);
00047 genfreq.resize(ndim);
00048 if (ndim == 1) {
00049 // We have no polygenic component so ndim=ncol=nrow=1 so that
00050 // trm is 1 and genfreq=1
00051 trm[0][0][0]=1.0;
00052 genfreq[0]=1.0;
00053 }
00054 else {
00055 trmt.resize(ndim,ndim,ndim);
00056 trm1.resize(3,3,3);
00057
00058 gf(1) = (1-freq)*(1-freq);
00059 gf(2) = 2*freq*(1-freq);
00060 gf(3) = freq*freq;
00061
00062 // transition probs; father, mother, child
00063 double A[3][3][3] =
00064 {1.0, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 1.0, 0.0,
00065 0.5, 0.5, 0.0, 0.25, 0.5, 0.25, 0.0, 0.5, 0.5,
00066 0.0, 1.0, 0.0, 0.0, 0.5, 0.5, 0.0,0.0,1.0};
00067
00068 // calculating trm1
00069
00070 for (f=0;f<3;f++){
00071 for (m=0;m<3;m++){
00072 for (o=0;o<3;o++){
00073 trm1[f][m][o] = A[f][m][o]*gf[f]*gf[m];
00074 trmt[f][m][o] = trm1[f][m][o];
00075 trm[f][m][o] = trm1[f][m][o];
00076 }
00077 }
00078 }
00079
00080 for (locus=2; locus<=nl; locus++){
00081 // inittialize trm to zero
00082 ndimt = 2*locus + 1;
00083 for (f=0;f<ndimt;f++){
00084 for (m=0;m<ndimt;m++){
00085 for (o=0;o<ndimt;o++){
00086 trm[f][m][o] = 0.0;
00087 }
00088 }
00089 }
00090 // go through all combinations of trmt
00091 ndimt = 2*(locus-1) + 1;
00092 for (f=0;f<ndimt;f++){
00093 for (m=0;m<ndimt;m++){
00094 for (o=0;o<ndimt;o++){
00095 // make appropriate contributions for each comb. of trm1
00096 for (f1=0;f1<3;f1++){
00097 for (m1=0;m1<3;m1++){
00098 for (o1=0;o1<3;o1++){
00099 trm[f+f1][m+m1][o+o1] += trmt[f][m][o]*trm1[f1][m1][o1];
00100 }
00101 }
00102 }
00103 }
00104 }
00105 }
00106 ndimt = 2*locus + 1;
00107 for (f=0;f<ndimt;f++){
00108 for (m=0;m<ndimt;m++){
00109 for (o=0;o<ndimt;o++){
00110 trmt[f][m][o] = trm[f][m][o];
00111 }
00112 }
00113 }
00114 }
00115 for (f=0;f<ndim;f++){
00116 genfreq[f] = 0.0;
00117 for (m=0;m<ndim;m++){
00118 sum = 0.0;
00119 for (o=0;o<ndim;o++){
00120 sum += trm[f][m][o];
00121 }
00122 genfreq[f] += sum;
00123 for (o=0;o<ndim;o++){
00124 trm[f][m][o] /= sum;
00125 }
00126 }
00127 }
00128 }
00129 // std::cout << genfreq;
00130
00131 }
|
|
|
|
|
|
Definition at line 46 of file fpmm.h. Referenced by Fpmm(), setup_genval(), and setup_trm(). |
|
|
Definition at line 45 of file fpmm.h. Referenced by display(), Fpmm(), and setup_genval(). |
|
|
Definition at line 43 of file fpmm.h. Referenced by Fpmm(), get_dim(), setup_genval(), and setup_trm(). |
|
|
|
|
|
Definition at line 58 of file fpmm.h. Referenced by Fpmm(), matvec::Individual::initial_multi_m_anterior(), matvec::NuFamily::multi_m_anterior(), matvec::Population::multi_m_log_likelihood_peeling(), matvec::NuFamily::multi_sumint_offspring(), matvec::Model::multipoint_estimate_PolyV(), and setup_genval(). |
1.2.16