Package data.cerevisiae.test.ratio

Source Code of data.cerevisiae.test.ratio.ToRatio

/*
* 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.cerevisiae.test.ratio;

import fork.lib.base.file.FileName;
import fork.lib.base.file.management.Dirs;
import fork.lib.bio.anno.genomic.BedGraphBuffer;
import fork.lib.bio.anno.genomic.LandscapeBuffer;
import fork.lib.bio.anno.genomic.LandscapeComparatorBuffer;
import java.io.File;

/**
*
* @author man-mqbpjmg4
*/
public class ToRatio {

   
   

public static void toDiff(File f, File ref, File out) throws Exception{
    LandscapeBuffer lb= new BedGraphBuffer(f);
    LandscapeBuffer lbref= new BedGraphBuffer(ref);

    LandscapeComparatorBuffer lc = new LandscapeComparatorBuffer(lb, lbref) {
            @Override
            public double newValue(double v, double refv) {
                return new Double( (double)Math.round( (v- refv) * 1000)/1000  );
            }
        };
    String tag= FileName.getBaseName(f);
    lc.writeToFile(out, "diff"+tag);
}


public static void main(String[] args) throws Exception { //debug
    File dir= Dirs.getFile("dir");
    File d= new File(dir+"/data/chip-seq/norm");
   
   
   
    File f= new File(d+"/norm_wig_chip_htz1-anti660_743-htz1-4kr_ypd_20120814_sacCer1.wig");
    File ref= new File(d+"/norm_wig_chip_htz1-anti660_742-wt_ypd_20120814_sacCer1.wig");
    File out= new File("r1.wig");
   
    //File f= new File(d+"/norm_wig_chip_htz1-anti660_743-htz1-4kr_ypd_20130515_sacCer1.wig");
    //File ref= new File(d+"/norm_wig_chip_htz1-anti660_742-wt_ypd_20130309_sacCer1.wig");
    //File out = new File("r2.wig");
   
   
    toDiff(f, ref, out);
   
   
}


   
}
TOP

Related Classes of data.cerevisiae.test.ratio.ToRatio

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.