/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package data.human.inhouse.chippeak.ap;
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.GenomicRegion;
import fork.lib.bio.anno.genomic.region.GenomicRegionsBuilder;
import java.io.File;
import java.util.Iterator;
/**
*
* @author muxin gu
*/
public class Extract {
public Extract(){
}
public static void main(String[] args) throws Exception { //debug
File dir= Dirs.getFile("dir");
File d= new File(dir+"/data/human_magnus/h2az/macs/merge");
File od= new File(d+"/extract");
File f= new File(d+"/locate_ensGene_hg19_exon.bed");
int tar= 5;
File out= new File(od+"/"+tar+"_"+FileName.getBaseName(f)+".bed");
GenomicRegionsBuilder gb= new BedReader(f).getGenomicRegionsBuilder();
GenomicRegionsBuilder gbout = new GenomicRegionsBuilder();
Iterator<GenomicRegion> it= gb.iterator();
while(it.hasNext()){
GenomicRegion gr= it.next();
if(gr.getValue()==tar){
gbout.add(gr);
}
}
new BedExporter(gbout).writeToFile(out);
}
}