Changeset 255
- Timestamp:
- Apr 13, 2007, 11:03:14 AM (15 years ago)
- Location:
- trunk/se/lu/onk/OneClass/src/oneclass/rankproduct
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/se/lu/onk/OneClass/src/oneclass/rankproduct/RankProduct.java
r252 r255 38 38 public class RankProduct 39 39 { 40 private final File dataFolder;41 42 40 private final BASEFile<Reporter, Spot> basefile; 43 41 … … 52 50 public RankProduct(BASEFile<Reporter, Spot> basefile) throws BASEFileException 53 51 { 54 dataFolder = new File("lib");55 dataFolder.mkdir();56 57 52 this.basefile = basefile; 58 53 readAssaySection(); … … 61 56 62 57 this.basefileOut = new BASEFile<ReporterOut, SpotOut>(new File("stdout.txt"), "rw"); 63 BASEFileSpotSection<Reporter, Spot> bfss = this.basefile.getSpotSection();64 58 BASEFileAssaySection bfas = new BASEFileAssaySection(); 65 59 bfas.setAnnotationColumns(""); … … 135 129 } 136 130 } 137 138 public void print Tab() throws BASEFileException131 132 public void print(File dataFolder) throws BASEFileException 139 133 { 140 134 bfss.sortReporter(new Comparator<Reporter>() … … 145 139 } 146 140 }); 147 148 writeTabFile(basefileOut.getSpotSection(0), new File(dataFolder, "resultUP.csv")); 149 writeTabFile(basefileOut.getSpotSection(1), new File(dataFolder, "resultDOWN.csv")); 150 } 151 152 private void writeTabFile(BASEFileSpotSection<ReporterOut, SpotOut> bfss, File file) throws BASEFileException 141 142 printTab(0, new File(dataFolder, "resultUP.csv")); 143 printTab(1, new File(dataFolder, "resultDOWN.csv")); 144 printHTML(0, new File(dataFolder, "resultUP.html")); 145 printHTML(1, new File(dataFolder, "resultDOWN.html")); 146 printBASE(); 147 } 148 149 private void printTab(int section, File file) throws BASEFileException 153 150 { 154 151 try … … 173 170 } 174 171 tab.println(formatArray("", "", "\t", tableRow)); 175 172 173 BASEFileSpotSection<ReporterOut, SpotOut> bfss = basefileOut.getSpotSection(section); 176 174 for (int i = 0; i < bfss.getHeight(); i++) 177 175 { … … 202 200 } 203 201 204 public void printHTML() throws BASEFileException 205 { 206 bfss.sortReporter(new Comparator<Reporter>() 207 { 208 public int compare(Reporter r1, Reporter r2) 209 { 210 return Double.compare(r1.getRankProduct(), r2.getRankProduct()); 211 } 212 }); 213 214 writeHTMLFile(basefileOut.getSpotSection(0), new File(dataFolder, "resultUP.html")); 215 writeHTMLFile(basefileOut.getSpotSection(1), new File(dataFolder, "resultDOWN.html")); 216 } 217 218 private void writeHTMLFile(BASEFileSpotSection<ReporterOut, SpotOut> bfss, File file) throws BASEFileException 202 public void printHTML(int section, File file) throws BASEFileException 219 203 { 220 204 try … … 229 213 230 214 String[] tableRow = new String[8]; 231 tableRow[0] = "Reporter"; 232 tableRow[1] = "GeneSymbol"; 215 tableRow[0] = "Reporter"; 216 tableRow[1] = "GeneSymbol"; 233 217 tableRow[2] = "LocusLink"; 234 218 tableRow[3] = "AverageM"; 235 219 tableRow[4] = "up/down"; 236 220 tableRow[5] = "Rank"; 237 tableRow[6] = "Rank product"; 221 tableRow[6] = "Rank product"; 238 222 tableRow[7] = "NumberOfValues"; 239 223 html.println("<tr>" + formatArray("<th>", "</th>", "", tableRow) + "</tr>"); 240 224 241 225 DecimalFormat df = new DecimalFormat("# ##0.000"); 226 BASEFileSpotSection<ReporterOut, SpotOut> bfss = basefileOut.getSpotSection(section); 242 227 for (int i = 0; i < 1000 && i < bfss.getHeight(); i++) 243 228 { … … 316 301 { 317 302 //Read spot section 318 BASEFileSpotSection<Reporter, Spot> bfss = basefile.getSpotSection();319 320 303 int mCol = bfss.getAssayFieldsColIndex("l2ratio1_2"); 321 304 int aCol = bfss.getAssayFieldsColIndex("l10intgmean1_2"); -
trunk/se/lu/onk/OneClass/src/oneclass/rankproduct/Start.java
r252 r255 39 39 try 40 40 { 41 File dataFolder = new File("lib"); 42 dataFolder.mkdir(); 43 41 44 BASEFile<Reporter, Spot> basefile; 42 45 basefile = new BASEFile<Reporter, Spot>(new File(args.length == 1 ? args[0] : "stdin.txt"), "r"); … … 44 47 RankProduct rankproduct = new RankProduct(basefile); 45 48 rankproduct.calculate(); 46 rankproduct.printTab(); 47 rankproduct.printHTML(); 48 rankproduct.printBASE(); 49 49 rankproduct.print(dataFolder); 50 50 } 51 51 catch (BASEFileException e)
Note: See TracChangeset
for help on using the changeset viewer.