Package common.inspect

Source Code of common.inspect.Classifier5PrimeUDv

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package common.inspect;

import fork.lib.base.file.io.txt.ReadTable;
import fork.lib.base.format.collection.FormatOp1D;
import java.io.File;
import java.util.HashMap;
import java.util.Iterator;

/**
*
* @author forksapien
*/
public class Classifier5PrimeUDv extends Classifier{
   
   
   
protected String tag;
protected File fu, fd;
   
public static int du= 30, ru= 2, dd= 80, rd= 4;
public static String U= "u1", D= "d1", NON= "n", BOTH="both", AM="am";
   
   
    public Classifier5PrimeUDv(File fu, File fd, String tit) throws Exception{
        super(tit);
        this.tag= tit;
        this.fu=fu;
        this.fd=fd;
        init();
    }
   
   
   
   
   
   
   

protected void init() throws Exception{
    sets.add(new GeneSet(tag+"_"+NON));
    sets.add(new GeneSet(tag+"_"+U));
    sets.add(new GeneSet(tag+"_"+D));

    String[] ids= new ReadTable(fu).getColumn(3);
    double[] vus= FormatOp1D.objToDouble(new ReadTable(fu).getColumn(4));
    double[] vds= FormatOp1D.objToDouble(new ReadTable(fd).getColumn(4));
    for(int i=0; i<ids.length ; i++){
        String id= ids[i];
        double vu= vus[i], vd= vds[i];
        if(vu>vd){
            double diff= vu-vd;
            if(diff>du){
                if(vu/vd>ru){
                    sets.get(1).add(id);
                }else{
                    sets.get(0).add(id);
                }
            }else{
                sets.get(0).add(id);
            }
        }else{
            double diff= vd-vu;
            if(diff>dd){
                if(vd/vu>rd){
                    sets.get(2).add(id);
                }else{
                    sets.get(0).add(id);
                }
            }else{
                sets.get(0).add(id);
            }
        }
    }
   
   
}


   
   
   
}
TOP

Related Classes of common.inspect.Classifier5PrimeUDv

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.