/*
* 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.histmod.liu2005_histmods;
import fork.lib.base.file.FileName;
import fork.lib.base.file.management.Dirs;
import fork.lib.bio.anno.genomic.BedGraphReader;
import fork.lib.bio.anno.genomic.BedReader;
import fork.lib.bio.anno.genomic.LandscapeBuilder;
import fork.lib.bio.anno.genomic.region.GenomicRegionsBuilder;
import fork.lib.bio.anno.genomic.region.GenomicRegionsModifier;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import data.cerevisiae.test.lineup.LineupSide;
/**
*
* @author man-mqbpjmg4
*/
public class LineupThree {
public static void main(String[] args) throws Exception { //debug
File dir= Dirs.getFile("dir");
File d= new File(dir+"/other_datasets/liu_2005_hist-mods/data/wig");
File ld= new File(d+"/lineup");
//File regf= new File(ld+"/chr3_cn3300_cz3.bed");
File regf= new File(ld+"/chr3_cn3300_cnz3.bed");
GenomicRegionsBuilder gb= new BedReader(regf).getGenomicRegionsBuilder();
GenomicRegionsModifier gm= new GenomicRegionsModifier(gb);
gb= gm.getThreePrimeEnds(300, 100);
File od= new File(ld+"/"+FileName.getBaseName(regf));
ArrayList<File> fs= new ArrayList<>();
File[] lfs= d.listFiles();
fs.addAll(Arrays.asList(lfs));
fs.add(new File(dir+"/data/chip-seq/norm/norm_wig_chip_htz1-anti660_884-rrp6d_sd_20131104-r1_pe1_sacCer1.wig"));
for( int i=0; i<fs.size(); i++ ){
File f= fs.get(i);
if(FileName.getExt(f).equals("wig")){
LandscapeBuilder lb= new BedGraphReader(f).getLandscapeBuilder();
LineupSide ls= new LineupSide(gb, lb);
File of= new File(od+"/"+FileName.getBaseName(f)+".txt");
ls.writeToFile(of);
}
}
}
}