/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package common;
import fork.lib.base.file.io.txt.ReadTable;
import fork.lib.base.file.management.Dirs;
import fork.lib.math.applied.stat.Distribution;
import java.io.File;
import java.util.HashMap;
/**
*
* @author forksapien
*/
public class TFBinding {
protected File f;
protected HashMap<String,String> tfb;
public TFBinding(File f)throws Exception{
this.f=f;
init();
}
protected void init() throws Exception{
tfb = new ReadTable(f).getHashMap(0, 1);
}
public String getOutString(String li){
String[] ns= li.split(",");
String out= "c(";
Distribution dis= new Distribution();
for(int i=0; i<ns.length ; i++){
String n= ns[i];
if(tfb.containsKey(n)){
String ss= tfb.get(n);
out+=ss+",";
dis.add(Integer.parseInt(ss));
}
}
out= out.substring(0, out.length()-1);
out+=")";
out+="\nmu:"+dis.mean()+" zero:"+ (double)dis.subsetLowerOrEqualTo(0).size()/dis.size()
+" me:"+dis.median()+" s:"+dis.standartDeviation();
return out;
}
public static void main(String[] args) throws Exception{ //debug
}
}