#include <gnodestuff.h>
Inheritance diagram for matvec::GNodeList:

GNodeList class includes methods relevant to the list of graph nodes
Definition at line 165 of file gnodestuff.h.
Public Types | |
| typedef size_t | size_type |
Public Methods | |
| GNodeList (void) | |
| void | inputGNodeSets (char *fname) |
| method used in determining peeling order for a pedigree (used only if none of the make....GNodeSets methods is called) | |
| void | displayGNodeSets () |
| displays the GNodeSets of each Node (pentrance, founder, transition sets) | |
| void | getPeelOrder (char *fname) |
| returns the peeling order for a pedigree provided in the file given as an argument | |
| void | fill (unsigned n) |
| method used in determining peeling order for a pedigree (used only if make....GNodeSets is not called) | |
| void | makealleleGNodeSets (char *infile, char *outfile) |
| creates the AlleleNodeSets from the pedigree | |
| void | makegenotGNodeSets (char *infile, char *outfile) |
| creates the GenotypeNodeSets from the pedigree | |
| GNode * | peelAndCut (unsigned maxCutSetSize) |
| GNode * | peelAndCutFast (void) |
| void | peelCutAndCompute (unsigned maxCutSetSize, unsigned startBlock, unsigned stopBlock, unsigned sizeBlock) |
| void | peelCutAndSample (unsigned maxCutSetSize, unsigned startBlock, unsigned stopBlock, unsigned sizeBlock) |
| void | peelCutAndSample (unsigned maxCutSetSize) |
| void | peelOrderCutAndSample (unsigned maxCutSetSize, unsigned startBlock, unsigned stopBlock, unsigned sizeBlock) |
| void | peelOrderCutAndSample (unsigned maxCutSetSize) |
| void | clearGNodeListForNextLocus (void) |
| void | reinitGNodeList (void) |
| void | releaseGNsts (void) |
| void | releaseCutSets (void) |
| void | resetGNodeList (void) |
| void | setGNodeSampleFlags (unsigned startBlock, unsigned stopBlock, unsigned sizeBlock) |
| void | setGNodeSampleFlags (void) |
| void | findLoopAndCut () |
| GNodeList::iterator | getMinWeightGNode (void) |
| set< GNodeSet * >::iterator | getCutGNodeSet (GNodeList::iterator cutGNode) |
| void | propagateFlags (unsigned lowFlag, unsigned highFlag) |
| void | resetConnectFlags (void) |
| GNodeList | isolatePureLoop (GNodeList::iterator loopCloser) |
| void | cutLoop (GNodeList::iterator cutGNode, set< GNodeSet * >::iterator cutGNodeSet) |
| void | checkSample (void) |
| void | calculateTargetProb (void) |
| void | makeDistanceMatrix (void) |
| fills in distanceMatrix for all pairs of nodes | |
| void | calcDistancefrom (GNode *refGNode) |
| GNode * | findSampleGNode (void) |
| returns pointer to GNode with largest sum of distances to the "cuts" | |
| GNode *& | operator[] (const size_type i) |
Public Attributes | |
| float | sum |
| unsigned | lastmember |
| Matrix< int > | distanceMat |
| bool | distanceMatDone |
| SafeSTLVector< GNode * > | cutGNodesVector |
| set< GNode * > | loopSetGNodes |
| unsigned | maxDist |
| GNode * | sampleGNodePtr |
| GNode * | containerGNode |
| set< GNodeSet * > | completeSetofGNsts |
| set< CutSet * > | completeSetofCutSets |
| GNodeList::iterator | searchStart |
| GNodeList::iterator | cutGNode |
| GNode_info | choosenGNodeInfo |
| string | howToSample |
| string | name |
Static Public Attributes | |
| double | logTarget = 0.0 |
| double | logProposal = 0.0 |
| double | logOldProposal = 0.0 |
| Population * | popPtr |
|
|
Definition at line 33 of file safe_vectors.h. |
|
|
Definition at line 178 of file gnodestuff.h. References distanceMatDone.
00178 {distanceMatDone = false;};
|
|
|
Definition at line 456 of file gnodestuff.cpp. References matvec::GNode::connectFlag, distanceMat, matvec::GNode::id, and matvec::GNode::SetofGNsts. Referenced by makeDistanceMatrix().
00456 {
00457 // Authors: Joseph Abraham and Rohan L. Fernando
00458 // (October, 2004)
00459 // Contributors:
00460
00461 vector<unsigned> dist;
00462 unsigned UHUGE = 2*ULONG_MAX;
00463 GNode *gnodePtr;
00464 GNodeList::iterator GNodeListiter;
00465 set<GNodeSet*>::iterator GNodeSetiter;
00466 set<GNode*>::iterator GNodeiter;
00467 vector<GNode*>::iterator GreyListiter;
00468 vector<GNode*> GreyList;
00469
00470 GreyList.clear();
00471 unsigned rowId = refGNode->id;
00472 for(GNodeListiter = begin(); GNodeListiter != end(); GNodeListiter++){
00473 (*GNodeListiter)->connectFlag = ULONG_MAX; // every one gets white color
00474 }
00475 refGNode->connectFlag = 0; // this is colored gray
00476 GreyList.push_back(refGNode);
00477 distanceMat(rowId,rowId) = 0;
00478 while (GreyList.size() > 0){
00479 gnodePtr = GreyList.back();
00480 GreyList.pop_back();
00481 unsigned uId = gnodePtr->id;
00482 for(GNodeSetiter= gnodePtr->SetofGNsts.begin();GNodeSetiter !=gnodePtr->SetofGNsts.end();GNodeSetiter++){
00483 for(GNodeiter = (*GNodeSetiter)->begin(); GNodeiter!= (*GNodeSetiter)->end(); GNodeiter++){
00484 if ( (*GNodeiter)->connectFlag == ULONG_MAX) { // if color white
00485 (*GNodeiter)->connectFlag = 0; // make it gray
00486 unsigned colId = (*GNodeiter)->id;
00487 distanceMat(rowId,colId) = distanceMat(rowId,uId) + 1;
00488 GreyList.push_back(*GNodeiter);
00489 }
00490 }
00491 }
00492 gnodePtr->connectFlag = UHUGE;
00493 }
00494 }
|
|
|
Referenced by peelCutAndSample(), and peelOrderCutAndSample(). |
|
|
Referenced by peelCutAndCompute(), peelCutAndSample(), and peelOrderCutAndSample(). |
|
|
Referenced by peelCutAndCompute(), peelCutAndSample(), and peelOrderCutAndSample(). |
|
||||||||||||
|
|
|
|
displays the GNodeSets of each Node (pentrance, founder, transition sets)
Definition at line 138 of file gnodestuff.cpp. Referenced by matvec::Population::getInitialGNodeListSample(), and peelAndCut().
00138 {
00139 // Authors: L. Radu Totir and Rohan L. Fernando
00140 // (June, 2003)
00141 // Contributors:
00142 GNodeList::iterator it;
00143 set< GNodeSet*>::iterator GNodeSetit;
00144 GNodeSet::iterator setit;
00145 for (it=begin();it!=end();it++){
00146 std::cout << (*it)->id << " ";
00147 for (GNodeSetit=(*it)->SetofGNsts.begin();GNodeSetit!=(*it)->SetofGNsts.end();GNodeSetit++){
00148 (*GNodeSetit)->display();
00149 }
00150 std::cout << endl;
00151 }
00152 std::cout << "=========== " << endl;
00153 }
|
|
|
method used in determining peeling order for a pedigree (used only if make....GNodeSets is not called)
Definition at line 88 of file gnodestuff.cpp. References matvec::GNode::peelorder, and matvec::GNode::weight. Referenced by inputGNodeSets().
00088 {
00089 // Authors: L. Radu Totir and Rohan L. Fernando
00090 // (June, 2003)
00091 // Contributors:
00092 resize(n);
00093 for (unsigned i=0;i<n;i++){
00094 GNode* elm_ptr = new GNode;
00095 elm_ptr->peelorder = i+1;
00096 elm_ptr->weight = 1;
00097 (*this)[i] = elm_ptr;
00098 }
00099 }
|
|
|
Referenced by peelAndCut(). |
|
|
returns pointer to GNode with largest sum of distances to the "cuts"
Definition at line 407 of file gnodestuff.cpp. References cutGNodesVector, distanceMat, matvec::GNode::id, and loopSetGNodes. Referenced by peelAndCut().
00407 {
00408 // Authors: Joseph Abraham and Rohan L. Fernando
00409 // (October, 2004)
00410 // Contributors:
00411 unsigned maxDistance = 0;
00412
00413 GNode* sampleGuy = 0;
00414 set<GNode*>::iterator it;
00415 SafeSTLVector<GNode*>::iterator cutListIter;
00416 for(it=loopSetGNodes.begin();it!=loopSetGNodes.end();it++){
00417 if((*it)->sampled) continue;
00418 unsigned rowId = (*it)->id;
00419 unsigned sumDist = 0;
00420 for(cutListIter=cutGNodesVector.begin();cutListIter!=cutGNodesVector.end();cutListIter++){
00421 unsigned colId = (*cutListIter)->id;
00422 sumDist += distanceMat(rowId,colId);
00423 }
00424 cout << "distance " << sumDist << endl;
00425 if (sumDist>maxDistance){
00426 maxDistance = sumDist;
00427 sampleGuy = (*it);
00428 }
00429 }
00430 if (sampleGuy){
00431 return sampleGuy;
00432 }
00433 else {
00434 throw exception("GNodeList::findSampleGNode: Error- possible bug in code\n");
00435 }
00436 }
|
|
|
|
|
|
|
|
|
returns the peeling order for a pedigree provided in the file given as an argument
Definition at line 159 of file gnodestuff.cpp.
00159 {
00160 // Authors: L. Radu Totir and Rohan L. Fernando
00161 // (June, 2003)
00162 // Contributors:
00163 ofstream ordfile(fname);
00164 GNodeList::iterator it1,it2,peel_me;
00165 GNode* temp;
00166 float mag, min;
00167 sum =0.0;
00168 for (it1=begin();it1!=end();it1++){
00169 min = 1e+100;
00170 for (it2=it1;it2!=end();it2++){
00171 mag = (*it2)->getCutsetMagnitude();
00172 if (mag<min){
00173 peel_me = it2;
00174 min=mag;
00175 }
00176 }
00177 sum+=pow(double(4.0),double(min));
00178 ordfile << (*peel_me)->peelorder <<" "<< min << endl;
00179 //(*peel_me)->peelord = ++ord;
00180 (*peel_me)->updateMysets();
00181 temp = *it1;
00182 *it1 = *peel_me;
00183 *peel_me = temp;
00184 }
00185 ordfile << "Network size = " << sum << endl;
00186 std::cout << sum << endl;
00187 }
|
|
|
method used in determining peeling order for a pedigree (used only if none of the make....GNodeSets methods is called)
Definition at line 105 of file gnodestuff.cpp. References fill(), lastmember, and matvec::GNode::SetofGNsts.
00105 {
00106 // Authors: L. Radu Totir and Rohan L. Fernando
00107 // (June, 2003)
00108 // Contributors:
00109 ifstream setfile(fname);
00110 unsigned n,member;
00111 lastmember = 0;
00112 while (setfile >> n ) {
00113 for (unsigned i=0;i<n;i++){
00114 setfile >> member;
00115 if (member>lastmember){
00116 lastmember=member;
00117 }
00118 }
00119 }
00120 setfile.close();
00121 ifstream setfile1(fname);
00122 fill(lastmember);
00123 while (setfile1 >> n ) {
00124 GNodeSet* myset = new GNodeSet;
00125 for (unsigned i=0;i<n;i++){
00126 setfile1 >> member;
00127 GNode* elm_ptr = (*this)[member-1];
00128 myset->insert(elm_ptr);
00129 elm_ptr->SetofGNsts.insert(myset);
00130 }
00131 }
00132 }
|
|
|
|
|
||||||||||||
|
creates the AlleleNodeSets from the pedigree
Definition at line 52 of file gnodestuff.cpp.
00052 {
00053 // Authors: L. Radu Totir and Rohan L. Fernando
00054 // (June, 2003)
00055 // Contributors:
00056 ifstream infile(infilename);
00057 ofstream outfile(outfilename);
00058 unsigned ind,mom,dad;
00059 while (infile >> ind >> dad >> mom) {
00060 outfile << "2 " << (ind-1)*2 +1 << setw(5) << (ind-1)*2 +2 << endl;
00061 if(!dad) continue;
00062 outfile << "3 " << (dad-1)*2 +1 << setw(5) << (dad-1)*2 +2 << setw(5) << (ind-1)*2 +1 << endl;
00063 outfile << "3 " << (mom-1)*2 +1 << setw(5) << (mom-1)*2 +2 << setw(5) << (ind-1)*2 +2 << endl;
00064 }
00065 }
|
|
|
fills in distanceMatrix for all pairs of nodes
Definition at line 440 of file gnodestuff.cpp. References calcDistancefrom(), distanceMat, distanceMatDone, and matvec::Matrix< int >::resize(). Referenced by peelAndCut().
00440 {
00441 // Authors: Joseph Abraham and Rohan L. Fernando
00442 // (October, 2004)
00443 // Contributors:
00444 unsigned numGnodes = size();
00445 distanceMat.resize(numGnodes,numGnodes);
00446 GNodeList::iterator it;
00447 for (it=begin();it!=end();it++){
00448 calcDistancefrom(*it);
00449 }
00450 distanceMatDone = true;
00451 //cout << distanceMat;
00452 }
|
|
||||||||||||
|
creates the GenotypeNodeSets from the pedigree
Definition at line 71 of file gnodestuff.cpp.
00071 {
00072 // Authors: L. Radu Totir and Rohan L. Fernando
00073 // (June, 2003)
00074 // Contributors:
00075 ifstream infile(infilename);
00076 ofstream outfile(outfilename);
00077 unsigned ind,mom,dad;
00078 while (infile >> ind >> dad >> mom) {
00079 if(!dad) continue;
00080 outfile << "3 " << dad << setw(5) << mom << setw(5) << ind << endl;
00081 }
00082 }
|
|
|
Definition at line 39 of file safe_vectors.h.
00039 {
00040 if (i >= vector<T>::size()) {
00041 cout << "out of range error in SafeSTLVector: " << name << endl;
00042 cout << "i = " << i << endl;
00043 cout << "size of vector = " << vector<T>::size() << endl;
00044 throw matvec::exception("SafeSTLVector: out of range error");
00045 exit(1);
00046 }
00047 return *(vector<T>::begin() + i) ;
00048 }
|
|
|
Definition at line 342 of file gnodestuff.cpp. References matvec::GeneticDist::chrom(), cutGNodesVector, displayGNodeSets(), distanceMatDone, findLoopAndCut(), findSampleGNode(), howToSample, matvec::ChromStruct::locus, loopSetGNodes, makeDistanceMatrix(), maxDist, min, matvec::Population::model, matvec::Model::myRSamplerParms, matvec::ChromStruct::peelOrder, popPtr, matvec::RSamplerParms::printFlag, resetConnectFlags(), sampleGNodePtr, searchStart, matvec::sort(), and sum. Referenced by peelCutAndCompute(), peelCutAndSample(), and peelOrderCutAndSample().
00342 {
00343 // Authors: L. Radu Totir and Rohan L. Fernando
00344 // (August, 2003)
00345 // Contributors:
00346 unsigned printFlag = popPtr->model->myRSamplerParms.printFlag;
00347 if (!distanceMatDone) makeDistanceMatrix();
00348 cutGNodesVector.clear();
00349 loopSetGNodes.clear();
00350 searchStart = begin();
00351 resetConnectFlags();
00352 sampleGNodePtr=NULL;
00353 maxDist = 0;
00354 GNodeList::iterator it1,it2,peel_me;
00355 GNode* temp;
00356 float mag, min;
00357 sum =0.0;
00358 unsigned count=0;
00359 unsigned loopCount=0;
00360 it1=begin();
00361 while (it1!=end()){
00362 min = 1e+100;
00363 for (it2=it1;it2!=end();it2++){
00364 mag = (*it2)->getCutsetMagnitude();
00365 if (mag<min){
00366 peel_me = it2;
00367 min=mag;
00368 }
00369 }
00370 if(min<=maxCutSetSize){
00371 sum+=min;
00372 (*peel_me)->peelorder = ++count;
00373 (*peel_me)->updateMysets();
00374 if(printFlag>1) cout << "Peeling node " << count << endl;
00375 (*peel_me)->peel();
00376 if(howToSample=="joint"){
00377 GNodeSet::prior->chrom()[0].peelOrder[count-1] = (*peel_me)->id;
00378 }
00379 else{
00380 GNodeSet::prior->chrom()[0].locus[Individual::currentLocus].peelOrder[count-1] = (*peel_me)->id;
00381 }
00382 temp = *it1;
00383 *it1 = *peel_me;
00384 *peel_me = temp;
00385 it1++;
00386 }
00387 else {
00388 if(printFlag>1) cout << "Peeled " << count << " gNodes, now I need to cut ";
00389 searchStart = it1;
00390 sort(searchStart,end(),compareGNodesWeight());
00391 findLoopAndCut();
00392 loopCount++;
00393 }
00394 if(printFlag>2) {
00395 displayGNodeSets();
00396 }
00397 }
00398 if (cutGNodesVector.size()>0){
00399 sampleGNodePtr = findSampleGNode();
00400 }
00401 return sampleGNodePtr;
00402 }
|
|
|
Referenced by peelCutAndCompute(), and peelCutAndSample(). |
|
||||||||||||||||||||
|
Definition at line 193 of file gnodestuff.cpp. References checkSample(), matvec::GeneticDist::chrom(), clearGNodeListForNextLocus(), matvec::GNode::id, matvec::ChromStruct::locus, peelAndCut(), peelAndCutFast(), matvec::GNode::reComputeGNode(), reinitGNodeList(), sampleGNodePtr, and setGNodeSampleFlags(). Referenced by matvec::Population::getOldGNodeListProbability().
00193 {
00194 // Authors: L. Radu Totir and Rohan L. Fernando
00195 // (October, 2003)
00196 // Contributors:
00197 unsigned sampledCount = 0;
00198 GNodeList::reverse_iterator it;
00199 setGNodeSampleFlags(startBlock, stopBlock, sizeBlock);
00200 if (GNodeSet::prior->chrom()[0].locus[Individual::currentLocus].peelOrder.size()==size()){
00201 sampleGNodePtr = peelAndCutFast();
00202 }
00203 else{
00204 // cout << "We determine the peeling order again (inefficient!!)" << endl;
00205 sampleGNodePtr = peelAndCut(maxCutSetSize);
00206 }
00207 // cout << "I am calculating the probability of the previous sample" << endl;
00208 // cout << "Log Old Proposal before processing locus " << Individual::currentLocus+1 << " = " << GNodeList::logOldProposal << endl;
00209 //cout << "Log Target before = " << GNodeList::logTarget << endl;
00210 while (sampleGNodePtr) {
00211 sampledCount++;
00212 //displayGNodeSets();
00213 cout << "GNode sampled after " << sampledCount << " 'th peeling: " << sampleGNodePtr->id << endl;
00214 sampleGNodePtr->reComputeGNode();
00215 reinitGNodeList();
00216 //displayGNodeSets();
00217 sampleGNodePtr = peelAndCut(maxCutSetSize);
00218 }
00219 //cout << "Number of GNodes sampled to break loops = " << sampledCount << endl;
00220 //cout << "GNodeList before sampling all GNodes" << endl;
00221 for (it=rbegin();it!=rend();it++){
00222 if(!(*it)->sampled){
00223 (*it)->reComputeGNode();
00224 }
00225 }
00226 checkSample();
00227 // cout << "Log Old Proposal after processing locus " << Individual::currentLocus+1 << " = " << GNodeList::logOldProposal << endl;
00228 //calculateTargetProb();
00229 //cout << "Log Target after = " << GNodeList::logTarget << endl;
00230 //cout << "Final gNodeList (after peeling, cutting and sampling):" << endl;
00231 //displayGNodeSets();
00232 clearGNodeListForNextLocus();
00233 }
|
|
|
|
|
||||||||||||||||||||
|
Definition at line 238 of file gnodestuff.cpp. References calculateTargetProb(), checkSample(), matvec::GeneticDist::chrom(), clearGNodeListForNextLocus(), matvec::GNode::id, matvec::Population::LGGenotypeElimination(), matvec::ChromStruct::locus, matvec::Population::model, matvec::Model::myRSamplerParms, peelAndCut(), peelAndCutFast(), popPtr, matvec::RSamplerParms::printFlag, reinitGNodeList(), matvec::GNode::sampleGNode(), sampleGNodePtr, matvec::RSamplerParms::samplerType, matvec::Population::setAlleleStateVectors(), setGNodeSampleFlags(), and matvec::Population::SimpleGenotypeElimination(). Referenced by matvec::Population::getGNodeListSample().
00238 {
00239 // Authors: L. Radu Totir and Rohan L. Fernando
00240 // (October, 2003)
00241 // Contributors:
00242 unsigned printFlag = popPtr->model->myRSamplerParms.printFlag;
00243 unsigned sampledCount = 0;
00244 Model *modelPtr = popPtr->model;
00245 GNodeList::reverse_iterator it;
00246 setGNodeSampleFlags(startBlock, stopBlock, sizeBlock);
00247 bool cutLoops = GNodeSet::prior->chrom()[0].locus[Individual::currentLocus].cutLoops;
00248 if (GNodeSet::prior->chrom()[0].locus[Individual::currentLocus].peelOrder.size()==size() && !cutLoops){
00249 sampleGNodePtr = peelAndCutFast();
00250 }
00251 else{
00252 // cout << "We determine the peeling order again (inefficient!!)" << endl;
00253 popPtr->SimpleGenotypeElimination(Individual::currentLocus);
00254 if (sizeBlock == size() && GNodeSet::prior->chrom()[0].locus[Individual::currentLocus].qtl_ml=='m') {
00255 popPtr->LGGenotypeElimination(Individual::currentLocus);
00256 }
00257 popPtr->setAlleleStateVectors(Individual::currentLocus);
00258 sampleGNodePtr = peelAndCut(maxCutSetSize);
00259 }
00260 //cout << "I am actually sampling a new sample" << endl;
00261 //cout << "Log Proposal before processing locus " << Individual::currentLocus+1 << " = " << GNodeList::logProposal << endl;
00262 //cout << "Log Target before = " << GNodeList::logTarget << endl;
00263 while (sampleGNodePtr) {
00264 sampledCount++;
00265 //displayGNodeSets();
00266 if(printFlag>0) cout << "GNode sampled after " << sampledCount << " 'th peeling: " << sampleGNodePtr->id << endl;
00267 sampleGNodePtr->sampleGNode();
00268 reinitGNodeList();
00269 //displayGNodeSets();
00270 if (modelPtr->myRSamplerParms.samplerType=="genotypic"){
00271 popPtr->LGGenotypeElimination(Individual::currentLocus);
00272 popPtr->setAlleleStateVectors(Individual::currentLocus);
00273 }
00274 sampleGNodePtr = peelAndCut(maxCutSetSize);
00275 }
00276 if(printFlag>0) cout << "Number of GNodes sampled to break loops = " << sampledCount << endl;
00277 //cout << "GNodeList before sampling all GNodes" << endl;
00278 for (it=rbegin();it!=rend();it++){
00279 if(!(*it)->sampled){
00280 (*it)->reverseSampleGNode();
00281 }
00282 }
00283 checkSample();
00284 //cout << "Log Proposal after processing locus " << Individual::currentLocus+1 << " = " << GNodeList::logProposal << endl;
00285 calculateTargetProb();
00286 //cout << "Log Target after = " << GNodeList::logTarget << endl;
00287 //cout << "Final gNodeList (after peeling, cutting and sampling):" << endl;
00288 //displayGNodeSets();
00289 clearGNodeListForNextLocus();
00290 }
|
|
|
|
|
||||||||||||||||||||
|
Definition at line 295 of file gnodestuff.cpp. References calculateTargetProb(), checkSample(), matvec::GeneticDist::chrom(), clearGNodeListForNextLocus(), matvec::GNode::id, matvec::Population::LGGenotypeElimination(), matvec::ChromStruct::locus, matvec::Population::model, matvec::Model::myRSamplerParms, peelAndCut(), popPtr, matvec::RSamplerParms::printFlag, reinitGNodeList(), matvec::GNode::sampleGNode(), sampleGNodePtr, matvec::RSamplerParms::samplerType, matvec::Population::setAlleleStateVectors(), and setGNodeSampleFlags(). Referenced by matvec::Population::getInitialGNodeListSample().
00295 {
00296 // Authors: L. Radu Totir and Rohan L. Fernando
00297 // (February, 2004)
00298 // Contributors:
00299 unsigned printFlag = popPtr->model->myRSamplerParms.printFlag;
00300 Model *modelPtr = popPtr->model;
00301 unsigned sampledCount = 0;
00302 GNodeList::reverse_iterator it;
00303 setGNodeSampleFlags(startBlock, stopBlock, sizeBlock);
00304 sampleGNodePtr = peelAndCut(maxCutSetSize);
00305 GNodeSet::prior->chrom()[0].locus[Individual::currentLocus].cutLoops = false;
00306 //cout << "Log Proposal before = " << GNodeList::logProposal << endl;
00307 //cout << "Log Target before = " << GNodeList::logTarget << endl;
00308 while (sampleGNodePtr) {
00309 GNodeSet::prior->chrom()[0].locus[Individual::currentLocus].cutLoops = true;
00310 sampledCount++;
00311 //displayGNodeSets();
00312 if(printFlag>0) cout << "GNode sampled after " << sampledCount << " 'th peeling: " << sampleGNodePtr->id << endl;
00313 sampleGNodePtr->sampleGNode();
00314 reinitGNodeList();
00315 if (modelPtr->myRSamplerParms.samplerType=="genotypic"){
00316 popPtr->LGGenotypeElimination(Individual::currentLocus);
00317 popPtr->setAlleleStateVectors(Individual::currentLocus);
00318 }
00319 //displayGNodeSets();
00320 sampleGNodePtr = peelAndCut(maxCutSetSize);
00321 }
00322 if(printFlag>0) cout << "Number of GNodes sampled to break loops = " << sampledCount << endl;
00323 //cout << "GNodeList before sampling all GNodes" << endl;
00324 for (it=rbegin();it!=rend();it++){
00325 if(!(*it)->sampled){
00326 (*it)->reverseSampleGNode();
00327 }
00328 }
00329 checkSample();
00330 //cout << "Log Proposal after = " << GNodeList::logProposal << endl;
00331 calculateTargetProb();
00332 //cout << "Log Target after = " << GNodeList::logTarget << endl;
00333 //cout << "Final gNodeList (after peeling, cutting and sampling):" << endl;
00334 //displayGNodeSets();
00335 clearGNodeListForNextLocus();
00336 }
|
|
||||||||||||
|
|
|
|
|
|
|
|
Referenced by matvec::Population::initAlleleNodeList(), matvec::Population::initGenotypeNodeList(), matvec::Population::initJointAlleleNodeList(), and matvec::Population::release(). |
|
|
Referenced by peelAndCut(). |
|
|
|
|
|
Referenced by peelCutAndCompute(), peelCutAndSample(), and peelOrderCutAndSample(). |
|
||||||||||||||||
|
|
|
|
Definition at line 212 of file gnodestuff.h. |
|
|
Definition at line 190 of file gnodestuff.h. |
|
|
Definition at line 189 of file gnodestuff.h. Referenced by matvec::Population::initAlleleNodeList(), matvec::Population::initGenotypeNodeList(), and matvec::Population::initJointAlleleNodeList(). |
|
|
Definition at line 188 of file gnodestuff.h. |
|
|
Definition at line 192 of file gnodestuff.h. |
|
|
Definition at line 176 of file gnodestuff.h. Referenced by findSampleGNode(), and peelAndCut(). |
|
|
Definition at line 174 of file gnodestuff.h. Referenced by calcDistancefrom(), findSampleGNode(), and makeDistanceMatrix(). |
|
|
Definition at line 175 of file gnodestuff.h. Referenced by GNodeList(), makeDistanceMatrix(), and peelAndCut(). |
|
|
Definition at line 217 of file gnodestuff.h. Referenced by matvec::Population::initAlleleNodeList(), matvec::Population::initGenotypeNodeList(), matvec::Population::initJointAlleleNodeList(), and peelAndCut(). |
|
|
Definition at line 173 of file gnodestuff.h. Referenced by inputGNodeSets(). |
|
|
Definition at line 46 of file gnodestuff.cpp. Referenced by matvec::Model::RSamplerGibbsMH(), and matvec::Model::RSamplerMH(). |
|
|
Definition at line 45 of file gnodestuff.cpp. Referenced by matvec::Model::RSamplerGibbsMH(), and matvec::Model::RSamplerMH(). |
|
|
Definition at line 44 of file gnodestuff.cpp. Referenced by matvec::Model::RSamplerGibbsMH(), and matvec::Model::RSamplerMH(). |
|
|
Definition at line 177 of file gnodestuff.h. Referenced by findSampleGNode(), and peelAndCut(). |
|
|
Definition at line 186 of file gnodestuff.h. Referenced by peelAndCut(). |
|
|
Definition at line 32 of file safe_vectors.h. |
|
|
Definition at line 47 of file gnodestuff.cpp. Referenced by peelAndCut(), peelCutAndSample(), and peelOrderCutAndSample(). |
|
|
Definition at line 187 of file gnodestuff.h. Referenced by peelAndCut(), peelCutAndCompute(), peelCutAndSample(), and peelOrderCutAndSample(). |
|
|
Definition at line 191 of file gnodestuff.h. Referenced by peelAndCut(). |
|
|
Definition at line 172 of file gnodestuff.h. Referenced by getPeelOrder(), and peelAndCut(). |
1.2.16