Skip to content
Permalink
e37ee19ff8
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
49 lines (41 sloc) 1.51 KB
package edu.uconn.tripoint.export;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import quin.network.Location;
import edu.uconn.tripoint.pathway.Gene;
import edu.uconn.tripoint.pathway.Pathway;
import edu.uconn.tripoint.triangulation.TriangulatedGene;
public class NonCodingTargetExport {
public void ExportNonCodingTargets(Pathway globalpathway, Pathway[] pathways, Collection<TriangulatedGene> genes, Map<Gene, List<Location>> noncoding, String outdir, String prefix) throws IOException{
String outdir2 = outdir;
if(!outdir.endsWith("/")){
outdir2 += "/";
}
BufferedWriter bw = new BufferedWriter(new FileWriter(outdir2+prefix+"_noncoding.txt"));
bw.write("Gene ID"+"\t"+
"Chr"+"\t"+"Start"+"\t"+"End"+"\n");
for(Iterator<TriangulatedGene> it = genes.iterator(); it.hasNext();){
TriangulatedGene next = it.next();
writeLine(bw,next, noncoding);
}
bw.flush();
bw.close();
}
private void writeLine(BufferedWriter bw, TriangulatedGene g, Map<Gene, List<Location>> noncoding) throws IOException{
Gene gene = g.getGene();
List<Location> nc = noncoding.get(gene);
if(nc.size() > 0){
String id = gene.getId();
for(Iterator<Location> it = nc.iterator(); it.hasNext();){
Location next = it.next();
bw.write(id+"\t"+
next.getChr()+"\t"+next.getStart()+"\t"+next.getEnd()+"\n");
}
}
}
}