From 63c637b2c8b3b941cf021d1e549caec0041b4c3c Mon Sep 17 00:00:00 2001 From: Qiong Wang Date: Fri, 20 Feb 2015 14:42:40 -0500 Subject: [PATCH] Fixed bugs in the CrossValidate and Reprocess --- .../train/validation/crossvalidate/CrossValidate.java | 4 ++-- .../msu/cme/rdp/classifier/utils/ClassifierSequence.java | 9 ++++++--- src/edu/msu/cme/rdp/multicompare/Reprocess.java | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/edu/msu/cme/rdp/classifier/train/validation/crossvalidate/CrossValidate.java b/src/edu/msu/cme/rdp/classifier/train/validation/crossvalidate/CrossValidate.java index d7b6342..bc2aa0a 100644 --- a/src/edu/msu/cme/rdp/classifier/train/validation/crossvalidate/CrossValidate.java +++ b/src/edu/msu/cme/rdp/classifier/train/validation/crossvalidate/CrossValidate.java @@ -69,7 +69,7 @@ public ArrayList runTest(File tax_file, File source_file, File out_file DecisionMaker dm = new DecisionMaker(factory); // get all the genus node list HashMap genusNodeMap = new HashMap(); - factory.getRoot().getNodeMap(Taxonomy.GENUS, genusNodeMap); + factory.getRoot().getNodeMap(factory.getLowestRank(), genusNodeMap); if (genusNodeMap.isEmpty()) { throw new IllegalArgumentException("\nThere is no node in GENUS level!"); } @@ -115,7 +115,7 @@ public ArrayList runTest(File tax_file, File source_file, File out_file } List result = dm.getBestClasspath( wordIterator, genusNodeMap, useSeed, min_bootstrap_words); - + //xxx ValidClassificationResultFacade resultFacade = new ValidClassificationResultFacade(pSeq, result); diff --git a/src/edu/msu/cme/rdp/classifier/utils/ClassifierSequence.java b/src/edu/msu/cme/rdp/classifier/utils/ClassifierSequence.java index 5a3fcc4..c357434 100644 --- a/src/edu/msu/cme/rdp/classifier/utils/ClassifierSequence.java +++ b/src/edu/msu/cme/rdp/classifier/utils/ClassifierSequence.java @@ -36,9 +36,12 @@ public ClassifierSequence(String seqName, String desc, String seqString) throws * Fetches every overlapping word from the sequence string, changes each * word to integer format and saves in an array. */ - GoodWordIterator iterator = new GoodWordIterator(this.getSeqString()); - this.wordIndexArr = iterator.getWordArr(); - this.goodWordCount = wordIndexArr.length; + // Note when user provide the classification result, we don't get the sequence string + if ( !this.getSeqString().isEmpty()){ + GoodWordIterator iterator = new GoodWordIterator(this.getSeqString()); + this.wordIndexArr = iterator.getWordArr(); + this.goodWordCount = wordIndexArr.length; + } } /** diff --git a/src/edu/msu/cme/rdp/multicompare/Reprocess.java b/src/edu/msu/cme/rdp/multicompare/Reprocess.java index 6ce245b..06eaa16 100644 --- a/src/edu/msu/cme/rdp/multicompare/Reprocess.java +++ b/src/edu/msu/cme/rdp/multicompare/Reprocess.java @@ -140,7 +140,8 @@ public static void main(String [] args) throws Exception { } gene = line.getOptionValue(CmdOptions.GENE_SHORT_OPT).toLowerCase(); - if (!gene.equals(ClassifierFactory.RRNA_16S_GENE) && !gene.equals(ClassifierFactory.FUNGALLSU_GENE)) { + if (!gene.equals(ClassifierFactory.RRNA_16S_GENE) && !gene.equals(ClassifierFactory.FUNGALLSU_GENE) + && !gene.equals(ClassifierFactory.FUNGALITS_warcup_GENE) && !gene.equals(ClassifierFactory.FUNGALITS_unite_GENE) ) { throw new IllegalArgumentException(gene + " is NOT valid, only allows " + ClassifierFactory.RRNA_16S_GENE + ", " + ClassifierFactory.FUNGALLSU_GENE + ", " + ClassifierFactory.FUNGALITS_warcup_GENE + " and " + ClassifierFactory.FUNGALITS_unite_GENE); }