Package edu.msu.cme.rdp.classifier.train

Examples of edu.msu.cme.rdp.classifier.train.LineageSequence


        LineageSequenceParser parser = new LineageSequenceParser(in);
        boolean next = parser.hasNext();
        assertTrue(next);
        // test the first sequence
        LineageSequence pSeq = parser.next();
        String name = "X53199";
        assertEquals(name.toUpperCase(), pSeq.getSeqName());
        assertEquals("AZOSPIRILLUM_GROUP", (String) pSeq.getAncestors().get(4));
        assertEquals("PROTEOBACTERIA", (String) pSeq.getAncestors().get(2));
        assertEquals("GAEA", (String) pSeq.getAncestors().get(0));

        //test the last sequence
        parser.next();
        pSeq = parser.next();
        name = "AB002485";
        assertEquals(name.toUpperCase(), pSeq.getSeqName());
        assertEquals("M.RRR_SUBGROUP", (String) pSeq.getAncestors().get(5));
        assertEquals("TTTT_GROUP", (String) pSeq.getAncestors().get(4));
        assertEquals("BELTA_SUBDIVISION", (String) pSeq.getAncestors().get(3));
        assertEquals("GAEA", (String) pSeq.getAncestors().get(0));
        String sequence = "AAAAUAtttAGUCCCCCCCCUG";

        assertEquals(sequence, pSeq.getSeqString());
        assertTrue(!parser.hasNext());
    }
View Full Code Here


        File in = new File(System.class.getResource("/test/classifier/testTrainingSet.fasta").getFile());

        LineageSequenceParser parser = new LineageSequenceParser(in);
        // test the first sequence
        LineageSequence pSeq = parser.next();
        c1.initWordOccurrence(pSeq, wordPriorArr, true);

        pSeq = parser.next();
        c1.initWordOccurrence(pSeq, wordPriorArr, true);
View Full Code Here

        HierarchyTree c2 = new HierarchyTree("child2", root, c2Taxon);
        File in = new File(System.class.getResource("/test/classifier/testTrainingSet.fasta").getFile());

        LineageSequenceParser parser = new LineageSequenceParser(in);
        // test the first sequence
        LineageSequence pSeq = parser.next();
        c1.initWordOccurrence(pSeq, wordPriorArr, true);

        pSeq = parser.next();
        c1.initWordOccurrence(pSeq, wordPriorArr, true);
View Full Code Here

        ArrayList<HierarchyTree> nodeList = new ArrayList(nodeMap.values());
       
        // test the first sequence
        File queryReader = new File(System.class.getResource("/test/classifier/testNBClassifierSet.fasta").getFile());       
        parser = new LineageSequenceParser(queryReader);
        LineageSequence pSeq = parser.next();
        GoodWordIterator iterator = new GoodWordIterator(pSeq.getSeqString());
        NBClassifier classifier = new NBClassifier(factory, iterator.getWordArr(), nodeList, useSeed, min_bootstrap_words);

        assertEquals(pSeq.getSeqName(), "XG1_child1");       
        ValidationClassificationResult result = classifier.assignClass();
        assertEquals("G1", ((HierarchyTree) result.getBestClass()).getName());
        assertTrue(0.1 > result.getPosteriorProb());


        pSeq = parser.next();
        // test the 3rd getSequence()
        pSeq = parser.next();
        assertEquals(pSeq.getSeqName(), "XG2_child1");
        iterator = new GoodWordIterator(pSeq.getSeqString());
        classifier = new NBClassifier(factory, iterator.getWordArr(), nodeList, useSeed, min_bootstrap_words);
        result = classifier.assignClass();
        assertEquals("G2", ((HierarchyTree) result.getBestClass()).getName());
        assertTrue(0.2 > result.getPosteriorProb());


        pSeq = parser.next();
        // test the 5th getSequence()
        pSeq = parser.next();
        assertEquals(pSeq.getSeqName(), "XPh2G6_child1");
        iterator = new GoodWordIterator(pSeq.getSeqString());
        classifier = new NBClassifier(factory, iterator.getWordArr(), nodeList, useSeed, min_bootstrap_words);
        result = classifier.assignClass();
        assertEquals("G1", ((HierarchyTree) result.getBestClass()).getName());
        assertTrue(0.2 > result.getPosteriorProb());

        //test the 8th sequence in G7, it is the same as the 9th sequence in G8
        // the classifier should randomly choose a genus (either G7 or G8) because the score will be tie
        parser.next();
        parser.next();
        pSeq = parser.next();
        assertEquals(pSeq.getSeqName(), "XPh2G7_child1");
        iterator = new GoodWordIterator(pSeq.getSeqString());
        int G7_count = 0;
        int G8_count = 0;
        for ( int run = 0; run < DecisionMaker.NUM_OF_RUNS; run++){
            classifier = new NBClassifier(factory, iterator.getWordArr(), nodeList, useSeed, min_bootstrap_words);
            result = classifier.assignClass();
View Full Code Here

TOP

Related Classes of edu.msu.cme.rdp.classifier.train.LineageSequence

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.