Buggy code:
public class CrossValidate { public ArrayList < HashMap > runTest ( File tax_file , File source_file , File out_file , String rdmSelectedRank , float fraction , Integer partialLength , boolean useSeed , int min_bootstrap_words ) throws IOException { BufferedWriter outWriter = new BufferedWriter ( new FileWriter ( out_file ) ) ; Set < String > selectedTestSeqIDs = null ; if ( rdmSelectedRank == null ) { selectedTestSeqIDs = ResampleSeqFile . randomSelectSeq ( source_file , fraction ) ; } else { selectedTestSeqIDs = RdmSelectTaxon . randomSelectTaxon ( tax_file , source_file , fraction , rdmSelectedRank ) ; } TreeFactory factory = setup ( tax_file , source_file , selectedTestSeqIDs ) ; DecisionMaker dm = new DecisionMaker ( factory ) ; HashMap < String , HierarchyTree > genusNodeMap = new HashMap < String , HierarchyTree > ( ) ; <START_BUG> factory . getRoot ( ) . getNodeMap ( GENUS , genusNodeMap ) ; <END_BUG> if ( genusNodeMap . isEmpty ( ) ) { throw new IllegalArgumentException ( "\nThere<seq2seq4repair_space>is<seq2seq4repair_space>no<seq2seq4repair_space>node<seq2seq4repair_space>in<seq2seq4repair_space>GENUS<seq2seq4repair_space>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 > ( ) ; 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 ( ) ) ; } else { wordIterator = new GoodWordIterator ( pSeq . getSeqString ( ) ) ; } if ( ( wordIterator == null ) || ( ( wordIterator . getNumofWords ( ) ) == 0 ) ) { continue ; } List result = dm . getBestClasspath ( wordIterator , genusNodeMap , useSeed , min_bootstrap_words ) ; ValidClassificationResultFacade resultFacade = new ValidClassificationResultFacade ( pSeq , result ) ; compareClassificationResult ( factory , resultFacade , rankNodeMap , statusCountList ) ; totalTest ++ ; } parser . close ( ) ; outWriter . write ( ( ( ( ( ( "taxon<seq2seq4repair_space>file\t" + ( tax_file . getName ( ) ) ) + "\n" ) + "train<seq2seq4repair_space>sequence<seq2seq4repair_space>file\t" ) + ( source_file . getName ( ) ) ) + "\n" ) ) ; outWriter . write ( ( ( "word<seq2seq4repair_space>size\t" + ( GoodWordIterator . getWordsize ( ) ) ) + "\n" ) ) ; outWriter . write ( ( ( "minimum<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>words<seq2seq4repair_space>for<seq2seq4repair_space>bootstrap\t" + min_bootstrap_words ) + "\n" ) ) ; if ( partialLength != null ) { outWriter . write ( ( ( "length\t" + partialLength ) + "\n" ) ) ; } else { outWriter . write ( ( "length\t" + ( "full" + "\n" ) ) ) ; } if ( rdmSelectedRank == null ) { outWriter . write ( ( "selectedRank\t" + ( "NA" + "\n" ) ) ) ; } else { outWriter . write ( ( ( "selectedRank\t" + rdmSelectedRank ) + "\n" ) ) ; } outWriter . write ( ( ( "trainingset<seq2seq4repair_space>size\t" + ( totalSeq - ( selectedTestSeqIDs . size ( ) ) ) ) + "\n" ) ) ; outWriter . write ( ( ( "testset<seq2seq4repair_space>size\t" + totalTest ) + "\n" ) ) ; outWriter . write ( calErrorRate ( statusCountList ) ) ; outWriter . close ( ) ; return statusCountList ; } private TreeFactory setup ( File tax_file , File source_file , Set < String > selectedTestSeqIDs ) throws IOException { } private HashSet < String > getnodeNameSet ( ArrayList < HierarchyTree > genusNodeList ) { } private void compareClassificationResult ( TreeFactory factory , ValidClassificationResultFacade resultFacade , HashMap < String , HashSet > rankNodeMap , ArrayList < HashMap > statusCountList ) throws IOException { } public String calErrorRate ( ArrayList < HashMap > statusCountList ) { } }

Fix:
factory . getRoot ( ) . getNodeMap ( factory . getLowestRank ( ) , genusNodeMap ) ;