}else {
selectedTestSeqIDs = RdmSelectTaxon.randomSelectTaxon(tax_file, source_file, fraction, rdmSelectedRank);
}
TreeFactory factory = setup(tax_file, source_file, selectedTestSeqIDs );
DecisionMaker dm = new DecisionMaker(factory);
// get all the genus node list
HashMap<String, HierarchyTree> genusNodeMap = new HashMap<String, HierarchyTree>();
factory.getRoot().getNodeMap(Taxonomy.GENUS, genusNodeMap);
if (genusNodeMap.isEmpty()) {
throw new IllegalArgumentException("\nThere is no node in GENUS level!");
}
HashMap<String,HashSet> rankNodeMap = new HashMap<String,HashSet>();
for (String rank: factory.getRankSet()){
ArrayList<HierarchyTree> nodeList = new ArrayList<HierarchyTree>();
factory.getRoot().getNodeList(rank, nodeList);
HashSet<String> nodeNameSet = getnodeNameSet(nodeList);
rankNodeMap.put(rank, nodeNameSet);
}
ArrayList<HashMap> statusCountList = new ArrayList<HashMap>();
// initialize a list of statusCount, one for each bootstrap from 0 to 100
for ( int b = 0; b <= 100; b++){
HashMap<String, StatusCount> statusCountMap = new HashMap<String, StatusCount>();
statusCountList.add(statusCountMap);
for (String rank: factory.getRankSet()){
statusCountMap.put(rank, new StatusCount());
}
}
int totalTest = 0;
int totalSeq = 0;
LineageSequenceParser parser = new LineageSequenceParser(source_file);
while ( parser.hasNext()){
totalSeq ++;
LineageSequence pSeq = parser.next();
if ( !selectedTestSeqIDs.contains(pSeq.getSeqName()) || pSeq.getSeqString().length() == 0){
continue;
}
GoodWordIterator wordIterator = null ;
if ( partialLength != null ){
wordIterator = pSeq.getPartialSeqIteratorbyGoodBases(partialLength.intValue()); // test partial sequences with good words only
}else {
wordIterator = new GoodWordIterator(pSeq.getSeqString()); // full sequence
}
if (wordIterator == null || wordIterator.getNumofWords() == 0){
//System.err.println(pSeq.getSeqName() + " unable to find good sequence");
continue;
}
List result = dm.getBestClasspath( wordIterator, genusNodeMap, useSeed, min_bootstrap_words);
//xxx
ValidClassificationResultFacade resultFacade = new ValidClassificationResultFacade(pSeq, result);
compareClassificationResult(factory, resultFacade, rankNodeMap, statusCountList);