Package common.inspect

Source Code of common.inspect.ClassifierGeneValue

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

import fork.lib.bio.anno.genomic.BedAttribute;
import fork.lib.bio.anno.genomic.BedReader;
import fork.lib.bio.anno.genomic.region.GenomicRegion;
import fork.lib.bio.anno.genomic.region.GenomicRegionsBuilder;
import fork.lib.math.applied.stat.Distribution;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

/**
*
* @author forksapien
*/
public class ClassifierGeneValue extends Classifier{
   
   

protected HashMap<String, Double> gvs;

protected int intv;

   
    public ClassifierGeneValue(HashMap<String, Double> gvs, String tit, int intv)throws Exception{
        super(tit);
        this.gvs=gvs;
        this.intv=intv;
        init();
    }
   
   
   
   

   
protected void init() throws Exception{
    Distribution disall= new Distribution(gvs.values());
    Distribution dis= disall.subsetHigherThan(0);
   
    ArrayList<Double> bs= dis.quantileBoundaries(intv);
    bs.add(0, -0.1);
   
    for( int i=0; i<bs.size()-1 ; i++ ){
        String n = tit+i+"_"+bs.get(i)+"_"+bs.get(i+1);
        sets.add(new GeneSet(n));
    }
   
    Iterator<String> it=gvs.keySet().iterator();
    while(it.hasNext()){
        String id= it.next();
        double v= gvs.get(id);
        for( int j=0; j<bs.size()-1 ; j++ ){
            if(v>bs.get(j) && v<=bs.get(j+1)){
                sets.get(j).add(id);
                break;
            }
        }
    }
}


   
   
}
TOP

Related Classes of common.inspect.ClassifierGeneValue

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.