Package data.cerevisiae.harbison

Source Code of data.cerevisiae.harbison.Harbison2004L$HClassifier

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package data.cerevisiae.harbison;

import common.inspect.Classifier;
import common.inspect.GeneSet;
import fork.lib.math.applied.stat.Distribution;
import java.io.File;
import java.text.DecimalFormat;
import java.util.ArrayList;

/**
*
* @author forksapien
*/
public class Harbison2004L extends Harbison2004{
   
   
    public Harbison2004L(File f) throws Exception{
        super(f);
    }

   
   
   
@Override
public Classifier getClassifierForTF(String tf)throws Exception{
    tf= tf.toUpperCase();
    final int col= idCol.get(tf);
    Classifier ret= new HClassifier(tf, col);
    return ret;
}



class HClassifier extends Classifier{
   
protected int col;

    public HClassifier(String tit, int col) throws Exception{
        super(tit);
        this.col=col;
        init();
    }
   
    public void init() throws Exception{
        ArrayList<Double> vs= new ArrayList<>();
        for(int i=0; i<vss.length ; i++){
            vs.add( vss[i][col] );
        }
        double thr= new Distribution(vs).quantileBoundaries(20).get(1);
        String thrs= new DecimalFormat("0.##E0").format(thr);
       
        sets.add(new GeneSet(tit+"_"+thrs+"_y"));
        sets.add(new GeneSet(tit+"_"+thrs+"_n"));
       
        for(int i=0; i<vss.length ; i++){
            double v= vss[i][col];
            String id= ids[i];
            if(v<thr){
                sets.get(0).add(id);
            }else{
                sets.get(1).add(id);
            }
        }
    }
}

   
   
}
TOP

Related Classes of data.cerevisiae.harbison.Harbison2004L$HClassifier

TOP
Copyright © 2018 www.massapi.com. 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.