// find all the taxa for the ancestors
HashMap<String, Taxonomy> labeledTaxonMap = new HashMap<String, Taxonomy>();
labeledTaxonMap.put(factory.getRoot().getTaxonomy().getHierLevel(), factory.getRoot().getTaxonomy());
int pid = factory.getRoot().getTaxonomy().getTaxID();
for ( int i = 1 ; i < resultFacade.getAncestors().size(); i++){
Taxonomy tax = factory.getTaxonomy(resultFacade.getSeqName(), (String) resultFacade.getAncestors().get(i), pid, i);
labeledTaxonMap.put(tax.getHierLevel(), tax);
pid = tax.getTaxID();
}
List<ValidationClassificationResult> hitList = resultFacade.getRankAssignment();
for ( ValidationClassificationResult curRankResult: hitList){
String curRank = curRankResult.getBestClass().getTaxonomy().getHierLevel();
// find the corresponding ancestor at the current rank
Taxonomy matchingRankTaxon = labeledTaxonMap.get(curRank);
if ( matchingRankTaxon == null) { // no match rank found
// System.err.println("no matching rank labeled taxon found for " + resultFacade.getSeqName() + " at " + curRank );
continue;
}
HashSet<String> nodeNameSet = rankNodeMap.get(curRank);
if ( nodeNameSet != null){
int bootstrap = (int)(curRankResult.getNumOfVotes()*100);
//System.err.println( "rank: " + curRank + "\t" + matchingRankTaxon.getName() + "\t" + nodeNameSet.contains( matchingRankTaxon.getName()) + "\t" + bootstrap +"\t");
if ( nodeNameSet.contains( matchingRankTaxon.getName())){ // TP or FN
for( int b = 0; b <= bootstrap; b++){
((StatusCount)statusCountList.get(b).get(curRank)).incNumTP(1);
}
for( int b = bootstrap+1; b < statusCountList.size(); b++){
((StatusCount)statusCountList.get(b).get(curRank)).incNumFN(1);