public static void toRatio(File f, File ref, File out) throws Exception{
LandscapeBuffer lb= new BedGraphBuffer(f);
LandscapeBuffer lbref= new BedGraphBuffer(ref);
LandscapeComparatorBuffer lc = new LandscapeComparatorBuffer(lb, lbref) {
@Override
public double newValue(double v, double refv) {
return new Double( (double)Math.round(v/refv * 1000)/1000 );
}
};
String tag= FileName.getBaseName(f);
System.out.println("write ratio to: "+out);
lc.writeToFile(out, "ratio"+tag);
}