Package data.human.inhouse.chippeak.cuff

Source Code of data.human.inhouse.chippeak.cuff.CountAssociated

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package data.human.inhouse.chippeak.cuff;

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

/**
*
* @author muxin gu
*/
public class CountAssociated {
   
   
protected GenomicRegionsBuilder gbpeak, gbtr;
public int side= 100;
   
   
    public CountAssociated(GenomicRegionsBuilder gbpeak, GenomicRegionsBuilder gbtr)throws Exception{
        this.gbpeak= gbpeak;
        this.gbtr= gbtr;
    }
   
   
public void writeToDir(File od, String tag)throws Exception{
    GenomicRegionsBuilder gbr= new GenomicRegionsModifier(gbtr).getExtendedRegions(side, side);
    GenomicRegionsComparator gc= new GenomicRegionsComparator(gbpeak, gbr);
    File ofa= new File(od+"/asso-"+side+"_"+ tag+".bed");
    File ofn= new File(od+"/asso-not-"+side+"_"+ tag+".bed");
    new BedExporter( gc.getIntersection() ).writeToFile(ofa);
    new BedExporter( gc.getNonIntersection() ).writeToFile(ofn);
}
   
   
   
   
public static void main(String[] args) throws Exception { //debug
    File dir = Dirs.getFile("dir");
   
    String time= "5";
   
    File zd= new File(dir+"/data/human_magnus/h2az/macs/novel");
    File rd= new File(dir+"/data\\human_magnus\\rna\\cuff/time-"+time);
   
    File zf= new File(zd+"/novel_mcf7_chip-h2az_time-"+time+"_peaks.bed");
    File rf= new File(rd+"/novel.bed");
   
    GenomicRegionsBuilder gbz= new BedReader(zf).getGenomicRegionsBuilder();
    GenomicRegionsBuilder gbr= new BedReader(rf).getGenomicRegionsBuilder();
   
   
   
    CountAssociated cc= new CountAssociated(gbz, gbr);
    cc.writeToDir(rd, FileName.getBaseName(zf));
   
   
   
   
}
   
   
   
   
}
TOP

Related Classes of data.human.inhouse.chippeak.cuff.CountAssociated

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.