Package edu.msu.cme.rdp.classifier.utils

Examples of edu.msu.cme.rdp.classifier.utils.ClassifierSequence


        for (MCSample sample : samples) {
            Sequence seq;

            while ((seq = sample.getNextSeq()) != null) {
                try {
                    ClassificationResult result = classifier.classify(new ClassifierSequence(seq), min_bootstrap_words);
                    if ( !format.equals(ClassificationResultFormatter.FORMAT.biom)){
                        printClassificationResult(result, assign_out, format, confidence);
                    }else {
                        seqClassificationMap.put(result.getSequence().getSeqName(), ClassificationResultFormatter.getOutput(result, format, confidence, ranks));
                    }
View Full Code Here


        Sequence pSeq = null;

        try {
            while ((pSeq = parser.readNextSequence()) != null) {
                try {
                    ClassificationResult result = aClassifier.classify(new ClassifierSequence(pSeq), min_bootstrap_words);
                    wt.write(ClassificationResultFormatter.getOutput(result, format));

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

            delimiter= ";";
        }
       
        String [] tokens = line.split(delimiter);
        List<RankAssignment> assignments = new ArrayList();
        ClassifierSequence seq = new ClassifierSequence(tokens[0], "", "");
       
        boolean seqreversed = (tokens[1].equalsIgnoreCase("-"));

        if ( !root.getName().equalsIgnoreCase(tokens[2].trim()) || !root.getRank().equalsIgnoreCase(tokens[3].trim())) {
            throw new IllegalArgumentException("Root of \"" + line + "\" does not match the Root node in the original Classifier training data: " + root.getName() + "\t" + root.getRank());
View Full Code Here

        if (parser != null) {
            Sequence seq = parser.readNextSequence();
            if(seq == null) {
                return null;
            } else {
                return new ClassifierSequence(seq);
            }
        } else {
            if (seqIndex < sampleSeqs.size()) {
                return sampleSeqs.get(seqIndex++);
            } else {
View Full Code Here

     * to calculate the joint probability. The number of times a genus was selected out of
     * the number of bootstrap trials was used as an estimate of confidence in the assignment to that genus.
     * @throws ShortSequenceException if the sequence length is less than the minimum sequence length.
     */
    public ClassificationResult classify(Sequence seq) {
        return classify(new ClassifierSequence(seq));
    }
View Full Code Here

        //                 "AAAAAAAAAG-CCCCCCCCUGAGGGUUACnAA";
        String seqString = "AAAAAAAAAG-CCCCCCCCUGAGGGUUACnAA";
        //                "TTNGTAACCCTCAGGGGGGGG-CTTTTTTTTT"
        String expected = "ttngtaaccctcaggggggggcttttttttt";
        ClassifierSequence aSeq = new ClassifierSequence("test", "", seqString);
        ClassifierSequence revSeq = aSeq.getReversedSeq();
        assertTrue(revSeq.isReverse());
        assertEquals(expected, revSeq.getSeqString());
    }
View Full Code Here

     */
    public void testCreateWordIndexArr() {
        System.out.println("testCreateWordIndexArr");

        String seqString = "AAAAAAAAAG-CCCCCCCCUGAGGGUUACnAA";
        ClassifierSequence aSeq = new ClassifierSequence("test", "", seqString);

        int[] wordIndexArr = aSeq.createWordIndexArr();

        assertEquals(0, wordIndexArr[0]);   //AAAAAAAA

        assertEquals(2, wordIndexArr[2]);    //AAAAAAAG

View Full Code Here

        // test the first sequence
        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();
View Full Code Here

TOP

Related Classes of edu.msu.cme.rdp.classifier.utils.ClassifierSequence

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.