-//follows Mallard algorythn in paper referenced from mallard class
-vector<int> DeCalculator::returnObviousOutliers(vector< vector<quanMember> > quantiles, int num) {
- try {
- vector< vector<float> > quan;
- quan.resize(100);
-
- map<quanMember*, float> contributions; //map of quanMember to distance from high or low - how bad is it.
- vector<int> marked; //marked[0] is the penalty of template seqs[0]. the higher the penalty the more likely the sequence is chimeric
- marked.resize(num,0);
-
- //find contributions
- for (int i = 0; i < quantiles.size(); i++) {
-
- //find mean of this quantile score
- sort(quantiles[i].begin(), quantiles[i].end(), compareQuanMembers);
-
- float high = quantiles[i][int(quantiles[i].size() * 0.99)].score;
-
- //look at each value in quantiles to see if it is an outlier
- for (int j = 0; j < quantiles[i].size(); j++) {
-
- //is this score between above 99%
- if (quantiles[i][j].score > high) {
- //find out how "bad" of an outlier you are - so you can rank the outliers
- float dist = quantiles[i][j].score - high;
- contributions[&(quantiles[i][j])] = dist;
-
- //penalizing sequences for being in multiple outliers
- marked[quantiles[i][j].member1]++;
- marked[quantiles[i][j].member2]++;
- }
- }
- }
-
- //find contributer with most offending score related to it
- vector<quanMember> outliers = sortContrib(contributions);
-
- //go through the outliers marking the potential chimeras
- for (int i = 0; i < outliers.size(); i++) {
-
- //who is responsible for this outlying score?
- //if member1 has greater score mark him
- //if member2 has greater score mark her
- //if they are the same mark both
- if (marked[outliers[i].member1] > marked[outliers[i].member2]) { marked[outliers[i].member1]++; }
- else if (marked[outliers[i].member2] > marked[outliers[i].member1]) { marked[outliers[i].member2]++; }
- else if (marked[outliers[i].member2] == marked[outliers[i].member1]) { marked[outliers[i].member2]++; marked[outliers[i].member1]++; }
- }
-
- return marked;
- }
- catch(exception& e) {
- errorOut(e, "DeCalculator", "removeObviousOutliers");
- exit(1);
- }
-}
-//***************************************************************************************************************