Package data.human.inhouse.chippeak

Source Code of data.human.inhouse.chippeak.GetNovelPeaks

/*
* 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.BedGraphExporter;
import fork.lib.bio.anno.genomic.BedReader;
import fork.lib.bio.anno.genomic.region.GenomicRegionsBuilder;
import fork.lib.bio.anno.genomic.region.GenomicRegionsComparator;
import fork.lib.bio.anno.genomic.region.GenomicRegionsModifier;
import java.io.File;

/**
*
* @author man-mqbpjmg4
*/
public class GetNovelPeaks {
   
   
protected GenomicRegionsBuilder peaks, anno;
   
   
    public GetNovelPeaks(GenomicRegionsBuilder peaks, GenomicRegionsBuilder anno)throws Exception {
        this.peaks=peaks;
        this.anno=anno;
    }
   
   
   
   
protected void writeToFile(File out)throws Exception {
    GenomicRegionsComparator comp= new GenomicRegionsComparator(peaks, anno);
    GenomicRegionsBuilder gbout= comp.getNonIntersection();
    new BedExporter(gbout).writeToFile(out);
}
   
   




public static void main(String[] args) throws Exception { //debug
    File dir= Dirs.getFile("dir");
    File d= new File(dir+"/data/human_magnus/h2az/macs");
    File anno= new File(dir+"/anno/hg19_ensGene_exon.bed");
   
    File od= new File(d+"/novel");
   
    int side= 5000;
    GenomicRegionsBuilder gbanno= new GenomicRegionsModifier(
            new BedReader(anno).getGenomicRegionsBuilder()).getExtendedRegions(side, side);
   
    File[] fs= d.listFiles();
    for( int i=0; i<fs.length; i++ ){
        File pf= fs[i];
        if(FileName.getExt(pf).equals("bed")){
            GenomicRegionsBuilder gbpeak= new BedReader(pf).getGenomicRegionsBuilder();
            GetNovelPeaks gn= new GetNovelPeaks(gbpeak, gbanno);

            File out= new File(od+"/novel_"+ pf.getName());
            gn.writeToFile(out);
        }
    }
}
   
   
   
   
}


TOP

Related Classes of data.human.inhouse.chippeak.GetNovelPeaks

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.