File fa= new File(d+"/score_norm_htz1_len_150.bed");
File fb= new File(d+"/score_norm_k8ac_len_150.bed");
GenomicRegionsBuilder gba= new BedReader(fa).getGenomicRegionsBuilder();
GenomicRegionsBuilder gbb= new BedReader(fb).getGenomicRegionsBuilder();
GenomicRegionsBuilder gbde= new GenomicRegionsBuilder();
GenomicRegionsBuilder gbac= new GenomicRegionsBuilder();
Iterator<GenomicRegion> ita= gba.iterator();
Iterator<GenomicRegion> itb= gbb.iterator();
while(ita.hasNext()){
GenomicRegion ra= ita.next();
GenomicRegion rb= itb.next();
double va= ra.getValue();
double vb= rb.getValue();
if(va>z){
rb.setID(Double.toString(va)+"_"+Double.toString(vb));
rb.setValue(0);
if(vb<ac){
gbde.add(rb);
}else{
gbac.add(rb);
}
}
}
String tag= "z"+z+"_ac"+ac;
new BedExporter(gbde).writeToFile(new File(od+"/select-de_"+tag+".bed"));
GenomicRegionsLocator gl= new GenomicRegionsLocator(
gbde,
new BedReader(rf).getGenomicRegionsBuilder()
);
gl.writeToSeparateFiles(
new File(od+"/locate-de_"+tag+"_in.txt"),
new File(od+"/locate-de_"+tag+"_between.txt")
);
new BedExporter(gbac).writeToFile(new File(od+"/select-ac_"+tag+".bed"));
gl= new GenomicRegionsLocator(
gbac,
new BedReader(rf).getGenomicRegionsBuilder()
);
gl.writeToSeparateFiles(
new File(od+"/locate-ac_"+tag+"_in.txt"),
new File(od+"/locate-ac_"+tag+"_between.txt")
);