public static void normalise(LandscapeBuilder lb, File of, String tit, double seqDepth) throws Exception{
new LandscapeTransformer(lb).selectLength(100, Double.POSITIVE_INFINITY);
new LandscapeTransformer(lb).divideBy( (seqDepth)/1000000 );
BedGraphExporter be= new BedGraphExporter(lb){
public void appendToFile(BufferedWriter bw) throws IOException{
String[] chrs= lb.getChromosomeList();
for( int j=0; j<chrs.length ; j++ ){
String chr= chrs[j];
ArrayList<Region> rs= lb.getLandscape2DForChromosome(chr).getRegions();
if(rs!=null && rs.size()>=1){
for( int i=0; i<rs.size() ; i++ ){
Region r = rs.get(i);
double v= Double.parseDouble(r.attr.toString());
if(v!=0 & r.low>0){
bw.write(chr+"\t"+
(int)r.low+"\t"+
(int)(r.high+1)+"\t"+
format(v)+"\n");
}
}
}
}
}
};
be.param().tit= tit;
be.writeToFile(of);
}