Package edu.msu.cme.rdp.classifier

Examples of edu.msu.cme.rdp.classifier.ClassificationResult


        try {
            parser = new SequenceReader(inStream1);
            while((pSeq = parser.readNextSequence()) != null) {
                try {
                    ClassificationResult result = aClassifier.classify(pSeq);
                    root = reconstructTree(result, root, SAMPLE1);
                    wt.write(ClassificationResultFormatter.getOutput(result, format));

                } catch (ShortSequenceException e) {
                    System.out.println(e.getMessage());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            parser = new SequenceReader(inStream2);
            while((pSeq = parser.readNextSequence()) != null) {
                try {
                    ClassificationResult result = aClassifier.classify(pSeq);
                    root = reconstructTree(result, root, SAMPLE2);
                    wt.write(ClassificationResultFormatter.getOutput(result, format));

                } catch (ShortSequenceException e) {
                    System.out.println(e.getMessage());
View Full Code Here


            }
            if ( !found){
                throw new IllegalArgumentException("taxon Node " + nextName + " in line \"" + line + "\" is not found in the original Classifier training data.");
            }
        }
        return new ClassificationResult(seq, seqreversed, assignments, versionNo);
    }
View Full Code Here

        String sequence = "";
        infile.readLine();
        sequence = infile.readLine();
        sequence = sequence.toUpperCase();
        ClassifierSequence pSeq = new ClassifierSequence("name", "title", sequence);
        ClassificationResult result = aClassifier.classify(pSeq);
       
        Iterator it = result.getAssignments().iterator();
        RankAssignment classResult = (RankAssignment) it.next();
        assertEquals(classResult.getBestClass().getName() , rootTree.getName());
        assertEquals(classResult.getConfidence(), 1.0, 0.1);
        classResult = (RankAssignment) it.next();
        assertEquals(classResult.getBestClass().getName() , "Proteobacteria");
        it.next();
        classResult = (RankAssignment) it.next();
        assertEquals(classResult.getBestClass().getName() , "Rhizobiales");
        it.next();
        classResult = (RankAssignment) it.next();
        assertEquals(classResult.getBestClass().getName() , "Rhizobium");
       
        //displayResult(result);
        // end of test first sequence
       
        // test the second sequence
        infile.readLine();
        sequence = infile.readLine();
        sequence = sequence.toUpperCase();
        pSeq = new ClassifierSequence("name", "title", sequence);
        result = aClassifier.classify(pSeq);
       
       
        it = result.getAssignments().iterator();
        classResult = (RankAssignment) it.next();
        assertEquals(classResult.getBestClass().getName() , rootTree.getName());
        assertEquals(classResult.getConfidence(), 1.0, 0.1);
        classResult = (RankAssignment) it.next();
        assertEquals(classResult.getBestClass().getName() , "Firmicutes");
View Full Code Here

TOP

Related Classes of edu.msu.cme.rdp.classifier.ClassificationResult

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.