NormChipSeqRPM.toRatio(f, in, outRat);
}
public void subtract()throws Exception {
Distribution dis0 = new BedGraphBuffer(outRat).getDistributionNonZero();
Distribution dis= dis0.subsetHigherThan(1);
dis= dis.subsetLowerOrEqualTo(dis.quantileBoundaries(10).get(5));
double mean= dis.mean();
double sd= dis.standartDeviation();
double rat= mean+ 1.2 *sd;
System.out.println("m: "+ mean+" sd: "+sd+" rat: "+rat);
//double rat= 2.5;
/*
while(true){
try{
String l= new BufferedReader(new InputStreamReader(System.in)).readLine();
String[] ss= l.split(" ");
int n= Integer.parseInt(ss[0]);
int tar= Integer.parseInt(ss[1]);
if(n==-1){
break;
}
ArrayList<Double> qs= dis.quantileBoundaries(n);
Distribution ndis= dis.subsetLowerOrEqualTo(qs.get(tar));
System.out.println("mean: "+ ndis.mean()+" sd: "+ ndis.standartDeviation());
}catch(Exception e){}
}
*/
LandscapeBuffer lbf= new BedGraphBuffer(f);
LandscapeBuffer lbi= new BedGraphBuffer(in);
BufferedWriter bw= new BufferedWriter(new FileWriter(outSub));
BedGraphExporter.writeTitle(bw, FileName.getBaseName(outSub));
String[] chrs= lbf.getUnsortedChromosomeList();
for( int i=0; i<chrs.length; i++ ){
LandscapeBuilder lbout= new LandscapeBuilder();
String chr= chrs[i];
System.out.print(chr+" ");
ArrayList<Region> frs= lbf.getLandscape2DForChromosome(chr).getRegions();
ArrayList<Region> irs= lbi.getLandscape2DForChromosome(chr).getRegions();
RegionBuffer buf= new RegionBuffer(irs);
for( int j=0; j<frs.size(); j++ ){
Region fr= frs.get(j);
ArrayList<Region> bufrs= buf.reloadAndGetList(fr);
double ival= RegionBuffer.getOverlap(bufrs, fr) / (fr.getRange()+1);