# HG changeset patch # User mas01mc # Date 1213114972 0 # Node ID 1cec738101a86e8648372df39351fbf1202dab45 # Parent 210b2f661b8898f7b14d1e73dbaafcadcd0f7e72 Fixed trackSequenceQueryNNReporter and trackSequenceQueryRadNNReporter so that order of point reporting is what you would expect: i.e. closest to farthest. pointNN is set to allow a maximum (MAX_POINTNN) of 1000000 points. This allows computation of an S-Matrix using -Q nsequence. It also enables using the new -Q onetoonensequence query type for concatenative synthesis by finding the closest match in the entire database to each query point. Restrict lists (-K rList.txt) are useful for limiting the search to specific items in the database in these two cases. -This line, and those below, will be ignored-- M trunk/reporter.h diff -r 210b2f661b88 -r 1cec738101a8 reporter.h --- a/reporter.h Mon Jun 09 19:20:39 2008 +0000 +++ b/reporter.h Tue Jun 10 16:22:52 2008 +0000 @@ -1,5 +1,6 @@ #include #include +#include #include #include @@ -343,16 +344,23 @@ result.pop(); } std::vector::reverse_iterator rit; - + std::priority_queue< NNresult, std::vector< NNresult>, std::greater > point_queue; + if(adbQueryResponse==0) { for(rit = v.rbegin(); rit < v.rend(); rit++) { r = *rit; std::cout << fileTable + r.trackID*O2_FILETABLE_ENTRY_SIZE << " " << r.dist << std::endl; - unsigned int size = point_queues[r.trackID].size(); - for(unsigned int k = 0; k < size; k++) { - NNresult rk = point_queues[r.trackID].top(); + unsigned int qsize = point_queues[r.trackID].size(); + // Reverse the order of the points stored in point_queues + for(unsigned int k=0; k < qsize; k++){ + point_queue.push( point_queues[r.trackID].top() ); + point_queues[r.trackID].pop(); + } + + for(unsigned int k = 0; k < qsize; k++) { + NNresult rk = point_queue.top(); std::cout << rk.dist << " " << rk.qpos << " " << rk.spos << std::endl; - point_queues[r.trackID].pop(); + point_queue.pop(); } } } else { @@ -463,39 +471,42 @@ v.push_back(r); result.pop(); } + + + // Traverse tracks in descending order of count cardinality std::vector::reverse_iterator rit; - + std::priority_queue< NNresult, std::vector< NNresult>, std::greater > point_queue; + if(adbQueryResponse==0) { for(rit = v.rbegin(); rit < v.rend(); rit++) { r = *rit; std::cout << fileTable + r.trackID*O2_FILETABLE_ENTRY_SIZE << " " << r.count << std::endl; - int qsize=point_queues[r.trackID].size(); - for(int k=0; k < qsize; k++){ - NNresult rk = point_queues[r.trackID].top(); + + // Reverse the order of the points stored in point_queues + unsigned int qsize=point_queues[r.trackID].size(); + for(unsigned int k=0; k < qsize; k++){ + point_queue.push(point_queues[r.trackID].top()); + point_queues[r.trackID].pop(); + } + + for(unsigned int k=0; k < qsize; k++){ + NNresult rk = point_queue.top(); std::cout << rk.dist << " " << rk.qpos << " " << rk.spos << std::endl; - point_queues[r.trackID].pop(); + point_queue.pop(); } } } else { // FIXME } + delete[] point_queues; } +/********** ONE-TO-ONE REPORTERS *****************/ - - -/****************** EXPERIMENTAL REPORTERS ***************/ - - - - - - -// track Sequence Query Radius NN Reporter -// retrieve tracks ordered by query-point matches (one per track per query point) -// -// as well as sorted n-NN points per retrieved track +// track Sequence Query Radius NN Reporter One-to-One +// for each query point find the single best matching target point in all database +// report qpos, spos and trackID class trackSequenceQueryRadNNReporterOneToOne : public Reporter { public: trackSequenceQueryRadNNReporterOneToOne(unsigned int pointNN, unsigned int trackNN, unsigned int numFiles); @@ -533,18 +544,9 @@ void trackSequenceQueryRadNNReporterOneToOne::add_point(unsigned int trackID, unsigned int qpos, unsigned int spos, double dist) { std::set< NNresult >::iterator it; NNresult r; + r.qpos = qpos; r.trackID = trackID; - - // Track insertion count pairs - it = set->find(r); - if ( it == set->end() ) { - set->insert(r); - count[trackID]++; - } - - // Point insertion - // Keep the result with the smallest value (greedy local one-to-one algorithm) r.spos = spos; r.dist = dist;