/*
* 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.regseq;
import fork.lib.base.file.FileName;
import fork.lib.base.file.management.Dirs;
import fork.lib.bio.anno.genomic.BedReader;
import fork.lib.bio.anno.genomic.region.GenomicRegionsBuilder;
import fork.lib.bio.anno.genomic.region.GenomicRegionsModifier;
import fork.lib.bio.seq.FastaSequenceExtractor;
import java.io.File;
/**
*
* @author man-mqbpjmg4
*/
public class ToSeq {
public static void main(String[] args) throws Exception { //debug
File dir= Dirs.getFile("dir");
File d= new File(dir+"\\test_anal\\z3seq\\quant_z3as");
File fastaf= new File(dir+"/anno/genomes/sacCer1/sacCer1.fa");
String tag= "3prime_up";
File od= new File(d+"/"+tag);
File[] fs= d.listFiles();
for( int i=0; i<fs.length; i++ ){
File f= fs[i];
if(FileName.getExt(f).equals("bed")){
GenomicRegionsBuilder gb= new BedReader(f).getGenomicRegionsBuilder();
GenomicRegionsModifier gm= new GenomicRegionsModifier(gb);
gb= gm.getThreePrimeEnds(150, 0); /////////// modify this
FastaSequenceExtractor fe= new FastaSequenceExtractor(fastaf, gb, null);
File of= new File(od+"/"+tag+"_"+FileName.getBaseName(f)+".fasta");
fe.writeToFastaFile(of);
}
}
}
}