/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package data.human.inhouse.chippeak;
import fork.lib.base.file.FileName;
import fork.lib.base.file.management.Dirs;
import fork.lib.bio.anno.genomic.BedExporter;
import fork.lib.bio.anno.genomic.BedReader;
import fork.lib.bio.anno.genomic.region.GenomicRegionsBuilder;
import fork.lib.bio.anno.genomic.region.GenomicRegionsMerger;
import java.io.File;
/**
*
* @author man-mqbpjmg4
*/
public class MergeNovelPeaksIntron {
public static void main(String[] args) throws Exception { //debug
File dir= Dirs.getFile("dir");
File d= new File(dir+"/data/human_magnus/h2az/norm/peak/novel");
File out= new File(d+"/merge.bed");
GenomicRegionsMerger mer= new GenomicRegionsMerger();
mer.param().gap= 1000;
File[] fs= d.listFiles();
for( int i=0; i<fs.length; i++ ){
File f= fs[i];
if(FileName.getExt(f).equals("bed") && !f.getName().equals(out.getName()) ){
System.out.println(f);
GenomicRegionsBuilder gb= new BedReader(f).getGenomicRegionsBuilder();
mer.mergeNoSort(gb);
}
mer.sort();
new BedExporter(mer.getMergedGenomicRegionsBuilder()).writeToFile(out);
}
}
}